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,090 points
4,485 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,640 points

Related Questions In AWS

0 votes
0 answers
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,170 points

edited Jun 16, 2023 by Khan Sarfaraz 1,230 views
0 votes
1 answer

How to get the contents of a folder in an AWS CodeCommit repository?

Hi@akhtar, The following get-folder example demonstrates how to get the ...READ MORE

answered Nov 25, 2020 in AWS by MD
• 95,460 points

edited Aug 4, 2023 by Khan Sarfaraz 2,750 views
0 votes
1 answer

How to attach a load balancer to an Auto Scaling group in AWS?

Hi@akhtar, You can attach one or more Classic Load ...READ MORE

answered Nov 26, 2020 in AWS by MD
• 95,460 points
893 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP