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

情到浓时终转凉″ 提交于 2019-12-12 17:17:03

问题


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

Thanks in advance!


回答1:


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.




回答2:


Install AWS CLI on the instance and run this command: aws autoscaling describe-auto-scaling-instances

You can query the instance meta-data and compare the instance-id you have received from the previous command to check if the instance is part of autoscaling group.

To query instance-meta data, try curl http://169.254.169.254/latest/dynamic/instance-identity/document



来源:https://stackoverflow.com/questions/42161300/determine-if-instance-is-a-part-of-some-autoscaling-group-in-aws

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!