Is it possible to determine from instance if it's a member of AutoScaling Group in AWS?
Thanks in advance!
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ , and choose Auto Scaling Groups from the navigation pane. Select the check box next to the Auto Scaling group. A split pane opens up in the bottom of the Auto Scaling groups page.
You can use the describe-auto-scaling-instances function to check which autoscaling group the instance is attached to. However if it is not attached to any this will be an empty list. If this returns no results then that instance is not part of an autoscaling group.
01 Sign in to the AWS Management Console. 02 Navigate to EC2 dashboard at https://console.aws.amazon.com/ec2/. 03 In the left navigation panel, under INSTANCES section, choose Instances. 04 Select the EC2 instance that you want to examine.
If you specify scaling policies, then Amazon EC2 Auto Scaling can launch or terminate instances as demand on your application increases or decreases. For example, the following Auto Scaling group has a minimum size of one instance, a desired capacity of two instances, and a maximum size of four instances.
You can run this command on an EC2 Linux instance to check if the current instance is in an AutoScaling group. You will need to check if the returned value is empty to determine if it is in an AutoScaling group or not.
aws autoscaling describe-auto-scaling-instances --instance-ids `curl --silent http://169.254.169.254/latest/meta-data/instance-id 2>&1`
Note, you will have to have the AWS CLI tool installed and configured before you can run this command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With