Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Access the UI at http://localhost:8080/client
  • Under Global Settings, set enable.ec2.api to true
  • Under Accounts, generate keys for the admin user in the admin account
  • Under service offerings, rename tinyOffering as m1.small
  • In your Virtual Box settings, forward port 7080
  • cd awsapi-setup/setup and use the python script cloudstack-aws-api-register to register the user.
  • you can specify an empty file as cert but use the keys generated in the GUI
  • if the registration works you should see the credentials in the cloudbridge database in the usercredentials table
  • Use a python script similar as below (change the keys) to launch an instance:
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()

...