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>.outscale.com/<BUCKET>/<OBJECT_KEY>

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

Downloading an Object from a Bucket Using AWS CLI (s3api)

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring 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> \
    --range bytes=0-499 \
    --version-id 0CemUck92JnfPoaOG8vX1J2T1wMf1d. \
    --part-number NOT_SPECIFIED \
    --endpoint https://oos.eu-west-2.outscale.com

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) range: Allows to define and request a specific byte range of an object, allowing to download only a specific portion of the data.

  • (optional) version-id: The ID of a previous or 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. For more information, see Installing and Configuring AWS CLI.

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.

  • ContentRange: Indicates the byte range of the object defined in the request, and the total size of the object.

  • VersionID: The ID of a previous or current version of the object.

  • CacheControl: The cache control of the object.

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

  • ObjectLockMode: The Object Lock mode of the object.

  • ObjectLockRetainUntilDate: The date, in ISO 8601 format, when the object will no longer be locked.

Result Sample
 {
    "AcceptRanges": "bytes",
    "ContentType": "binary/octet-stream",
    "LastModified": "Mon, 01 Apr 2017 12:12:40 GMT",
    "ContentLength": 42,
    "ETag": "\"e163009009b626ebac1f9876546f8366\"",
    "ContentRange": "bytes 0-499/1106699",
    "VersionId": "7395H3JvbAV16lq1tBbxUbtaJ7K4PCP",
    "CacheControl": "public,max-age=3600, private",
    "Metadata": {},
    "ObjectLockMode": "COMPLIANCE",
    "ObjectLockRetainUntilDate": "2024-06-14T15:56:39.979000+00:00"
}

Downloading an Object from a Bucket Using AWS CLI (s3)

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

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

$ aws s3 cp s3://YOUR_BUCKET/YOUR_OBJECT PATH/TO/FILE \
    --profile YOUR_PROFILE \
    --debug \
    --dryrun \
    --expected-size 1234 \
    --endpoint https://oos.eu-west-2.outscale.com

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

  • s3://YOUR_BUCKET/YOUR_OBJECT: The name of the bucket and the name of the object in it.

  • PATH/TO/FILE: The path to the location where you want the object to be downloaded.

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

  • (optional) debug: When included, returns the detailed log of the operation. This is useful to analyze and troubleshoot issues you may be encountering.

  • (optional) dryrun: Provides an overview of the operations performed by the command without actually running it. This is used as a safety measure to review the impact of a command before executing it.

  • (optional) expected-size: If the object is larger than 50GB, specifies the expected size of the upload, in bytes. This is useful if you want to confirm the integrity or the expected size of the file being downloaded. For more information, see: Tutorial: Using Multipart Upload With AWS CLI (s3).

  • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

Downloading an Object from a Bucket Using s3cmd

You can 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.