Wikipedia

Search results

19 August 2015

Configuring EC2 CLI on OSX

Make sure you have Java installed on your box.

Download and install EC2:

$ wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
$ sudo mkdir /usr/local/ec2
$ sudo unzip ec2-api-tools.zip -d /usr/local/ec2


Drill in to your ec2 directory to see version number

$ /usr/local/ec2/ec2-api-tools-1.7.5.0

Here, it's 1.7.5.0;

Go to https://console.aws.amazon.com/iam/home
There you will find or create your AWS credentials in the section "Security Credentials".
You will also have to assign permissions in the section "Permissions".

In your .bash_profile, add the following:

export JAVA_HOME=$(/usr/libexec/java_home)
export EC2_HOME=/usr/local/ec2/ec2-api-tools-1.7.5.0
export PATH=$PATH:$EC2_HOME/bin
export AWS_ACCESS_KEY=[KEY]
export AWS_SECRET_KEY=[SECRET]


You can test your EC2 configuration in a new Terminal window

$ ec2-describe-regions


This should generate an output of values similar to the following:

REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com
REGION ap-southeast-2 ec2.ap-southeast-2.amazonaws.com
REGION eu-central-1 ec2.eu-central-1.amazonaws.com
REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION sa-east-1 ec2.sa-east-1.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
REGION us-west-2 ec2.us-west-2.amazonaws.com

No comments:

Post a Comment