Downloading an Object from a Bucket

You can download an object from one of your buckets or an object that another user shared with you. For more information, see Access Control List (ACL) Reference.

We recommend not exceeding 200 downloads per second from a single bucket.

You can download the current version or any previous version of an object. For more information, see Listing the Versions of an Object.

You can download an object:

  • Through any Software Development Kit (SDK), for example AWS CLI. The object you download is stored where you executed the command, for example in your root directory.

  • From a URL address, following one of these two formats:

    • https://oos.<REGION><BUCKET>/<OBJECT_KEY>

    • https://<BUCKET>.oos.<REGION><OBJECT_KEY>

Downloading an Object from a Bucket Using AWS CLI

To download an object from a bucket, use the get-object command following this syntax:

Request sample
$ aws s3api get-object \
    --profile YOUR_PROFILE \
    --bucket BUCKET \
    --key OBJECT \
    outfile=<~/home/Name_Of_The_Downloaded_Object> \
    --version-id 0CemUck92JnfPoaOG8vX1J2T1wMf1d. \
    [--part-number NOT_SPECIFIED] \

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • bucket: The name of the bucket.

  • key: The name of the object in the bucket.

  • outfile: The name for the object once downloaded on your machine. This name can be a path.

    Type the name for the object directly, without the outfile attribute name before it.

  • (optional) version-id: The ID of a previous or the current version of the object.

  • (optional) part-number: The part number of an object in a multipart upload. This number must be an integer between 1 and 1000. For more information, see Creating a Multipart Upload.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The get-object command returns the following elements:

  • AcceptRanges: The type of accepted ranges of the object.

  • ContentType: The type of content of the object.

  • LastModified: The date and time the object was last uploaded or copied in the bucket.

  • ContentLength: The size of the object, in bytes.

  • ETag: The ETag of the object.

  • CacheControl: The cache control of the object.

  • Metadata: The metadata of the object, if any.

Result Sample
    "AcceptRanges": "bytes",
    "ContentType": "binary/octet-stream",
    "LastModified": "Mon, 01 Apr 2017 12:12:40 GMT",
    "ContentLength": 42,
    "ETag": "\"e163009009b626ebac1f9876546f8366\"",
    "CacheControl": "public,max-age=3600, private",
    "Metadata": {}
  • You can also perform this action using an s3 command following this syntax:

    $ aws s3 cp --profile YOUR_PROFILE s3://YOUR_BUCKET/YOUR_OBJECT PATH/TO/FILE --endpoint
  • You can also manage your object storage resources using s3cmd commands. For more information, see s3cmd.

Related Pages

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.