You fetch objects from Amazon S3 using the GET operation. This operation returns objects directly from Amazon S3 using a client/server delivery mechanism.
To distribute large files to many people, you can save bandwidth costs by using BitTorrent. For more information, see Using BitTorrent with Amazon S3.
![]() | Note |
|---|---|
To use |
GET /destinationObjectHTTP/1.1 Host:destinationBucket.s3.amazonaws.com Date:dateAuthorization:signatureRange:bytes=byte_range
| Name | Description | Required |
|---|---|---|
Range
|
Downloads the specified range of an object. Type: String Default: None Constraints: None | No |
If-Modified-Since
|
Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified). Type: String Default: None Constraints: None | No |
If-Unmodified-Since
|
Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed). Type: String Default: None Constraints: None | No |
If-Match
|
Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed). Type: String Default: None Constraints: None | No |
If-None-Match
|
Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified). Type: String Default: None Constraints: None | No |
HTTP/1.1 200 OK x-amz-id-2: id x-amz-request-id: request_id Date: date Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "etag" Content-Length: length Content-Type: type Connection: close Server: AmazonS3 file_content
| Name | Description |
|---|---|
x-amz-meta-
|
If you supplied user metadata when you Type: String |
Content-Type
|
This is set to the same value you specified in the corresponding header when the data was Type: String |
Content-Disposition
|
This is set to the same value you specified in the corresponding header when the data was Type: String |
Content-Range
|
This indicates the range of bytes returned in the event that you requested a subset of the object by setting the Range request header. Type: String |
x-amz-missing-meta
|
This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers. Type: String |
Etag
|
Returns the Etag of the new object. Type: String |
There are no special errors for this operation. For information about general Amazon S3 errors, see List of Error Codes.
This example retrieves the "Nelson" object and its metadata from the "quotes" bucket.
GET /Nelson HTTP/1.1 Host: quotes.s3.amazonaws.com Date: Wed, 01 Mar 2006 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE=
HTTP/1.1 200 OK x-amz-id-2: j5ULAWpFbJQJpukUsZ4tfXVOjVZExLtEyNTvY5feC+hHIegsN5p578JLTVpkFrpL x-amz-request-id: BE39A20848A0D52B Date: Wed, 01 Mar 2006 12:00:00 GMT x-amz-meta-family: Muntz Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 5 Connection: close Server: AmazonS3 HA-HA
For some clients, you might want to break large downloads into smaller downloads. To break a download into smaller units, use Range. For example, the following request downloads the first ten megabytes from the bigfile object.
GET /bigfile HTTP/1.1 Host: bigbucket.s3.amazonaws.com Date: Wed, 01 Mar 2006 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE= Range:bytes=0-10485759
HTTP/1.1 206 Partial Content x-amz-id-2: j5ULAWpFbJQJpukUsZ4tfXVOjVZExLtEyNTvY5feC+hHIegsN5p578JLTVpkFrpL x-amz-request-id: BE39A20848A0D52B Date: Wed, 01 Mar 2006 12:00:00 GMT x-amz-meta-family: Muntz Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 10485760 Content-Range: 0-10485759/20232760 Connection: close Server: AmazonS3 <first 10 megabytes of bigfile>
Amazon S3 returns the first ten megabytes of the file, the Etag of the file, and the total size of the file (20232760 bytes) in the Content-Length field.
To ensure the file did not change since the previous portion was downloaded, specify the if-match request header. Although the if-match request header is not required, it is recommended for content that is likely to change.
![]() | Note |
|---|---|
If the you specify |
Following is a request that gets the remainder of the file, using the if-match request header.
GET /bigfile HTTP/1.1 Host: bigbucket.s3.amazonaws.com Date: Wed, 01 Mar 2006 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE= Range: 10485760-20232760 If-match:"828ef3fdfa96f00ad9f27c383fc9ac7f"
Amazon S3 returns the following response and the remainder of the file.
x-amz-id-2: j5ULAWpFbJQJpukUsZ4tfXVOjVZExLtEyNTvY5feC+hHIegsN5p578JLTVpkFrpL x-amz-request-id: BE39A20848A0D52B Date: Wed, 01 Mar 2006 12:00:00 GMT x-amz-meta-family: Muntz Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 9747000 Content-Range: 10485760-20232760/20232760 Connection: close Server: AmazonS3 <remainder of bigfile>
If an object GET fails, you can get the rest of the file by specifying the range to download.
The following is a standard GET for the bigfile object.
GET /bigfile HTTP/1.1 Host: bigbucket.s3.amazonaws.com Date: Wed, 01 Mar 2006 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE=
Amazon S3 returns the following response, but a client connection issue causes the GET to fail in the middle of the operation.
HTTP/1.1 200 OK x-amz-id-2: j5ULAWpFbJQJpukUsZ4tfXVOjVZExLtEyNTvY5feC+hHIegsN5p578JLTVpkFrpL x-amz-request-id: BE39A20848A0D52B Date: Wed, 01 Mar 2006 12:00:00 GMT x-amz-meta-family: Muntz Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 20232760 Connection: close Server: AmazonS3 <part of bigfile>
The client code determines the amount of data downloaded and gets the rest.
GET /bigfile HTTP/1.1 Host: bigbucket.s3.amazonaws.com Date: Wed, 01 Mar 2006 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE= Range:bytes=132499-20232760 If-match:"828ef3fdfa96f00ad9f27c383fc9ac7f"
Amazon S3 returns the following response and the remainder of the file.
HTTP/1.1 206 Partial Content x-amz-id-2: j5ULAWpFbJQJpukUsZ4tfXVOjVZExLtEyNTvY5feC+hHIegsN5p578JLTVpkFrpL x-amz-request-id: BE39A20848A0D52B Date: Wed, 01 Mar 2006 12:00:00 GMT x-amz-meta-family: Muntz Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 20100261 Content-Range: 132499-20232760/20232760 Connection: close Server: AmazonS3 <remainder of bigfile>