get-object

Prev Next

Available in Classic and VPC

Download an object stored in Object Storage.

Syntax

The get-object syntax is as follows:

aws s3api get-object \
    --bucket <bucket> \
    --key <key> \
    [--version-id <version-id>] \
    [--range <range>] \
    [--part-number <part-number>] \
    [--sse-customer-algorithm <sse-customer-algorithm>] \
    [--sse-customer-key <sse-customer-key>] \
    [--sse-customer-key-md5 <sse-customer-key-md5>] \
    --endpoint-url <endpoint-url> \
    <outfile>

Options

This section describes the options available when running get-object.

Required options

The following options are required for get-object.

Options Type Required Description
--bucket String Required Bucket name
--key String Required Object name
<outfile> String Required Name of the downloaded file will be saved as

Optional options

These are the optional options for get-object. Options that are not specified will use their default values.

Options Type Required Description
--version-id String Optional Object version ID
  • When downloading a specific version of an object from a bucket with versioning enabled
--range String Optional Byte range to download
--part-number String Optional Part number to download
  • When downloading only parts of an object
--sse-customer-algorithm String Optional User encryption algorithm (AES256)
--sse-customer-key String Optional User-provided encryption key
--sse-customer-key-md5 String Optional User-provided encryption key's MD5 value

Common options

For information about the options common to all aws subcommands, see Object Storage options.

Examples

If the request to download an object is successful, the object is saved to the specified path, and the object's metadata is returned.

Command

The command example is as follows:

aws s3api get-object --bucket my-test-bucket \
    --key img/image.png \
    --endpoint-url=https://kr.object.ncloudstorage.com \
    image.png

The following is an example command for downloading only a specific range of bytes from an object.

aws s3api get-object --bucket my-test-bucket \
    --key img/image.png \
    --range bytes=0-31 \
    --endpoint-url=https://kr.object.ncloudstorage.com \
    partial.png

The following is an example command for downloading only a specific part of a multipart object.

aws s3api get-object --bucket my-test-bucket \
    --key large.bin \
    --part-number 1 \
    --endpoint-url=https://kr.object.ncloudstorage.com \
    part1.bin

Output

The output example is as follows:

{
    "AcceptRanges": "bytes",
    "LastModified": "Wed, 02 Sep 2026 06:39:50 GMT",
    "ContentLength": 70,
    "ETag": "\"2cd8bde463f5d82aae0f0cec061d6b8f\"",
    "ContentType": "image/png",
    "Metadata": {},
    "StorageClass": "Standard"
}

The following is an example output from downloading a specified byte range. The requested range and the total size are returned via ContentRange.

{
    "AcceptRanges": "bytes",
    "LastModified": "Wed, 02 Sep 2026 06:39:50 GMT",
    "ContentLength": 32,
    "ETag": "\"2cd8bde463f5d82aae0f0cec061d6b8f\"",
    "ContentRange": "bytes 0-31/70",
    "ContentType": "image/png",
    "Metadata": {},
    "StorageClass": "Standard"
}

The following is an example output for downloading only specific parts. The total number of parts in the object is returned as PartsCount.

{
    "AcceptRanges": "bytes",
    "LastModified": "Wed, 02 Sep 2026 06:39:06 GMT",
    "ContentLength": 5242880,
    "ETag": "\"cad5bfe2c36bcb9a8f19d6122296cc1c-1\"",
    "ContentRange": "bytes 0-5242879/5242880",
    "ContentType": "application/octet-stream",
    "Metadata": {},
    "StorageClass": "Standard",
    "PartsCount": 1
}