Wednesday, May 6, 2015

Install/configure boto, java, and, EC2 tools for AWS


·        Pre-requisite: Install python and boto (see http://theitjourney.blogspot.com/2015/05/install-python-27-on-centos-6x-install.html )


·        Create .boto file with content:

[Credentials]
aws_access_key_id
= YOURACCESSKEY
aws_secret_access_key
= YOURSECRETKEY

 

·        Validate boto settings:

>>> import boto
>>> s3 = boto.connect_s3()

o   Shouldn't throw any error

·        Install java on CentOS

·        yum install java-1.8.0-openjdk-devel.x86_64 (as privileged user/root or as sudo))

·        Validate (as regular user)

o   java –version

[tom@localhost ~]$ java -version

openjdk version "1.8.0_45"

OpenJDK Runtime Environment (build 1.8.0_45-b13)

OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)

o   javac –version

[tom@localhost ~]$ javac -version

javac 1.8.0_45


·        Download ec2 tools (wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip)

·        Unpackage and place it in nice directory (as a privileged user)

·        Install open jdk (as privileged user)

export JRE_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64

export EC2_HOME=/usr/local/ec2/ec2-api-tools-1.7.3.2/

export EC2_URL=https://ec2.us-west-1.amazonaws.com  

export PATH=$PATH:$EC2_HOME/bin

export AWS_ACCESS_KEY= YOURACCESSKEY

export AWS_SECRET_KEY= YOURSECRETKEY

·        Update .bashrc (for regular user with the above exports)

o Source .bashrc

·        Validate the settings and configuration (as regular user)

o ec2-describe-regions (auto fill in “tab” should work)

 [tom@localhost ~]$ ec2-describe-regions

REGION    eu-central-1        ec2.eu-central-1.amazonaws.com

REGION    sa-east-1             ec2.sa-east-1.amazonaws.com

REGION    ap-northeast-1   ec2.ap-northeast-1.amazonaws.com

REGION    eu-west-1            ec2.eu-west-1.amazonaws.com

REGION    us-east-1             ec2.us-east-1.amazonaws.com

REGION    us-west-1            ec2.us-west-1.amazonaws.com

REGION    us-west-2            ec2.us-west-2.amazonaws.com

REGION    ap-southeast-2  ec2.ap-southeast-2.amazonaws.com

REGION    ap-southeast-1  ec2.ap-southeast-1.amazonaws.com

1 comment: