Tutorial: Installing and Configuring the AWS CLI
Wednesday January 02, 2013 , 2 min Read
One of the biggest complaints from developers using AWS is the fragmentation of the command line tools. Each service uses its own set of tools written in a separate language. For example, EC2 command line tools are written in Java while Beanstalk tools are developed using Ruby and SES command line tools are based on Python. This makes it extremely difficult to configure and manage multiple AWS services from the command line.
Keeping this in mind, AWS has now developed a new set of command line tools called AWS CLI that consolidates various tools related to AWS. Its a unified set of tools that support popular services including EC2, RDS, Beanstalk, SQS, SNS, SES, CloudWatch and CloudFormation. This eliminates the need to install and configure separate tools for each service.
Here is a step-by-step guide to install and configure AWS CLI.
Step 1 - Download and install the AWS CLI
[crayon lang="shell"]
mkdir /opt/aws
cd /opt/aws
curl http://python-distribute.org/distribute_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
pip install awscli
[/crayon]
Step 2 - Create a file called aws_credentials.txt and add the Access Key, Secret Key and the default Region
[crayon lang="text"]
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region = ap-southeeast-1
[/crayon]
Step 3 - Configure the AWS_CONFIG_FILE environment variable
[crayon lang="shell"]
export AWS_CONFIG_FILE="/opt/aws/aws_credentials.txt"
[/crayon]
Step 4 - Test the configuration by typing the following command
[crayon lang="shell"]
aws ec2 describe-regions
[/crayon]
Below is a screencast of this tutorial
- Janakiram MSV, Chief Editor, CloudStory.in