Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The S3 command-line tool is the most reliable way of interacting with Amazon Web Services' Simple Storage Service (AWS S3). This article will guide you through setting it up and using it for common tasks.

Installing the tool

  1. Open a terminal. On Mac OSX, the Terminal application can be found in Applications/Utilities.
  2. Run the following commands:

    Code Block
    curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
    unzip awscli-bundle.zip
    ./awscli-bundle/install -b ~/bin/aws
  3. To verify that the tool is properly installed, run the following command

    Code Block
    aws help

Configuring the tool

  1. Follow the instructions in the AWS documentation under Quick Configuration. This will require you to input the access key ID and secret access key provided to you by DevOps.

Using the tool

List a directory:

Code Block
titleCommand
aws s3 ls s3://bucket-name/path/to/file

...

Tip
titleTip: Add the --human-readable flag to the end of your command to get more human-readable sizes
Code Block
titleCommand
aws s3 ls s3://bucket-name/path/to/file --human-readable
Code Block
titleResponse
						PRE dir1/
						PRE dir2/
2015-01-01 10:10:10 1.2 KiB File1.zip
2015-01-02 11:11:11 7.3 MiB File2.pdf

Download a file:

Code Block
aws s3 cp s3://bucket-name/path/to/file ~/Downloads

The file will be saved to your Downloads folder.

Upload a file:

Code Block
aws s3 cp ~/Downloads/file1.zip s3://bucket-name/path/to/destination --acl public-read

...

Note
titleNote

If you don't include –acl public-read, no one will be able to see your file!

Remove a file:

Code Block
aws s3 rm s3://bucket-name/path/to/file

...

Info

For more documentation, run aws s3 help

Filter by label (Content by label)
showLabelsfalse
max5
spacesEdxOps
showSpacefalse
sortmodified
reversetrue
typepage
labelss3

...