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 21 in DevOps & Agile by bala
• 130 points
44 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 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
• 17,060 points
64 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 16, 2018 in DevOps & Agile by Damon Salvatore
• 5,510 points
116 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,160 points
882 views
+5 votes
3 answers

Steps to Call Python method in BuildBot

To run python code, you must write ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by ajs3033
• 7,280 points

edited Oct 12, 2018 by Kalgi 337 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,510 points
66 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,380 points
114 views