Amazon Web Services Tips
No Title[an error occurred while processing this directive]
Reference: Cisco: Internetworking Basics
This short guide presents an example of the steps on how to install the Amazon API Tools and the Amazon AMI Tools on the Linux (CentOS 6) platform.
The Amazon API Tools and the Amazon AMI Tools are packages of command-line scripts to the AWS web service used to manage and bundle instances. Although there are many other Developer Tools provided by Amazon and the AWS development community to help developers create and manage applications built on AWS, these two are the most commonly used to manage EC2 instances.
The API tools serve as the client interface to the Amazon EC2 web service. Use these tools to register and launch instances, manipulate security groups, and more.
The Amazon EC2 AMI Tools are command-line utilities to help bundle an Amazon Machine Image (AMI), create an AMI from an existing machine or installed volume, and upload a bundled AMI to Amazon S3.
Use the following steps to install the Amazon API Tools and the Amazon AMI Tools on the Linux platform.
Shell Login Script
Add the following environment variables to your shell login script (i.e. /root/.bashrc). Make any necessary changes for your specific environment by replacing AWS_ACCOUNT_NUMBER, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY with your AWS account number and security credentials. Make certain to remove the < and > characters when providing your values.
[EC2_BASE] Base directory for all Amazon EC2 related components (i.e. tools and certificates). On Linux, I commonly use /opt/ec2.
[EC2_HOME] Installation directory for the Amazon API Tools and the Amazon AMI Tools. This directory should be created as a sub-directory in EC2_BASE. This environment variable will be used by all of the command-line tools in both packages.
[EC2_PRIVATE_KEY] and [EC2_CERT] EC2 private certificate key file and EC2 certificate file. I typically rename the X.509 certificate files as follows: private key file (ec2-pk.pem) and certificate file (ec2-cert.pem). Navigate to the Security Credentials page to create a new X.509 certificate or to download a current EC2 certificate file.
[EC2_URL] Specifies a Region endpoint for your environment. Amazon uses this environment variable (or the --url command-line flag) to choose a default Region when running any of the command-line tools. The default Region for the endpoint used in the example shell login script above is us-east-1 and is the one I use based on my geographic location near the east coast.
[AWS_ACCOUNT_NUMBER] AWS account number (sometimes called the account id) which shows up when you go to the Account Activity area of the AWS web site. The account number is a 12 digit number that appears in the top-right of the Account Activity page and is in the form 9999-9999-9999. When you use the account number in the context of the APIs, you should leave out the hyphens and just enter the 12 digits.
[AWS_ACCESS_KEY_ID] and [AWS_SECRET_ACCESS_KEY] The AWS Access Key and Secret Key serve the purpose of ID and Password to access Amazon S3 and your AWS (root) account. Navigate to Security Credentials and expand the Access Keys (Access Key ID and Secret Access Key) section to create a new Access Key ID and Secret Access Key pair or to view any current Access Key ID(s).
The EC2 API Tools and Amazon EC2 AMI Tools are Java based. If you don't already have a version of Java installed, do so now.
The JAVA_HOME environment variable should be set to the appropriate home directory in your shell login script (i.e. /root/.bashrc) which was handled in the previous step. Verify the JAVA_HOME environment variable is set for the current shell and confirm that Java is installed correctly.
Install the Amazon EC2 Tools
Download the Amazon EC2 API Tools.
Download the Amazon EC2 AMI Tools to the EC2 image.
EC2 Private Certificate Key File and EC2 Certificate File
Copy your X.509 Certificate (private key file and certificate file) to appropriate directory. For the purpose of this example, I will be renaming my private key file from pk-2L7LZYRTNEAC4KGZMPPZWAOZ4KYCTCA4.pem to ec2-pk.pem and my certificate file from cert-2L7LZYRTNEAC4KGZMPPZWAOZ4KYCTCA4.pem to ec2-cert.pem.
Verify Amazon EC2 Tools
Verify that the Amazon EC2 Tools have been installed correctly.
Test the ec2-describe-regions script which is found in the EC2 API Tools to list the regions you have access to.
Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.
Copyright (c) 1998-2019 Jeffrey M. Hunter. All rights reserved.
All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at firstname.lastname@example.org.
I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.
Last modified on
Friday, 11-Apr-2014 18:51:03 EDT
Page Count: 38105