Issue
I found a notification mail from AWS that my autoscaling group's desired capacity has been changed from 2 to 1.
Is there any way to find out who made this change? Do I need to check any log or do I need to use any other AWS service to find this sort of information?
Part of the message is below:
Description: Terminating EC2 instance: i-xxxxxxxx
Cause: At 2021-02-01T03:08:59Z a user request update of AutoScalingGroup constraints to min: 1, max: 2, desired: 1 changing the desired capacity from 2 to 1. At 2021-02-01T03:09:01Z an instance was taken out of service in response to a difference between desired and actual capacity, shrinking the capacity from 2 to 1. At 2021-02-01T03:09:01Z instance i-xxxxxxx
Solution
You could inspect CloudTrail Event History for any API events related to autoscaling in the time frame of the incident.
Specifically you could look for SetDesiredCapacity API action.
Answered By - Marcin