An example of how to setup the right_aws Ruby gem to connect to Amazon Web Services (S3).

Install the right_aws and right_http_connection gems

[hgilmour@hgilmour-mac:~]$ alias | ack sgi 
sgi='sudo gem install'
[hgilmour@hgilmour-mac:~]$ sgi right_aws right_http_connection
[hgilmour@hgilmour-mac:~]$ gem list --local | ack right 
right_aws (2.0.0, 1.10.0)
right_http_connection (1.2.4)

Amazon Access Key ID and the Amazon Secret Access Key

Make sure that you have configured the Amazon Access Key ID and the Amazon Secret Access Key. These are configured when you setup the command line tools or want to use an ssh connection to S3 or a running EC2 instance.

Add them to a local config file. For example:

[hgilmour@hgilmour-mac:~]$ mkdir ~/.aws
[hgilmour@hgilmour-mac:~]$ chmod 700 ~/.aws
[hgilmour@hgilmour-mac:~]$ vi ~/.aws/aws_config.yml
access_key_id: $TU_VALOR
secret_access_key: $TU_VALOR
[hgilmour@hgilmour-mac:~]$ chmod 600 ~/.aws/aws_config.yml

EC2_URL Environmental variable

Make sure that the environmental variable EC2_URL ends with a /

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

Check your EC2 Environment

[hgilmour@hgilmour-mac:~]$ env | ack EC2
EC2_URL=https://eu-west-1.ec2.amazonaws.com

Run a thor / rake task to test connectivity

An example thor gist

Useful Links

A handy GUI for S3 admin.

Filed under: tools, infrastructure

comments

There are no comments.