info@beaconhill.com | 914-834-2820

S3cp

s3cp - Amazon S3 command line cp program

S3cp works like the Unix copy 'cp' program allowing you to copy files into or out of your Amazon S3 account from the command line.

Downloads

The following two links provide you with a compiled version of s3cp ready to use.

GitHub

If you would like the source code to review and the ability to build s3cp yourself visit the following GitHub repository.

https://github.com/bradlucas/s3cp

Requirements

You will need to have a working version of Java installed. Also, you will need a Amazon S3 account.

Basic Installation

Unpack the downloaded zip or tar.gz file and find the compiled version, s3cp-cmdline-VERSION.jar. VERSION will be the current version number. Enter the following command to see the s3cp help.

$ java -jar s3cp-cmdline.jar -h

Amazon Keys

Before you can interact with your S3 account you need to setup a file with your access and secret key.

Create a directory called .s3cp under your $HOME directory.

Inside the directory create a file called s3cp.properties

In the s3cp.properties file create the following entries:

s3.accessKey=YOUR-S3-ACCESSKEY-HERE
    s3.secretKey=YOUR-S3-SECRETEKEY-HERE

Usage

S3cp uses a URI syntax to reference the objects in your S3 account. For example, if you have a bucket called test-files with an object tmp/test.sh you'd be able to get it from S3 with the following command.

$ s3cp s3://test-files/tmp/test.sh test.sh

Copy to S3 [PUT]

    $ s3cp local-file s3://bucket/object[/]

If object has a trailing slash it will be assumed to mean a directory and the local-file's filename will be appended to object.

Copy from S3 [GET]

    $ s3cp s3://bucket/object [local-file]

If local-file is not present a filename from object will be used in the current directory.

Alias

There is a script called s3cp.sh in ~/secp/src/scripts that you setup with an alias.

Edit the following with the correct path and put in your .bashrc file

alias s3cp=$HOME/work/s3cp/src/scripts/s3cp.sh

With that, s3cp will run from the command line through the alias.

Amazon Simple Storage Service (Amazon S3)

Amazon Simple Storage Service (Amazon S3) is storage for the Internet provided by Amazon through their Amazon Web Services (AWS) cloud computing effort. Beacon Hill has used S3 for a number of projects and has found it to be a very useful and reliable storage mechanism.

Full details about S3 are available at http://aws.amazon.com/s3/

Amazon's Sample Code & Libraries has s3cp listed. See http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=188&externalID=3124

News


Feedback

If you try s3cp and have a suggestion please let me know.

brad@beaconhill.com

Notifications

We enhance and fix s3cp frequently. If you'd like to know when please enter your email address.