Skip to Content
Hybrid Cloud for Developers
book

Hybrid Cloud for Developers

by Manoj Hirway
April 2018
Intermediate to advanced content levelIntermediate to advanced
280 pages
8h 37m
English
Packt Publishing
Content preview from Hybrid Cloud for Developers

Checking the state of your EC2 instance

After you launch an EC2 instance, it might be necessary to check the state of the instance to determine whether the instance is ready for use. The state of the instance can be easily determined by checking the State property of the Instance class object.

You can simply use the RunInstancesResponse object that you created for invoking the RunInstances() function, and get a list of instances by using the Reservation.Instances property. The list can then be iterated and checked for the State property to determine the state of the instance.

The following code snippet shows how this is done. You add this code in the preceding program inside the try block:

var instances = response.Reservation.Instances;
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hybrid Cloud for Architects

Hybrid Cloud for Architects

Alok Shrivastwa
OpenStack: Building a Cloud Environment

OpenStack: Building a Cloud Environment

Alok Shrivastwa, Sunil Sarat, Kevin Jackson, Cody Bunch, Egle Sigler, Tony Campbell

Publisher Resources

ISBN: 9781788830874Supplemental Content