Is There A Way To List Stopped Ec2 Instances Using Boto3?
I have already tried using describe_instance_status method like in below. But it does not return any of the stopped EC2 instances. Apparently, it does not identify any stopped inst
Solution 1:
Use describe_instances
instead
response_one = ec2.describe_instances(Filters=[
{
'Name': 'instance-state-name',
'Values': [
'stopped',
'running'
]
},
])
print(response_one)
and if you have a large number of instances, use the paginator
Post a Comment for "Is There A Way To List Stopped Ec2 Instances Using Boto3?"