CloudStack EC2 configuration Sebastien Goasguen August 14th
Introduction • CloudStack provides an EC2 compatible interface • In Apache CloudStack 4.0 (soon out), Cloudbridge is now an integral part of the management server and not a separate server. • SOAP and Query interface are supported. SOAP may be dropped soon. • Query interface under heavy development/testing
Steps to use EC2/S3 in CloudStack • Enable the service via global configuration settings • Generate API keys for the user(s) • Register the user and associate a certificate (for SOAP). • Provide compute offering that matches the name of Amazon instance types (e.g m1.small…) • Setup environment variables (e.g $EC2_URL)
Enabling EC2 and S3 • Via the GUI • Via API call on integration API port 8096 http://localhost:8096/client/api? command=updateConfiguration&name=enable.s3.api&value=true http://localhost:8096/client/api? command=updateConfiguration&name=enable.ec2.api&value=true
Enabling EC2 and S3 • Via an authenticated API call on port 8080 (e.g using a Python client) apiurl = 'http://localhost:8080/client/api’ cloudstack = CloudStack.Client(apiurl,apikey,secretkey) cloudstack.updateConfiguration ({‘name’:’enable.ec2.api’,’value’:’true’})
Generate Keys • Via the GUI
Generate Keys • Via the API: http://localhost:8096/client/api? command=registerUserKeys&id=<id of the user>
Register the user • Get the script from the source at /path/to/source/awsapi- setup/setup/cloudstack-aws-api- register cloud-bridge-register --apikey=<User’s Cloudstack API key> --secretkey=<User’s CloudStack Secret key> --cert=</path/to/cert.pem> --url=http://<cloudstack-server- ip>:8080/awsapi
Provide “Amazon” instance types • You can rename using the API, but the easiest is to go via the GUI
Setup shell environment • export EC2_PRIVATE_KEY=</path/to/userkey.pem> • export EC2_CERT=</path/to/cert.pem> • export EC2_URL=http://<cloudstack-server->:8080/awsapi • export AWS_ACCESS_KEY_ID=J8HFx6wHYl_qTvMcSA3fe3ZugR- gcy3ldZ21wPezwbj9Cy1-bnlhdsBAS0JcYrZ8vw3ra-gsu4-Ke_uH1rKTKQ • export AWS_SECRET_KEY_ID=NzS9akD_8TzYWJsv- x6QXIg6M4pzWlhp6EFMbY34Ue0D9WA64yZ7qmHhbkut5o6GpG8CNZ8LRtNgiL_M Whij3w • Get the ec2 commands binaries for api version 2010-11-15 • You are now ready to use the ec2-* commands
EC2 Boto example 1/2 • Specify the region: region = boto.ec2.regioninfo.RegionInfo (name="ROOT",endpoint=”<cloudstack-server-ip>") • Establish a connection: conn =boto.connect_ec2(aws_access_key_id=apikey, aws_secret_access_key=secretkey, is_secure=False, region=region, port=8080, path="/awsapi", api_version="2010-11-15") Note the API version, expect to see support for a newer API soon. Contributions welcome 
EC2 Boto example 2/2 • Find your image and start it: images = conn.get_all_images() myimage = images[0] '''Pick an instance type present in your compute offering''’ vm_type='m1.small' reservation = myimage.run (instance_type=vm_type,security_groups=['default'] )
• Join the discussion on the future of the EC2/S3 compatibility of CloudStack cloudstack-dev@incubator.apache.org #cloudstack on irc.freenode.net @CloudStack on Twitter

CloudStack EC2 Configuration

  • 1.
    CloudStack EC2 configuration Sebastien Goasguen August 14th
  • 2.
    Introduction • CloudStack providesan EC2 compatible interface • In Apache CloudStack 4.0 (soon out), Cloudbridge is now an integral part of the management server and not a separate server. • SOAP and Query interface are supported. SOAP may be dropped soon. • Query interface under heavy development/testing
  • 3.
    Steps to useEC2/S3 in CloudStack • Enable the service via global configuration settings • Generate API keys for the user(s) • Register the user and associate a certificate (for SOAP). • Provide compute offering that matches the name of Amazon instance types (e.g m1.small…) • Setup environment variables (e.g $EC2_URL)
  • 4.
    Enabling EC2 andS3 • Via the GUI • Via API call on integration API port 8096 http://localhost:8096/client/api? command=updateConfiguration&name=enable.s3.api&value=true http://localhost:8096/client/api? command=updateConfiguration&name=enable.ec2.api&value=true
  • 5.
    Enabling EC2 andS3 • Via an authenticated API call on port 8080 (e.g using a Python client) apiurl = 'http://localhost:8080/client/api’ cloudstack = CloudStack.Client(apiurl,apikey,secretkey) cloudstack.updateConfiguration ({‘name’:’enable.ec2.api’,’value’:’true’})
  • 6.
  • 7.
    Generate Keys • Viathe API: http://localhost:8096/client/api? command=registerUserKeys&id=<id of the user>
  • 8.
    Register the user •Get the script from the source at /path/to/source/awsapi- setup/setup/cloudstack-aws-api- register cloud-bridge-register --apikey=<User’s Cloudstack API key> --secretkey=<User’s CloudStack Secret key> --cert=</path/to/cert.pem> --url=http://<cloudstack-server- ip>:8080/awsapi
  • 9.
    Provide “Amazon” instancetypes • You can rename using the API, but the easiest is to go via the GUI
  • 10.
    Setup shell environment • export EC2_PRIVATE_KEY=</path/to/userkey.pem> • export EC2_CERT=</path/to/cert.pem> • export EC2_URL=http://<cloudstack-server->:8080/awsapi • export AWS_ACCESS_KEY_ID=J8HFx6wHYl_qTvMcSA3fe3ZugR- gcy3ldZ21wPezwbj9Cy1-bnlhdsBAS0JcYrZ8vw3ra-gsu4-Ke_uH1rKTKQ • export AWS_SECRET_KEY_ID=NzS9akD_8TzYWJsv- x6QXIg6M4pzWlhp6EFMbY34Ue0D9WA64yZ7qmHhbkut5o6GpG8CNZ8LRtNgiL_M Whij3w • Get the ec2 commands binaries for api version 2010-11-15 • You are now ready to use the ec2-* commands
  • 11.
    EC2 Boto example1/2 • Specify the region: region = boto.ec2.regioninfo.RegionInfo (name="ROOT",endpoint=”<cloudstack-server-ip>") • Establish a connection: conn =boto.connect_ec2(aws_access_key_id=apikey, aws_secret_access_key=secretkey, is_secure=False, region=region, port=8080, path="/awsapi", api_version="2010-11-15") Note the API version, expect to see support for a newer API soon. Contributions welcome 
  • 12.
    EC2 Boto example2/2 • Find your image and start it: images = conn.get_all_images() myimage = images[0] '''Pick an instance type present in your compute offering''’ vm_type='m1.small' reservation = myimage.run (instance_type=vm_type,security_groups=['default'] )
  • 13.
    • Join thediscussion on the future of the EC2/S3 compatibility of CloudStack cloudstack-dev@incubator.apache.org #cloudstack on irc.freenode.net @CloudStack on Twitter