You fetch objects from S3 using the GET
operation. This operation returns the object directly from S3 using a client/server delivery mechanism. If you want to distribute big files to a large number of people, you may find BitTorrent delivery to be preferable since it uses less bandwidth. Please see the section on Using BitTorrent with S3 for details.
Example
Retrieve the "Nelson" object and its metadata from the "quotes" bucket:
Sample Request
GET /quotes/Nelson HTTP/1.0 Authorization: AWS 15B4D3461F177624206A:nV/j6LGf9AcWQ2jId1qOGgekHPQ= Date: Thu, 17 Nov 2005 08:22:38 GMT
Sample Response
HTTP/1.1 200 OK x-amz-id-2: j5ULAWpFbJQJpukUsZ4tfXVOjVZExLtEyNTvY5feC+hHIegsN5p578JLTVpkFrpL x-amz-request-id: BE39A20848A0D52B Date: Thu, 17 Nov 2005 08:22:38 GMT x-amz-meta-family: Muntz Last-Modified: Thu, 17 Nov 2005 08:22:38 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 5 Connection: close Server: AmazonS3 HA-HA
The GET
request method on objects supports several standard HTTP request headers. These are briefly described below, for details see the HTTP spec, RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
If-Modified-Since: Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).
If-Unmodified-Since: Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).
If-Match: Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).
If-None-Match: Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).
Range: Return only the bytes of the object in the specified range.
x-amz-meta-: If you supplied user metadata when you PUT the object, that metadata is returned in one or more response headers prefixed with x-amz-meta- and with the suffix name that you provided on storage. This metadata is simply returned verbatim; it is not interpreted by S3.
Content-Type: This is set to the same value you specified in the corresponding header when the data was PUT. The default content type is binary/octet-stream.
Content-Disposition: This is set to the same value you specified in the corresponding header when the data was PUT. Except in the case of a request for a BitTorrent torrent file (see section on using BitTorrent with S3), if no Content-Disposition was specified at the time of PUT then this header is not returned.
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.
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.
The GET will succeed if you have been granted READ access to the object. If you make a request without an authorization header, then you can read the object if READ access has been granted to the anonymous user.