s3dl

This weekend I got curious. How lightweight could an Amazon S3 download script be?

There are plenty of AWS and S3 command line tools and libraries for everyone’s favorite scripting languages, but as I’m currently working in the IoT space, I wondered what the smallest number of dependencies was that I could get away with and still authenticate a private file download.

Here is what I came up with:

s3dl

As you can see, looking at the code, it’s a really simple Bash script. The main dependencies are curl and openssl. As it turns out, the signature is a very simple HMAC-SHA1, so openssl can easily do it on the command line.

More than a little bit of inspiration came from this article about uploading to S3 in Bash. Clever stuff!

A vague source of mild frustration (as usual) was making a script that works on Linux and Mac OS X. As usual, since the date program is crippled on OS X, cross-platform relative date calculations are a bit… tetchy.

Anyway, s3dl is released under cc0 / Public Domain, so you may feel free to do with it what you will. Enjoy!

Advertisements

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