Setting up the AWS EC2 CLI tools with required dependencies.

To setup the EC2 CLI tools we need the following.

1) JDK/JRE installed
2) The EC2 keys
3) The EC2-API-Tools

Before we install the tools we need to install at least JRE on the instance.

#1) Download JDK or JRE from shell

wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F” “http://download.oracle.com/otn-pub/java/jdk/7u4-b20/jdk-7u4-linux-x64.tar.gz”

#2) Download EC2 CLI Tools.

wget –quiet http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
sudo apt-get install unzip
sudo unzip ec2-api-tools.zip

#3) Create a directory to house the JDK and EC2 credentials
    sudo mkdir /usr/local/java
    sudo mkdir credentials

    sudo cp jdk-7u4-linux-x64.tar.gz /usr/local/java
    cd /usr/local/java
    sudo tar xvzf jdk-7u4-linux-x64.tar.gz

#4) SFTP the keys to directory ‘credentials’

#5) Set the Env Variables
    echo ‘ export JAVA_HOME=”/usr/local/java/jdk1.7.0_04/jre/”‘ >>/home/ubuntu/.profile
    echo ‘ export EC2_HOME=”/home/ubuntu/ec2-api-tools-1.6.11.0/”‘ >>/home/ubuntu/.profile
    echo ‘ export EC2_CERT=”/home/ubuntu/credentials/{your key.crt}”‘ >>/home/ubuntu/.profile
    echo ‘ export EC2_PRIVATE_KEY=”/home/ubuntu/credentials/{your key.pem}”‘ >>/home/ubuntu/.profile

#6) Changes in bash file made to come to effect.
       cd
       . .profile

For Amazon Web Services (AWS) Course http://www.infraright.com