You need to know how to use the Amazon EC2 API tools with RightScale servers or instances.
There are a few install/configuration methods depending on your requrements.
The RightScale/EC2 API Toolbox ServerTemplate provides a server configured with both Amazon AMI Tools and API Tools.
Configuration is automated on boot via RightScripts and Inputs.
Simply import the ServerTemplate, set inputs (as needed), add server and launch.
Optionally, you can clone the template or use the scripts with your own templates.
To make best use of the EC2 API (command-line) tools and ensure you have the latest versions of all files, you should download the latest toolset from Amazon.
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip unzip ec2-api-tools.zip export EC2_CERT=/pathtocert/cert-xxxxx.pem export EC2_PRIVATE_KEY=/pathtokeyfile/pk-xxxx.prem export EC2_HOME=/locationofextractedtools/ export JAVA_HOME=/usr/java/default (this should already be exported)
Once the environment variables are set and correct, the tools should work as designed.
The following is a RightScript that performs the setup for you automatically. You will want to create a new RightScript and attach it to your server, then cut and paste the following code into the new script. It includes all the required certificates as inputs, and these are exported to the instance. It creates a file called "ec2inst," which can be used to set the environment variables for your shell. Everything is installed in /root. After running the script, you can SSH into the instance and type:
source ./ec2inst ec2-describe-instances i-d203aca5 --region eu-west-1
You can then run any EC2 API command from the command line. (Running ec2ver is a good test to determine whether everything is installed.)
#!/bin/bash # installs ec2inst script that allows running ec2commands from the shell echo "$AWS_X509_CERT" > /root/cert.pem echo "$AWS_X509_KEY" > /root/key.pem echo 'export AWS_ACCESS_KEY_ID='$AWS_ACCESS_KEY_ID > /root/ec2inst echo 'export AWS_SECRET_ACCESS_KEY='$AWS_SECRET_ACCESS_KEY >> /root/ec2inst echo 'export AWS_ACCOUNT_NUMBER='$AWS_ACCOUNT_NUMBER >> /root/ec2inst echo 'export EC2_CERT=/root/cert.pem' >> /root/ec2inst echo 'export EC2_PRIVATE_KEY=/root/key.pem' >> /root/ec2inst echo 'export EC2_HOME=/root/ec2' >> /root/ec2inst echo 'export JAVA_HOME=/usr/java/default' >> /root/ec2inst chmod 700 /root/ec2inst cd /root wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip unzip ec2-api-tools.zip chmod +x ec2-api-tools-1.3-46266/bin/* ln -s ec2-api-tools-1.3-46266 ec2
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.