-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathec2.py
More file actions
31 lines (22 loc) · 752 Bytes
/
Copy pathec2.py
File metadata and controls
31 lines (22 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# Copyright (c) 2015 Nandini Taneja nandini.taneja@gmail.com
# All rights reserved.
import boto.ec2
# connect to Amazon EC2
# AWS access and secret keys are in /etc/boto.cfg
regions = boto.ec2.regions()
myregion = regions[0]
conn = myregion.connect()
# List all avaialble instances
reservations = conn.get_all_instances()
length = len(reservations)
# Total instances
print "Total: " , length , "reservations\n"
#print "Instance Names @Amazon AWS and Contents\n"
for reservation in reservations:
instance = reservation.instances
print "Instance Id", instance
for instance_details in instance:
print "Instance Type", instance_details.instance_type
print "Instance Placement", instance_details.placement
print "\n"