Installing S3CMD on Amazon Server


S3CMD is the command line tool for Amazon that allows you to connect and use S3 storage in the Amazon infrastructure.

The guide as always has some expectation of experience in Linux but where possible does give the commands that are required.

mkdir -p /opt/software
cd /opt/software
wget http://sourceforge.net/projects/s3tools/files/s3cmd/1.0.1/s3cmd-1.0.1.tar.gz
tar xzf s3cmd-1.0.1.tar.gz
yum install -y python-devel
cp -R s3cmd-1.0.1 /opt/s3cmd
cd /opt/s3cmd
python setup.py install

This should install the tool, you know need to configure the software. You will need you AWS access ID and secret key.

s3cmd --configure

Enter the details required. You will then be prompted with some questions

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:  Enter
Path to GPG program [/usr/bin/gpg]: Enter

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can’t be used if you’re behind a proxy
Use HTTPS protocol [No]: Enter

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can’t connect to S3 directly
HTTP Proxy server name: Enter

I am usually pretty security conscious and therefore you have to decide on whether you should answer yes to some of the questions, it is all dependent on what you are storing on S3.

How to use the software can be found on the web site of the tool. http://s3tools.org/s3cmd

Some brief commands and examples

s3cmd ls – Lists the buckets

s3cmd ls s3://bucketname/ – will list what is in the bucket note the trailing /

s3cmd put localfilename s3://bucketname/ – will put the file into the bucket

s3cmd put localfilename s3://bucketname/foldername/ –

will put the file into the bucket into a folder name. This will create the folder in the s3 bucket if it does not exist

s3cmd get  s3://bucketname/filename local path – will get the file and place it in the local path specified

s3cmd sync  s3://bucketname/foldername/ localfoldername/ – syncs the s3 bucket folder to the local folder works much like rsync

s3cmd sync  localfoldername/ s3://bucketname/foldername/  – syncs the local folder name to the s3 bucket folder.

s3cmd mb s3://new-bucket-name/ – creates a new bucket

Advertisements

4 Comments on “Installing S3CMD on Amazon Server”

  1. […] to test mount a bucket you either need to know the bucket name or use s3cmd to list the bucket names etc… see installing and using s3cmd […]

  2. […] You will need s3cmd installed to use this, handily s3cmd installation instructions […]

  3. […] To test that you have access to the buckets etc.. install s3cmd, instructions Installing S3CMD on Amazon Server […]

  4. John Julian says:

    This is great stuff. But one thing you need to do if you’re going to follow these directions: the wget line form sourceforge needs to fetch the latest version. Otherwise certain features won’t work.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s