The document outlines the steps to configure an EC2-compatible interface in Apache CloudStack 4.0, which now includes CloudBridge as part of the management server. It details the setup process, including enabling EC2 and S3 services, generating API keys, and providing compute offerings that match Amazon instance types. Additionally, it provides examples of using the Boto library for EC2 commands and invites contributions to the ongoing development of CloudStack's EC2/S3 compatibility.
CloudStack EC2 configuration presented by Sebastien Goasguen on August 14th.
CloudStack offers EC2-compatible interface. Version 4.0 integrates Cloudbridge into the management server. SOAP is supported but may be deprecated soon.
Steps to enable EC2/S3 involve service configuration, API key generation, user registration, and setting environment variables.
EC2/S3 can be enabled via the GUI or API calls. Specific commands are provided for configuration updates.
Users can generate keys both via GUI and API calls. The API provides a specific command for user key registration.
User registration involves running a script with necessary API keys, certificate path, and server details for access.
Instance types can be matched to Amazon types using API or GUI for streamlined compatibility.
Instructions for setting environment variables needed for EC2 commands and API access.
An example of using Boto to connect to EC2, specifying the region and credentials. Mention of future API updates.
Continuation of Boto example, focusing on image retrieval and starting an EC2 instance of specified type.
Invitation to participate in discussions about the future of EC2/S3 compatibility via various communication channels.
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’})
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
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