Can Someone Provide me a Python Script to list all Stopped EC2 Instances with specific Tag in an AWS Account

+1 vote
Can Someone Provide me a Python Script to list all Stopped EC2 Instances with specific Tag in an AWS Account
Nov 22, 2019 in DevOps & Agile by bala
• 130 points
1,215 views

1 answer to this question.

0 votes

Hi @Bala, Hope you are good! Try the following python code:

import boto3
 ec2 = boto3.resource('ec2')
  
 for instance in ec2.instances.all():
     print(
         "Id: {0}\nPlatform: {1}\nType: {2}\nPublic IPv4: {3}\nAMI: {4}\nState: {5}\n".format(
         instance.id, instance.platform, instance.instance_type, instance.public_ip_address, instance.image.id, instance.state
         )
     )
answered Nov 22, 2019 by Siddhant

Related Questions In DevOps & Agile

+1 vote
3 answers

How can I connect an app with an aws ec2 instance?

This is how you deploy a web ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by Hannah
• 18,570 points
1,888 views
0 votes
1 answer

How to give a name to an image in Dockerfile ?

This needs to be done in your ...READ MORE

answered Nov 17, 2018 in DevOps & Agile by Damon Salvatore
• 5,980 points
1,257 views
+1 vote
2 answers

is it possible to assign a Feature/User Story/Task to a team [Group] in VSTS

In most cases, we would break Work ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
5,081 views
0 votes
1 answer
+1 vote
1 answer

How to add a node as a manager in swarm cluster?

Here is what you can try and ...READ MORE

answered Dec 10, 2018 in DevOps & Agile by Damon Salvatore
• 5,980 points
509 views
+5 votes
3 answers

Error while trying to install postgis extension with greenplum

Try re downloading the package and installing ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
942 views
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