The Amazon S3 Authentication Tool for Curl, s3curl.pl is used to interface with Amazon S3, allowing you to upload to and download from the service.

s3curl.pl requires Perl 5.6.0 or later, curl, and the following Perl modules:

  • Digest::HMAC_SHA1
  • FindBin
  • MIME::Base64
  • Getopt::Long

This tool does not require environment variables to be set, but it does use the file ~/.s3curl if you do not pass the credentials on the command line. It is recommended to use ~/.s3curl as passing the credentials on the command line is not safe. To set up the ~/.s3curl file, see: HowTo: Install AWS CLI - Security Credentials.

Install Script

If you’re running Linux, this script will do everything this article covers: install_s3curl.sh from our aws_scripts collection. Be sure to run it as root or use sudo.

Git Repository

Checkout the repository. This only needs to be done once throughout this series of articles.

Console - user@hostname ~ $

1
git clone https://bitbucket.org/dowdandassociates/aws_scripts.git

Run install script

Console - user@hostname ~ $

1
sudo aws_scripts/install_aws_cli/install_s3curl.sh

Direct Download of Script

Console - user@hostname ~ $

1
curl -L https://bitbucket.org/dowdandassociates/aws_scripts/raw/master/install_aws_cli/install_s3curl.sh | sudo bash

Install Process

Create the directory in which to download the software, if the folder does not already exist.

Console - root@hostname ~ #

1
mkdir -p /tmp/aws

Create the directories in which the software will be installed, if the folders do not already exist.

Console - root@hostname ~ #

1
2
mkdir -p /usr/local/share
mkdir -p /usr/local/bin

Download the software

Console - root@hostname ~ #

1
2
3
curl --silent \
--output /tmp/aws/s3-curl.zip \
http://s3.amazonaws.com/doc/s3-example-code/s3-curl.zip

Unzip the software.

Console - root@hostname ~ #

1
unzip -d /tmp/aws /tmp/aws/s3-curl.zip

Change s3curl.pl to be able to execute.

Console - root@hostname ~ #

1
chmod 755 /tmp/aws/s3-curl/s3curl.pl

Delete any previously installed versions.

Console - root@hostname ~ #

1
rm -fR /usr/local/share/s3-curl

Move the software to the install directories.

Console - root@hostname ~ #

1
2
mv /tmp/aws/s3-curl /usr/local/share
mv /usr/local/share/s3-curl/s3curl.pl /usr/local/bin

Delete the .zip file.

Console - root@hostname ~ #

1
rm -fR /tmp/aws/s3-curl*

s3curl.pl should now be available to you. If not, make sure /usr/local/bin is in your PATH.

References

Parts in this series