1. Installation
Wiki Markup |
---|
*\[A\] Boto Client{*} |
...
Use any of the following to install boto,
2. Configuration
...
Edit /etc/boto.cfg or ~/.boto to add,
Code Block | ||
---|---|---|
| ||
[Credentials]
aws_access_key_id= <cloudstack_api_key>
aws_secret_access_key= <cloudstack_secret_key> |
...
For
...
more
...
details
...
on
...
Boto
...
configuration refer [1
...
]
3. Connection
...
Make an EC2 service connection against CloudStack management server. Use
...
this connection to make any of the supported EC2 API
...
calls,
Sample python code that uses Boto client to make EC2 DescribeImages API call against CloudStack,
Code Block | ||
---|---|---|
| ||
import boto
import boto.ec2
region = boto.ec2.regioninfo.RegionInfo(name="AmazonEC2", endpoint="<cloudstack_management_server_ip>")
conn = boto.connect_ec2(aws_access_key_id="<cloudstack_api_key>", aws_secret_access_key="<cloudstack_secret_key>", is_secure=False, region=region, port=7080, path="/awsapi", api_version="2012-08-15")
|
...
# |
...
run |
...
an |
...
instance |
...
instance = conn. |
...
run_instances('<image-id>', min_count=1, max_count=1) # response of the command (contains list of instances, owner of the |
...
instances etc. ) vars(instance) |
...
# list |
...
attribute values of one of the |
...
instances |
...
launched vars( |
...
instance.instances[0]) |
...
# list details of the security group that the launched instances belong to
vars(instance.groups)
|
For a complete list of Boto EC2 commands see attached file - EC2_API_vs_Boto_commands.xlsx.
For details on each of the commands see [2].
Download source from [3]. For general guidelines on how to use the SDK, refer [4
Wiki Markup |
---|
For a complete list off Boto EC2 API calls refer \[2\] |
Wiki Markup |
---|
*\[B\] Java SDK{*} |
Download source from \[3\]. For general guidelines on how to use the SDK, refer \[4\]. Wiki Markup
Below is a sample Java code that uses the SDK to make EC2 DescribeImages API call against CloudStack,
...
Note: Before running the sample, place it in the samples _folder and fill in AwsCredentials.properties with _accessKey=<cloudStack_api_key> and secretkey=<cloudstack_secret_key>
One can use the AWS Toolkit for Eclipse to add the AWS SDK for Java to an existing project, or create a new Java project based on the SDK \[5\]. Wiki Markup
Wiki Markup |
---|
*\[C\] PHP SDK{*} |
for Eclipse to add the AWS SDK for Java to an existing project, or create a new Java project based on the SDK [5].
Download source from [6]. For general guidelines on how to use the SDK, refer [7 Download source from \[6\]. For general guidelines on how to use the SDK, refer \[7\]. Wiki Markup
Below is a sample PHP code that uses the SDK to make EC2 DescribeImages API call against CloudStack,
...
Note: Before running the sample in _samples folder, rename config-sample.inc.php to config.inc.php _and write into the file with ‘key’=><cloudStack_api_key> and ‘secret’=><cloudstack_secret_key>_
\[1\] [ http://docs.pythonboto.org/en/latest/boto_config_tut.html|http://docs.pythonboto.org/en/latest/boto_config_tut.html] Wiki Markup
[2] \[2\] [http://docs.pythonboto.org/en/latest/ref/ec2.html#module-boto.ec2.connection|http://docs.pythonboto.org/en/latest/ref/ec2.html#module-boto.ec2.connection]unmigrated-wiki-markup Wiki Markup
\[3\] [http://aws.amazon.com/sdkforjava/|] http://aws.amazon.com/sdkforjava/] Wiki Markup
\[4\] [http://aws.amazon.com/articles/3586?_encoding=UTF8&jiveRedirect=1|] http://aws.amazon.com/articles/3586?_encoding=UTF8&jiveRedirect=1]unmigrated-wiki-markup\
[5\] [http://aws.amazon.com/eclipse/|] http://aws.amazon.com/eclipse/] \ Wiki Markup
[6\] [http://aws.amazon.com/sdkforphp/|] http://aws.amazon.com/sdkforphp/]unmigrated-wiki-markup
\[7\] [http://aws.amazon.com/articles/4261?_encoding=UTF8&jiveRedirect=1|] http://aws.amazon.com/articles/4261?_encoding=UTF8&jiveRedirect=1]