# AWS CLI: S3

PREREQUISITES

# Transport to S3

To transport files use either the mv command to move (transport and delete locally) or cp command to copy (transport only).

# Examples

Move and delete a single local file to a remote bucket directory:

aws s3 mv /local/path/filename.ext s3://bucket-name/remote/path/

Copy a local file to a remote directory:

aws s3 cp /local/path/filename.ext s3://bucket-name/remote/path/

Move all files in a local directory to a remote directory:

aws s3 mv /local/path/ s3://bucket-name/remote/path/ --recursive

TIP

Check out the official documentation for more examples.

# Common Options

  • storage-class: The type of storage to use for the object. Valid choices are: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | ONEZONE_IA | INTELLIGENT_TIERING | GLACIER | DEEP_ARCHIVE. Defaults to STANDARD

Most transports should be STANDARD. For long-term, inexpensive object storage use GLACIER.

Move all files in a local directory to a remote directory and store in GLACIER:

aws s3 mv /local/path/ s3://bucket-name/remote/path/ --recursive --storage-class GLACIER