April 2018
Intermediate to advanced
280 pages
8h 37m
English
Once your EC2 instance is launched, the state of the instance can be determined by invoking the instances.all() function of checking the state property of the returned objects.
The following Python program will list all the instances in your region by displaying their instance identified, state, and name:
import boto3ec2 = boto3.resource('ec2')for instance in ec2.instances.all(): print instance.id, instance.state;