aws (command line tool)Edit

aws is a simplified command line interface to Amazon Web Services.

Official website

Installation

To install to the bin directory in your home directory:

$ curl timkay.com/aws/aws -o ~/bin/aws
$ chmod +x ~/bin/aws

MIME types

If you have an appropriate /etc/mime.types file the aws tool will automatically set the correct Content-Type for you based on the file extension. I have a very brief MIME types file that covers the basic file types that I expect to be distributing using Amazon S3:

application/octet-stream  bin dmg img iso pkg
application/ogg ogg
application/pdf pdf
application/x-bzip2 bz2
application/x-gzip  gz tgz
application/x-tar tar
application/zip zip
audio/mpeg  mp3
image/gif gif
image/jpeg  jpeg
image/png png
text/plain  txt
video/mpeg  mpeg mpg
video/quicktime mov

Uploading

The main bucket I use for public distribution via HTTP is was something like s3.example.com. (See "HTTPS access to Amazon S3 buckets" for info on distribution via HTTPS.)

"Objects" uploaded into the bucket (really files) are identified by textual keys. Keys can have path-like names to give the appearance of hierarchical organization, but in reality buckets are just shallow/flat collections. This means that the following "paths" all refer to objects in the "top" (and only) level in the bucket:

  • synergy/releases/synergy-4.3.zip
  • wikitext/releases/wikitext-2.0.gem.bz2
  • publications/novel.pdf

As an example, to upload synergy-4.4.zip into the appropriate bucket:

$ aws put s3.example.com/synergy/releases/synergy-4.4.zip /local/path/to/Synergy4.4.zip
$ aws put s3.example.com/synergy/releases/synergy-4.4.zip?acl --public

The second line is necessary to override the default ACL (which only allows the owner access to the object but nobody else).

See also