THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
#!/usr/bin/env python import sys import os import boto import boto.ec2 region = boto.ec2.regioninfo.RegionInfo(name="ROOT",endpoint="localhost") apikey='JiKIBbp6GRe3-7Ma-KF_pJl69BAsv2smJEA3So4DLfG0JCa9u5VnGeS5qsSo6cHiArzu8pRwEr4DkGy6M5inTw' secretkey='x9iMD9XY0xsnLy_1EZQi6lOXAY5hH-O6S2z_VFVTWMO5_GAIdeSm93tNk09rb56cB1bAQKZ0vSOztBrusZRu6g' def main(): '''Establish connection to EC2 cloud''' conn =boto.connect_ec2(aws_access_key_id=apikey, aws_secret_access_key=secretkey, is_secure=False, region=region, port=7080, path="/awsapi", api_version="2010-11-15") '''Get list of images that I own''' images = conn.get_all_images() print images myimage = images[0] '''Pick an instance type''' vm_type='m1.small' reservation = myimage.run(instance_type=vm_type,security_groups=['default']) if __name__ == '__main__': main() |
...