Beispiel #1
0
# IMPORT classes from aws package
from aws import Connection
from aws import EC2Instance
from aws import Volumes

# INSATANTIATE Connection
connInst = Connection()

# CREATE an EC2 Connection
reg = connInst.list_regions()
print reg
for regionaws in reg:
    #rgname = reg
    #print rgname
    # return rgname
    conn = connInst.ec2Connection(regionaws)

    # PRINT connection
    print conn

# Instantiate EC2Instance for operations
# ec2 = EC2Instance()

# InsID = ec2.list_instances(conn)
# print InsID
# for Ins in InsID:
#   Ins.start()
#  print (Ins, "is starting now")
#	ec2 = EC2Instance()
# call start_instance with the Id of an instance
# ec2.start_instance(conn, Ins)
Beispiel #2
0
#!/usr/bin/Python

#Import classes from aws package
from aws import Connection
from aws import EC2Instance
from aws import Volumes
from aws import Security

connInst = Connection()
conn = connInst.ec2Connection()

'''
Uncomment code as required. Replace instance_id with actual values
'''
#Manage EC2 Instances
'''
instance = EC2Instance()
instance.list_instances(conn)
instance.start_instance(conn, instance_id)
instance.stop_instance(conn, instance_id)
'''

'''
Uncomment code as required. Replace instance_id and volume_id with actual values
'''
#Manage EBS Volumes
'''
volumeInst = Volumes()
volumeInst.list_volumes(conn)
volumeInst.detach_volume(conn,volume_id)
volumeInst.attach_volume(conn, volume_id, instance_id)