How to get a list of EC2 instances in an EC2 Auto Scale group?

0 votes

I need a dynamically generated list of production instance to hook into our deploy process.

Is there a utility or script available to retrieve a list of all instances from AWS EC2 autoscale group?

Oct 31, 2018 in AWS by datageek
• 3,040 points
173 views

1 answer to this question.

0 votes

Here is a bash command that will give you the list of IP addresses of your instances in an AutoScaling group.

for ID in $(aws autoscaling describe-auto-scaling-instances --region us-east-1 --query AutoScalingInstances[].InstanceId --output text);
do
aws ec2 describe-instances --instance-ids $ID --region us-east-1 --query Reservations[].Instances[].PublicIpAddress --output text
done
You might want to adjust the region and to filter per AutoScaling group if you have several of them.
answered Oct 31, 2018 by Archana
• 5,560 points

Related Questions In AWS

0 votes
1 answer

How do I disable detailed monitoring for instances in an auto scaling group in a CloudFormation template?

The property you want is InstanceMonitoring, not ...READ MORE

answered Aug 31, 2018 in AWS by Archana
• 4,090 points
46 views
0 votes
1 answer

How to auto-scale MYSQL database in AWS EC2 instance?

You could always use the Amazon RDS ...READ MORE

answered Aug 24, 2018 in AWS by Archana
• 4,090 points
452 views
0 votes
1 answer

How to fetch a list of items (like a SQL IN clause)

You can use this as this worked ...READ MORE

answered Oct 26, 2018 in AWS by Priyaj
• 56,520 points
627 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer