Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if instance is a part of some AutoScaling Group in AWS

Is it possible to determine from instance if it's a member of AutoScaling Group in AWS?

Thanks in advance!

like image 617
kagarlickij Avatar asked Feb 10 '17 14:02

kagarlickij


People also ask

How do I know if an instance is part of Auto Scaling group AWS?

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.

How do you check if an instance is attached to an Auto Scaling group?

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.

How do I find the instance of an Auto Scaling 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.

How many instances can an EC2 Auto Scaling group have?

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.


1 Answers

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.

like image 85
Mark B Avatar answered Oct 30 '22 18:10

Mark B