s3 Api
s3 Api
s3 Api
API Reference
API Version 2006-03-01
Amazon Simple Storage Service API Reference
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not
Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or
discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may
or may not be affiliated with, connected to, or sponsored by Amazon.
Amazon Simple Storage Service API Reference
Table of Contents
Amazon S3 REST API Introduction ....................................................................................................... 1
Common Request Headers .................................................................................................................. 2
Common Response Headers ................................................................................................................ 4
Error Responses ................................................................................................................................. 6
REST Error Responses ................................................................................................................. 6
List of Error Codes ..................................................................................................................... 7
Authenticating Requests (AWS Signature Version 4) .............................................................................. 14
Authentication Methods ............................................................................................................ 15
Introduction to Signing Requests ............................................................................................... 15
Using an Authorization Header .................................................................................................. 16
Overview ......................................................................................................................... 16
Signature Calculation: Transfer Payload in a Single Chunk ..................................................... 18
Signature Calculation: Transfer Payload in Multiple Chunks .................................................... 29
Using Query Parameters ........................................................................................................... 36
Calculating a Signature ..................................................................................................... 38
An Example ..................................................................................................................... 40
Examples: Signature Calculations ................................................................................................ 41
Signature Calculation Examples Using Java .......................................................................... 41
Signature Calculation Examples Using C# ............................................................................ 42
Authenticating HTTP POST Requests .......................................................................................... 43
Calculating a Signature ..................................................................................................... 44
Amazon S3 Signature Version 4 Authentication Specific Policy Keys ................................................ 45
Bucket Policy Examples Using Signature Version 4 Related Condition Keys ............................... 47
Browser-Based Uploads Using POST ................................................................................................... 49
Browser-Based Uploads Using HTTP POST ................................................................................... 49
Calculating a Signature ............................................................................................................. 50
Creating HTML Forms ............................................................................................................... 51
HTML Form Declaration .................................................................................................... 52
HTML Form Fields ............................................................................................................ 52
Creating a POST Policy ............................................................................................................. 56
Expiration ........................................................................................................................ 56
Condition Matching .......................................................................................................... 56
Conditions ....................................................................................................................... 57
Character Escaping ........................................................................................................... 59
POST Upload Example .............................................................................................................. 61
Uploading a File to Amazon S3 Using HTTP POST ................................................................ 61
Using POST with Adobe Flash .................................................................................................... 63
Using POST with Adobe Flash ............................................................................................ 63
Browser-Based Uploads Using AWS Amplify ................................................................................ 63
Using the AWS Amplify JavaScript library to Upload Files to Amazon S3 .................................. 64
More Info ........................................................................................................................ 64
Operations on the Service ................................................................................................................. 65
GET Service ............................................................................................................................. 65
Description ...................................................................................................................... 65
Requests ......................................................................................................................... 65
Responses ....................................................................................................................... 65
Examples ......................................................................................................................... 67
Related Resources ............................................................................................................ 67
Operations on AWS Accounts ............................................................................................................. 68
Block Public Access ................................................................................................................... 68
DELETE PublicAccessBlock ................................................................................................. 68
GET PublicAccessBlock ...................................................................................................... 69
PUT PublicAccessBlock ...................................................................................................... 72
Batch Operations ..................................................................................................................... 75
CreateJob ........................................................................................................................ 77
DescribeJob ..................................................................................................................... 81
ListJobs ........................................................................................................................... 84
UpdateJobStatus .............................................................................................................. 87
UpdateJobPriority ............................................................................................................. 90
Batch Operations Common Elements .................................................................................. 92
Operations on Buckets .................................................................................................................... 102
DELETE Bucket ....................................................................................................................... 104
Description .................................................................................................................... 104
Requests ........................................................................................................................ 104
Responses ...................................................................................................................... 104
Examples ....................................................................................................................... 104
Related Resources ........................................................................................................... 105
DELETE Bucket analytics .......................................................................................................... 106
Description .................................................................................................................... 106
Requests ........................................................................................................................ 106
Responses ...................................................................................................................... 107
Examples ....................................................................................................................... 107
Related Resources ........................................................................................................... 107
DELETE Bucket cors ................................................................................................................ 108
Description .................................................................................................................... 108
Requests ........................................................................................................................ 108
Responses ...................................................................................................................... 108
Examples ....................................................................................................................... 108
Related Resources ........................................................................................................... 109
DELETE Bucket encryption ....................................................................................................... 110
Description .................................................................................................................... 110
Requests ........................................................................................................................ 110
Responses ...................................................................................................................... 110
Examples ....................................................................................................................... 110
Related Resources ........................................................................................................... 111
DELETE Bucket inventory ......................................................................................................... 112
Description .................................................................................................................... 112
Requests ........................................................................................................................ 112
Responses ...................................................................................................................... 113
Examples ....................................................................................................................... 113
Related Resources ........................................................................................................... 113
DELETE Bucket lifecycle ........................................................................................................... 114
Description .................................................................................................................... 114
Requests ........................................................................................................................ 114
Responses ...................................................................................................................... 114
Examples ....................................................................................................................... 115
Related Resources ........................................................................................................... 115
DELETE PublicAccessBlock ....................................................................................................... 115
Description .................................................................................................................... 115
Requests ........................................................................................................................ 115
Responses ...................................................................................................................... 116
Related Resources ........................................................................................................... 116
DELETE Bucket metrics ............................................................................................................ 116
Description .................................................................................................................... 116
Requests ........................................................................................................................ 117
DELETE Bucket policy .............................................................................................................. 119
Description .................................................................................................................... 119
Requests ........................................................................................................................ 119
Responses ...................................................................................................................... 119
Examples ....................................................................................................................... 120
Related Resources ........................................................................................................... 120
Read the following about authentication and access control before going to specific API topics.
Making REST API calls directly from your code can be cumbersome. It requires you to write the necessary
code to calculate a valid signature to authenticate your requests. We recommend the following
alternatives instead:
• Use the AWS SDKs to send your requests (see Sample Code and Libraries). With this option, you
don't need to write code to calculate a signature for request authentication because the SDK clients
authenticate your requests by using access keys that you provide. Unless you have a good reason not
to, you should always use the AWS SDKs.
• Use the AWS CLI to make Amazon S3 API calls. For information about setting up the AWS CLI and
example Amazon S3 commands see the following topics:
Set Up the AWS CLI in the Amazon Simple Storage Service Developer Guide.
Using Amazon S3 with the AWS Command Line Interface in the AWS Command Line Interface User
Guide.
You can have valid credentials to authenticate your requests, but unless you have permissions you cannot
create or access Amazon S3 resources. For example, you must have permissions to create an S3 bucket
or get an object from your bucket. If you use root credentials of your AWS account, you have all the
permissions. However, using root credentials is not recommended. Instead, we recommend that you
create IAM users in your account and manage user permissions. For more information, see Managing
Access Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service Developer Guide.
Content-Type The content type of the resource in case the request content in
the body. Example: text/plain
Content-MD5 The base64 encoded 128-bit MD5 digest of the message (without
the headers) according to RFC 1864. This header can be used as a
message integrity check to verify that the data is the same data
that was originally sent. Although it is optional, we recommend
using the Content-MD5 mechanism as an end-to-end integrity
check. For more information about REST request authentication,
go to REST Authentication in the Amazon Simple Storage Service
Developer Guide.
Date The current date and time according to the requester. Example:
Wed, 01 Mar 2006 12:00:00 GMT. When you specify the
Authorization header, you must specify either the x-amz-
date or the Date header.
Expect When your application uses 100-continue, it does not send the
request body until it receives an acknowledgment. If the message
is rejected based on the headers, the body of the message is not
sent. This header can be used only if you are sending a body.
This header is required for HTTP 1.1 (most toolkits add this header
automatically); optional for HTTP/1.0 requests.
x-amz-date The current date and time according to the requester. Example:
Wed, 01 Mar 2006 12:00:00 GMT. When you specify the
Authorization header, you must specify either the x-amz-
date or the Date header. If you specify both, the value specified
for the x-amz-date header takes precedence.
This header is required for requests that use Amazon DevPay and
requests that are signed using temporary security credentials.
Name Description
Type: String
Default: None
Content-Type The MIME type of the content. For example, Content-Type: text/html;
charset=utf-8
Type: String
Default: None
Type: Enum
Default: None
Date The date and time Amazon S3 responded, for example, Wed, 01 Mar 2006
12:00:00 GMT.
Type: String
Default: None
ETag The entity tag is a hash of the object. The ETag reflects changes only to the
contents of an object, not its metadata. The ETag may or may not be an MD5
digest of the object data. Whether or not it is depends on how the object was
created and how it is encrypted as described below:
Type: String
Type: String
Default: AmazonS3
Name Description
x-amz-delete- Specifies whether the object returned was (true) or was not (false) a delete
marker marker.
Type: Boolean
Default: false
x-amz-id-2 A special token that is used together with the x-amz-request-id header to
help AWS troubleshoot problems. For information about AWS support using
these request IDs, see Troubleshooting Amazon S3.
Type: String
Default: None
x-amz-request- A value created by Amazon S3 that uniquely identifies the request. This value
id is used together with the x-amz-id-2 header to help AWS troubleshoot
problems. For information about AWS support using these request IDs, see
Troubleshooting Amazon S3.
Type: String
Default: None
x-amz-version- The version of the object. When you enable versioning, Amazon S3 generates
id a random number for objects added to a bucket. The value is UTF-8 encoded
and URL ready. When you PUT an object in a bucket where versioning has been
suspended, the version ID is always null.
Type: String
Default: null
Error Responses
This section provides reference information about Amazon S3 errors.
Note
SOAP support over HTTP is deprecated, but it is still available over HTTPS. New Amazon S3
features will not be supported for SOAP. We recommend that you use either the REST API or the
AWS SDKs.
Topics
• REST Error Responses (p. 6)
• List of Error Codes (p. 7)
• Content-Type: application/xml
• An appropriate 3xx, 4xx, or 5xx HTTP status code
The body or the response also contains information about the error. The following sample error response
shows the structure of response elements common to all REST error responses.
Name Description
Code The error code is a string that uniquely identifies an error condition. It is meant to
be read and understood by programs that detect and handle errors by type. For
more information, see List of Error Codes (p. 7).
Type: String
Ancestor: Error
Type: Container
Ancestor: None
Message The error message contains a generic description of the error condition in English. It
is intended for a human audience. Simple programs display the message directly to
the end user if they encounter an error condition they don't know how or don't care
Name Description
to handle. Sophisticated programs with more exhaustive error handling and proper
internationalization are more likely to ignore the error message.
Type: String
Ancestor: Error
Type: String
Ancestor: Error
Type: String
Ancestor: Error
Many error responses contain additional structured data meant to be read and understood by a
developer diagnosing programming errors. For example, if you send a Content-MD5 header with a REST
PUT request that doesn't match the digest calculated on the server, you receive a BadDigest error. The
error response also includes as detail elements the digest we calculated, and the digest you told us to
expect. During development, you can use this information to diagnose the error. In production, a well-
behaved program might include this information in its error log.
IncompleteBody You did not provide the number of 400 Bad Client
bytes specified by the Content-Length Request
HTTP header
InvalidPartOrder The list of parts was not in ascending 400 Bad Client
order. Parts list must be specified in Request
order by part number.
InvalidPolicyDocument The content of the form does not 400 Bad Client
meet the conditions specified in the Request
policy document.
InvalidStorageClass The storage class you specified is not 400 Bad Client
valid. Request
InvalidTargetBucketForLogging The target bucket for logging does 400 Bad Client
not exist, is not owned by you, or does Request
not have the appropriate grants for
the log-delivery group.
MalformedACLError The XML you provided was not well- 400 Bad Client
formed or did not validate against our Request
published schema.
MalformedPOSTRequest The body of your POST request is not 400 Bad Client
well-formed multipart/form-data. Request
MalformedXML This happens when the user sends 400 Bad Client
malformed XML (XML that doesn't Request
conform to the published XSD) for the
configuration. The error message is,
"The XML you provided was not well-
formed or did not validate against our
published schema."
MissingRequestBodyError This happens when the user sends an 400 Bad Client
empty XML document as a request. Request
The error message is, "Request body is
empty."
NoSuchBucket The specified bucket does not exist. 404 Not Client
Found
NoSuchBucketPolicy The specified bucket does not have a 404 Not Client
bucket policy. Found
NoSuchKey The specified key does not exist. 404 Not Client
Found
UnresolvableGrantByEmailAddress The email address you provided does 400 Bad Client
not match any account on record. Request
UserKeyMustBeSpecified The bucket POST must contain the 400 Bad Client
specified field name. If it is specified, Request
check the order of the fields.
Every interaction with Amazon S3 is either authenticated or anonymous. This section explains request
authentication with the AWS Signature Version 4 algorithm.
Note
If you use the AWS SDKs (see Sample Code and Libraries) to send your requests, you don't
need to read this section because the SDK clients authenticate your requests by using access
keys that you provide. Unless you have a good reason not to, you should always use the AWS
SDKs. In regions that support both signature versions, you can request AWS SDKs to use
specific signature version. For more information, see Specifying Signature Version in Request
Authentication in the Amazon Simple Storage Service Developer Guide. You need to read this
section only if you are implementing the AWS Signature Version 4 algorithm in your custom
client.
Authentication with AWS Signature version 4 provides some or all of the following, depending on how
you choose to sign your request:
• Verification of the identity of the requester – Authenticated requests require a signature that you
create by using your access keys (access key ID, secret access key). For information about getting access
keys, see Understanding and Getting Your Security Credentials in the AWS General Reference. If you are
using temporary security credentials, the signature calculations also require a security token. For more
information, see Requesting Temporary Security Credentials in the IAM User Guide.
• In-transit data protection – In order to prevent tampering with a request while it is in transit, you use
some of the request elements to calculate the request signature. Upon receiving the request, Amazon
S3 calculates the signature by using the same request elements. If any request component received by
Amazon S3 does not match the component that was used to calculate the signature, Amazon S3 will
reject the request.
• Protect against reuse of the signed portions of the request – The signed portions (using AWS
Signatures) of requests are valid within 15 minutes of the timestamp in the request. An unauthorized
party who has access to a signed request can modify the unsigned portions of the request without
affecting the request's validity in the 15 minute window. Because of this, we recommend that you
maximize protection by signing request headers and body, making HTTPS requests to Amazon S3,
and by using the s3:x-amz-content-sha256 condition key (see Amazon S3 Signature Version
4 Authentication Specific Policy Keys (p. 45)) in AWS policies to require users to sign S3 request
bodies.
Note
Amazon S3 supports Signature Version 4, a protocol for authenticating inbound API requests to
AWS services, in all AWS regions. At this time, AWS regions created before January 30, 2014 will
continue to support the previous protocol, Signature Version 2. Any new regions after January
30, 2014 will support only Signature Version 4 and therefore all requests to those regions must
be made with Signature Version 4. For more information about AWS Signature Version 2, see
Signing and Authenticating REST Requests in the Amazon Simple Storage Service Developer
Guide.
Authentication Methods
You can express authentication information by using one of the following methods:
• HTTP Authorization header – Using the HTTP Authorization header is the most common
method of authenticating an Amazon S3 request. All of the Amazon S3 REST operations (except for
browser-based uploads using POST requests) require this header. For more information about the
Authorization header value, and how to calculate signature and related options, see Authenticating
Requests: Using the Authorization Header (AWS Signature Version 4) (p. 16).
• Query string parameters – You can use a query string to express a request entirely in a URL. In
this case, you use query parameters to provide request information, including the authentication
information. Because the request signature is part of the URL, this type of URL is often referred to as
a presigned URL. You can use presigned URLs to embed clickable links, which can be valid for up to
seven days, in HTML. For more information, see Authenticating Requests: Using Query Parameters
(AWS Signature Version 4) (p. 36).
Amazon S3 also supports browser-based uploads that use an HTTP POST requests. With an HTTP
POST request, you can upload content to Amazon S3 directly from the browser. For information about
authenticating POST requests, see Browser-Based Uploads Using POST in the Amazon Simple Storage
Service Developer Guide.
In AWS Signature Version 4, you don't use your secret access key to sign the request. Instead, you first
use your secret access key to create a signing key. The signing key is scoped to a specific region and
service, and it never expires.
The string to sign depends on the request type. For example, when you use the HTTP Authorization
header or the query parameters for authentication, you use a varying combination of request elements
to create the string to sign. For an HTTP POST request, the POST policy in the request is the string you
sign. For more information about computing string to sign, follow links provided at the end of this
section.
For signing key, the diagram shows series of calculations, where result of each step you feed into the
next step.The final step is the signing key.
Upon receiving an authenticated request, Amazon S3 servers re-create the signature by using the
authentication information that is contained in the request. If the signatures match, Amazon S3
processes your request; otherwise, the request is rejected.
For more information about authenticating requests, see the following topics:
• Authenticating Requests: Using the Authorization Header (AWS Signature Version 4) (p. 16)
• Authenticating Requests: Using Query Parameters (AWS Signature Version 4) (p. 36)
• Authenticating Requests in Browser-Based Uploads Using POST (AWS Signature Version 4) (p. 49)
Overview
Using the HTTP Authorization header is the most common method of providing authentication
information. Except for POST requests (p. 407) and requests that are signed by using query parameters,
all Amazon S3 bucket operations (p. 102) and object operations (p. 354) use the Authorization
request header to provide authentication information.
The following is an example of the Authorization header value. Line breaks are added to this example
for readability:
Authorization: AWS4-HMAC-SHA256
Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request,
SignedHeaders=host;range;x-amz-date,
Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024
The following table describes the various components of the Authorization header value in the
preceding example:
Component Description
AWS4-HMAC-SHA256 The algorithm that was used to calculate the signature. You must
provide this value when you use AWS Signature Version 4 for
authentication.
Component Description
Credential Your access key ID and the scope information, which includes the
date, region, and service that were used to calculate the signature.
<your-access-key-id>/<date>/<aws-region>/<aws-service>/
aws4_request
Where:
host;range;x-amz-date
fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024
The signature calculations vary depending on the method you choose to transfer the request payload. S3
supports the following options:
• Transfer payload in a single chunk – In this case, you have the following signature calculation options:
• Signed payload option – You can optionally compute the entire payload checksum and include it in
signature calculation. This provides added security but you need to read your payload twice or buffer
it in memory.
For example, in order to upload a file, you need to read the file first to compute a payload hash for
signature calculation and again for transmission when you create the request. For smaller payloads,
this approach might be preferable. However, for large files, reading the file twice can be inefficient,
so you might want to upload data in chunks instead.
For step-by-step instructions to calculate signature and construct the Authorization header value, see
Signature Calculations for the Authorization Header: Transferring Payload in a Single Chunk (AWS
Signature Version 4) (p. 18).
• Transfer payload in multiple chunks (chunked upload) – In this case you transfer payload in chunks.
You can transfer a payload in chunks regardless of the payload size.
You can break up your payload into chunks. These can be fixed or variable-size chunks. By uploading
data in chunks, you avoid reading the entire payload to calculate the signature. Instead, for the first
chunk, you calculate a seed signature that uses only the request headers. The second chunk contains
the signature for the first chunk, and each subsequent chunk contains the signature for the chunk
that precedes it. At the end of the upload, you send a final chunk with 0 bytes of data that contains
the signature of the last chunk of the payload. For more information, see Signature Calculations for
the Authorization Header: Transferring Payload in Multiple Chunks (Chunked Upload) (AWS Signature
Version 4) (p. 29).
When you send a request, you must tell Amazon S3 which of the preceding options you have chosen in
your signature calculation, by adding the x-amz-content-sha256 header with one of the following
values:
• If you choose chunked upload options, set the header value to STREAMING-AWS4-HMAC-SHA256-
PAYLOAD.
• If you choose to upload payload in a single chunk, set the header value to the payload checksum
(signed payload option), or set the value to the literal string UNSIGNED-PAYLOAD (unsigned payload
option).
Upon receiving the request, Amazon S3 re-creates the string to sign using information in the
Authorization header and the date header. It then verifies with authentication service the signatures
match. The request date can be specified by using either the HTTP Date or the x-amz-date header. If
both headers are present, x-amz-date takes precedence.
If the signatures match, Amazon S3 processes your request; otherwise, your request will fail.
Signature Calculations for the Authorization Header: Transferring Payload in a Single Chunk (AWS
Signature Version 4) (p. 18)
Signature Calculations for the Authorization Header: Transferring Payload in Multiple Chunks (Chunked
Upload) (AWS Signature Version 4) (p. 29)
• Signed payload option – You include the payload hash when constructing the canonical
request (that then becomes part of StringToSign, as explained in the signature calculation
section). You also specify the same value as the x-amz-content-sha256 header value when
sending the request to S3.
• Unsigned payload option – You include the literal string UNSIGNED-PAYLOAD when
constructing a canonical request, and set the same value as the x-amz-content-sha256
header value when sending the request to S3.
When you send your request to S3, the x-amz-content-sha256 header value informs S3
whether the payload is signed or not. Amazon S3 can then create signature accordingly for
verification.
Calculating a Signature
To calculate a signature, you first need a string to sign. You then calculate a HMAC-SHA256 hash of the
string to sign by using a signing key. The following diagram illustrates the process, including the various
components of the string that you create for signing
When Amazon S3 receives an authenticated request, it computes the signature and then compares it
with the signature that you provided in the request. For that reason, you must compute the signature by
using the same method that is used by Amazon S3. The process of putting a request in an agreed-upon
form for signing is called canonicalization.
The following table describes the functions that are shown in the diagram. You need to implement code
for these functions.
Function Description
HMAC-SHA256() Computes HMAC by using the SHA256 algorithm with the signing
key provided. This is the final signature.
UriEncode() URI encode every byte. UriEncode() must enforce the following
rules:
Function Description
• URI encode every byte except the unreserved characters: 'A'-'Z',
'a'-'z', '0'-'9', '-', '.', '_', and '~'.
• The space character is a reserved character and must be encoded
as "%20" (and not as "+").
• Each URI encoded byte is formed by a '%' and the two-digit
hexadecimal value of the byte.
• Letters in the hexadecimal value must be uppercase, for example
"%1A".
• Encode the forward slash character, '/', everywhere except in the
object key name. For example, if the object key name is photos/
Jan/sample.jpg, the forward slash in the key name is not
encoded.
Important
The standard UriEncode functions provided by your
development platform may not work because of
differences in implementation and related ambiguity
in the underlying RFCs. We recommend that you write
your own custom UriEncode function to ensure that your
encoding will work.
The following is the canonical request format that Amazon S3 uses to calculate a signature. For
signatures to match, you must create a canonical request in this format:
<HTTPMethod>\n
<CanonicalURI>\n
<CanonicalQueryString>\n
<CanonicalHeaders>\n
<SignedHeaders>\n
<HashedPayload>
Where:
• HTTPMethod is one of the HTTP methods, for example GET, PUT, HEAD, and DELETE.
• CanonicalURI is the URI-encoded version of the absolute path component of the URI—everything
starting with the "/" that follows the domain name and up to the end of the string or to the question
mark character ('?') if you have query string parameters. The URI in the following example, /
examplebucket/myphoto.jpg, is the absolute path and you don't encode the "/" in the absolute
path:
http://s3.amazonaws.com/examplebucket/myphoto.jpg
Note
You do not normalize URI paths for requests to Amazon S3. For example, you may have a
bucket with an object named "my-object//example//photo.user". Normalizing the path
changes the object name in the request to "my-object/example/photo.user". This is an
incorrect path for that object.
• CanonicalQueryString specifies the URI-encoded query string parameters. You URI-encode name
and values individually. You must also sort the parameters in the canonical query string alphabetically
by key name. The sorting occurs after encoding. The query string in the following URI example is
prefix=somePrefix&marker=someMarker&max-keys=20:
http://s3.amazonaws.com/examplebucket?prefix=somePrefix&marker=someMarker&max-keys=20
The canonical query string is as follows (line breaks are added to this example for readability):
UriEncode("marker")+"="+UriEncode("someMarker")+"&"+
UriEncode("max-keys")+"="+UriEncode("20") + "&" +
UriEncode("prefix")+"="+UriEncode("somePrefix")
When a request targets a subresource, the corresponding query parameter value will be an empty
string (""). For example, the following URI identifies the ACL subresource on the examplebucket
bucket:
http://s3.amazonaws.com/examplebucket?acl
If the URI does not include a '?', there is no query string in the request, and you set the canonical query
string to an empty string (""). You will still need to include the "\n".
• CanonicalHeaders is a list of request headers with their values. Individual header name and value
pairs are separated by the newline character ("\n"). Header names must be in lowercase. You must sort
the header names alphabetically to construct the string, as shown in the following example:
Lowercase(<HeaderName1>)+":"+Trim(<value>)+"\n"
Lowercase(<HeaderName2>)+":"+Trim(<value>)+"\n"
...
Lowercase(<HeaderNameN>)+":"+Trim(<value>)+"\n"
The Lowercase() and Trim() functions used in this example are described in the preceding section.
The following is an example CanonicalHeaders string. The header names are in lowercase and
sorted.
host:s3.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b785
2b855
x-amz-date:20130708T220855Z
Note
For the purpose of calculating an authorization signature, only the host and any x-amz-
* headers are required; however, in order to prevent data tampering, you should consider
including all the headers in the signature calculation.
• SignedHeaders is an alphabetically sorted, semicolon-separated list of lowercase request
header names. The request headers in the list are the same headers that you included in the
CanonicalHeaders string. For example, for the previous example, the value of SignedHeaders
would be as follows:
host;x-amz-content-sha256;x-amz-date
• HashedPayload is the hexadecimal value of the SHA256 hash of the request payload.
Hex(SHA256Hash(<payload>)
If there is no payload in the request, you compute a hash of the empty string as follows:
Hex(SHA256Hash(""))
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
For example, when you upload an object by using a PUT request, you provide object data in the body.
When you retrieve an object by using a GET request, you compute the empty string hash.
"AWS4-HMAC-SHA256" + "\n" +
timeStampISO8601Format + "\n" +
<Scope> + "\n" +
Hex(SHA256Hash(<CanonicalRequest>))
The constant string AWS4-HMAC-SHA256 specifies the hash algorithm that you are using,
HMAC-SHA256. The timeStamp is the current UTC time in ISO 8601 format (for example,
20130524T000000Z).
Scope binds the resulting signature to a specific date, an AWS region, and a service. Thus, your resulting
signature will work only in the specific region and for a specific service. The signature is valid for seven
days after the specified date.
For Amazon S3, the service string is s3. For a list of region strings, see Regions and Endpoints in the
AWS General Reference. The region column in this table provides the list of valid region strings.
The following scope restricts the resulting signature to the us-east-1 region and Amazon S3.
20130606/us-east-1/s3/aws4_request
Note
Scope must use the same date that you use to compute the signing key, as discussed in the
following section.
Note
This signing key is valid for seven days from the date specified in the DateKey hash.
For a list of region strings, see Regions and Endpoints in the AWS General Reference.
Using a signing key enables you to keep your AWS credentials in one safe place. For example, if you have
multiple servers that communicate with Amazon S3, you share the signing key with those servers; you
don’t have to keep a copy of your secret access key on each server. Signing key is valid for up to seven
days. So each time you calculate signing key you will need to share the signing key with your servers. For
more information, see Authenticating Requests (AWS Signature Version 4) (p. 14).
The final signature is the HMAC-SHA256 hash of the string to sign, using the signing key as the key.
HMAC-SHA256(SigningKey, StringToSign)
For step-by-step instructions on creating a signature, see Task 3: Create a Signature in the AWS General
Reference.
Parameter Value
AWSAccessKeyId AKIAIOSFODNN7EXAMPLE
AWSSecretAccessKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
https://examplebucket.s3.amazonaws.com/photos/photo1.jpg
For more information, see Virtual Hosting of Buckets in the Amazon Simple Storage Service Developer
Guide.
The following example gets the first 10 bytes of an object (test.txt) from examplebucket. For more
information about the API action, see GET Object (p. 370).
Because this GET request does not provide any body content, the x-amz-content-sha256 value is the
hash of the empty request body. The following steps show signature calculations and construction of the
Authorization header.
1. StringToSign
a. CanonicalRequest
GET
/test.txt
host:examplebucket.s3.amazonaws.com
range:bytes=0-9
x-amz-content-
sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20130524T000000Z
host;range;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
In the canonical request string, the last line is the hash of the empty request body. The third line
is empty because there are no query parameters in the request.
b. StringToSign
AWS4-HMAC-SHA256
20130524T000000Z
20130524/us-east-1/s3/aws4_request
7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972
2. SigningKey
3. Signature
f0e8bdb87c964420e857bd35b5d6ed310bd44f0170aba48dd91039c6036bdb41
4. Authorization header
AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/
s3/aws4_request,SignedHeaders=host;range;x-amz-content-sha256;x-amz-
date,Signature=f0e8bdb87c964420e857bd35b5d6ed310bd44f0170aba48dd91039c6036bdb41
This example PUT request creates an object (test$file.text) in examplebucket . The example
assumes the following:
• You are requesting REDUCED_REDUNDANCY as the storage class by adding the x-amz-storage-
class request header. For information about storage classes, see Storage Classes in the Amazon
Simple Storage Service Developer Guide.
• The content of the uploaded file is a string, "Welcome to Amazon S3." The value of x-amz-
content-sha256 in the request is based on this string.
For information about the API action, see PUT Object (p. 434).
<Payload>
1. StringToSign
a. CanonicalRequest
PUT
/test%24file.text
host:examplebucket.s3.amazonaws.com
x-amz-content-
sha256:44ce7dd67c959e0d3524ffac1771dfbba87d2b6b4b4e99e42034a8b803f8b072
x-amz-date:20130524T000000Z
x-amz-storage-class:REDUCED_REDUNDANCY
date;host;x-amz-content-sha256;x-amz-date;x-amz-storage-class
44ce7dd67c959e0d3524ffac1771dfbba87d2b6b4b4e99e42034a8b803f8b072
In the canonical request, the third line is empty because there are no query parameters in the
request. The last line is the hash of the body, which should be same as the x-amz-content-
sha256 header value.
b. StringToSign
AWS4-HMAC-SHA256
20130524T000000Z
20130524/us-east-1/s3/aws4_request
9e0e90d9c76de8fa5b200d8c849cd5b8dc7a3be3951ddb7f6a76b4158342019d
2. SigningKey
3. Signature
98ad721746da40c64f1a55b78f14c238d841ea1380cd77a1b5971af0ece108bd
4. Authorization header
AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/
aws4_request,SignedHeaders=date;host;x-amz-content-sha256;x-amz-date;x-amz-storage-
class,Signature=98ad721746da40c64f1a55b78f14c238d841ea1380cd77a1b5971af0ece108bd
Because the request does not provide any body content, the x-amz-content-sha256 header value is
the hash of the empty request body. The following steps show signature calculations.
1. StringToSign
a. CanonicalRequest
GET
/
lifecycle=
host:examplebucket.s3.amazonaws.com
x-amz-content-
sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20130524T000000Z
host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
In the canonical request, the last line is the hash of the empty request body.
b. StringToSign
AWS4-HMAC-SHA256
20130524T000000Z
20130524/us-east-1/s3/aws4_request
9766c798316ff2757b517bc739a67f6213b4ab36dd5da2f94eaebf79c77395ca
2. SigningKey
3. Signature
fea454ca298b7da1c68078a5d1bdbfbbe0d65c699e0f91ac7a200a0136783543
4. Authorization header
AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/
s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-
date,Signature=fea454ca298b7da1c68078a5d1bdbfbbe0d65c699e0f91ac7a200a0136783543
The following example retrieves a list of objects from examplebucket bucket. For information about
the API action, see GET Bucket (List Objects) Version 1 (p. 137).
Because the request does not provide a body, the value of x-amz-content-sha256 is the hash of the
empty request body. The following steps show signature calculations.
1. StringToSign
a. CanonicalRequest
GET
/
max-keys=2&prefix=J
host:examplebucket.s3.amazonaws.com
x-amz-content-
sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20130524T000000Z
host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
In the canonical string, the last line is the hash of the empty request body.
b. StringToSign
AWS4-HMAC-SHA256
20130524T000000Z
20130524/us-east-1/s3/aws4_request
df57d21db20da04d7fa30298dd4488ba3a2b47ca3a489c74750e0f1e7df1b9b7
2. SigningKey
3. Signature
34b48302e7b5fa45bde8084f4b7868a86f0a534bc59db6670ed5711ef69dc6f7
4. Authorization header
AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/
s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-
date,Signature=34b48302e7b5fa45bde8084f4b7868a86f0a534bc59db6670ed5711ef69dc6f7
Each chunk signature calculation includes the signature of the previous chunk. To begin, you create a
seed signature using only the headers. You use the seed signature in the signature calculation of the
first chunk. For each subsequent chunk, you create a chunk signature that includes the signature of the
previous chunk. Thus, the chunk signatures are chained together; that is, the signature of chunk n is a
function F(chunk n, signature(chunk n-1)). The chaining ensures that you send the chunks in the correct
order.
1. Decide the payload chunk size. You need this when you write the code.
Chunk size must be at least 8 KB. We recommend a chunk size of a least 64 KB for better performance.
This chunk size applies to all chunks except the last one. The last chunk you send can be smaller than
8 KB. If your payload is small and can fit into one chunk, then it can be smaller than the 8 KB.
2. Create the seed signature for inclusion in the first chunk. For more information, see Calculating the
Seed Signature (p. 29).
3. Create the first chunk and stream it. For more information, see Defining the Chunk Body (p. 32).
4. For each subsequent chunk, calculate the chunk signature that includes the previous signature in
the string you sign, construct the chunk, and send it. For more information, see Defining the Chunk
Body (p. 32).
5. Send the final additional chunk, which is the same as the other chunks in the construction, but it has
zero data bytes. For more information, see Defining the Chunk Body (p. 32).
The following table describes the functions that are shown in the diagram. You need to implement code
for these functions.
Function Description
HMAC-SHA256() Computes HMAC by using the SHA256 algorithm with the signing
key provided. This is the final signature.
UriEncode() URI encode every byte. UriEncode() must enforce the following
rules:
Function Description
• Encode the forward slash character, '/', everywhere except in the
object key name. For example, if the object key name is photos/
Jan/sample.jpg, the forward slash in the key name is not
encoded.
Important
The standard UriEncode functions provided by your
development platform may not work because of
differences in implementation and related ambiguity
in the underlying RFCs. We recommend that you write
your own custom UriEncode function to ensure that your
encoding will work.
For information about the signing process, see Signature Calculations for the Authorization Header:
Transferring Payload in a Single Chunk (AWS Signature Version 4) (p. 18). The process is the same, except
that the creation of CanonicalRequest differs as follows:
• In addition to the request headers you plan to add, you must include the following headers:
Header Description
x-amz-content- This header is required for all AWS Signature Version 4 requests. Set the
sha256 value to STREAMING-AWS4-HMAC-SHA256-PAYLOAD to indicate that the
signature covers only headers and that there is no payload.
Header Description
Content-Encoding : aws-chunked,gzip
That is, you can specify your custom content-encoding when using
Signature Version 4 streaming API.
Note
Amazon S3 stores the resulting object without the aws-chunked
encoding. Therefore, when you retrieve the object, it is not aws-
chunked encoded.
x-amz-decoded- Set the value to the length, in bytes, of the data to be chunked, without
content-length counting any metadata. For example, if you are uploading a 4 GB file, set
the value to 4294967296. This is the raw size of the object to be uploaded
(data you want to store in Amazon S3).
Content-Length Set the value to the actual size of the transmitted HTTP body, which
includes the length of your data (value set for x-amz-decoded-content-
length) plus, chunk metadata. Each chunk has metadata, such as the
signature of the previous chunk. Chunk calculations are discussed in the
following section.
You send the first chunk with the seed signature. You must construct the chunk as described in the
following section.
Where:
• IntHexBase() is a function that you write to convert an integer chunk-size to hexadecimal. For
example, if chunk-size is 65536, hexadecimal string is "10000".
• chunk-size is the size, in bytes, of the chunk-data, without metadata. For example, if you are
uploading a 65 KB object and using a chunk size of 64 KB, you upload the data in three chunks: the
first would be 64 KB, the second 1 KB, and the final chunk with 0 bytes.
• signature For each chunk, you calculate the signature using the following string to sign. For the first
chunk, you use the seed-signature as the previous signature.
The size of the final chunk data that you send is 0, although the chunk body still contains metadata,
including the signature of the previous chunk.
• The signature calculations in these examples use the following example security credentials.
Parameter Value
AWSAccessKeyId AKIAIOSFODNN7EXAMPLE
AWSSecretAccessKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
• All examples use the request time stamp 20130524T000000Z (Fri, 24 May 2013 00:00:00 GMT).
• All examples use examplebucket as the bucket name.
• The bucket is assumed to be in the US East (N. Virginia) Region, and the credential Scope and the
Signing Key calculations use us-east-1 as the Region specifier. For more information, see Regions
and Endpoints in the Amazon Web Services General Reference.
• You can use either path style or virtual-hosted style requests. The following examples use virtual-
hosted style requests, for example:
https://examplebucket.s3.amazonaws.com/photos/photo1.jpg
For more information, see Virtual Hosting of Buckets in the Amazon Simple Storage Service Developer
Guide.
• You are uploading a 65 KB text file, and the file content is a one-character string made up of the letter
'a'.
• The chunk size is 64 KB. As a result, the payload is uploaded in three chunks, 64 KB, 1 KB, and the final
chunk with 0 bytes of chunk data.
• The resulting object has the key name chunkObject.txt.
• You are requesting REDUCED_REDUNDANCY as the storage class by adding the x-amz-storage-
class request header.
For information about the API action, see PUT Object (p. 434). The general request syntax is as follows:
a. CanonicalRequest
PUT
/examplebucket/chunkObject.txt
content-encoding:aws-chunked
content-length:66824
host:s3.amazonaws.com
x-amz-content-sha256:STREAMING-AWS4-HMAC-SHA256-PAYLOAD
x-amz-date:20130524T000000Z
x-amz-decoded-content-length:66560
x-amz-storage-class:REDUCED_REDUNDANCY
content-encoding;content-length;host;x-amz-content-sha256;x-amz-date;x-amz-decoded-
content-length;x-amz-storage-class
STREAMING-AWS4-HMAC-SHA256-PAYLOAD
In the canonical request, the third line is empty because there are no query parameters in the
request. The last line is the constant string provided as the value of the hashed Payload, which
should be same as the value of x-amz-content-sha256 header.
b. StringToSign
AWS4-HMAC-SHA256
20130524T000000Z
20130524/us-east-1/s3/aws4_request
cee3fed04b70f867d036f722359b0b1f2f0e5dc0efadbc082b76c4c60e316455
Note
For information about each of line in the string to sign, see the diagram that explains
seed signature calculation.
2. SigningKey
3. Seed Signature
4f232c4386841ef735655705268965c44a0e4690baa4adea153f7db9fa80a0a9
4. Authorization header
AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/
aws4_request,SignedHeaders=content-encoding;content-length;host;x-amz-
content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-storage-
class,Signature=4f232c4386841ef735655705268965c44a0e4690baa4adea153f7db9fa80a0a9
AWS4-HMAC-SHA256-PAYLOAD
20130524T000000Z
20130524/us-east-1/s3/aws4_request
4f232c4386841ef735655705268965c44a0e4690baa4adea153f7db9fa80a0a9
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
bf718b6f653bebc184e1479f1935b8da974d701b893afcf49e701f3e2f9f9c5a
Note
For information about each line in the string to sign, see the preceding diagram that
shows various components of the string to sign (for example, the last three lines are,
previous-signature, hash(""), and hash(current-chunk-data)).
b. Chunk signature:
ad80c730a21e5b8d04586a2213dd63b9a0e99e0e2307b0ade35a65485a288648
10000;chunk-
signature=ad80c730a21e5b8d04586a2213dd63b9a0e99e0e2307b0ade35a65485a288648
<65536-bytes>
AWS4-HMAC-SHA256-PAYLOAD
20130524T000000Z
20130524/us-east-1/s3/aws4_request
ad80c730a21e5b8d04586a2213dd63b9a0e99e0e2307b0ade35a65485a288648
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2edc986847e209b4016e141a6dc8716d3207350f416969382d431539bf292e4a
b. Chunk signature:
0055627c9e194cb4542bae2aa5492e3c1575bbb81b612b7d234b86a503ef5497
400;chunk-
signature=0055627c9e194cb4542bae2aa5492e3c1575bbb81b612b7d234b86a503ef5497
<1024 bytes>
API Version 2006-03-01
35
Amazon Simple Storage Service API Reference
Using Query Parameters
AWS4-HMAC-SHA256-PAYLOAD
20130524T000000Z
20130524/us-east-1/s3/aws4_request
0055627c9e194cb4542bae2aa5492e3c1575bbb81b612b7d234b86a503ef5497
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
b. Chunk signature:
b6c6ea8a5354eaf15b3cb7646744f4275b71ea724fed81ceb9323e279d449df9
0;chunk-signature=b6c6ea8a5354eaf15b3cb7646744f4275b71ea724fed81ceb9323e279d449df9
A use case scenario for presigned URLs is that you can grant temporary access to your Amazon S3
resources. For example, you can embed a presigned URL on your website or alternatively use it in
command line client (such as Curl) to download objects.
https://s3.amazonaws.com/examplebucket/test.txt
?X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=<your-access-key-id>/20130721/us-east-1/s3/aws4_request
&X-Amz-Date=20130721T201207Z
&X-Amz-Expires=86400
&X-Amz-SignedHeaders=host
&X-Amz-Signature=<signature-value>
&X-Amz-Credential=<your-access-key-id>%2F20130721%2Fus-east-1%2Fs3%2Faws4_request
The following table describes the query parameters in the URL that provide authentication information.
X-Amz-Algorithm Identifies the version of AWS Signature and the algorithm that you
used to calculate the signature.
X-Amz-Credential In addition to your access key ID, this parameter also provides
scope (AWS region and service) for which the signature is valid.
This value must match the scope you use in signature calculations,
discussed in the following section. The general form for this
parameter value is as follows:
<your-access-key-id>/<date>/<AWS-region>/<AWS-service>/
aws4_request
For example:
AKIAIOSFODNN7EXAMPLE/20130721/us-east-1/s3/aws4_request
For Amazon S3, the AWS-service string is s3. For a list of S3 AWS-
region strings, see Regions and Endpoints in the AWS General
Reference.
X-Amz-Date The date and time format must follow the ISO 8601 standard, and
must be formatted with the "yyyyMMddTHHmmssZ" format. For
example if the date and time was "08/01/2016 15:32:41.982-700"
then it must first be converted to UTC (Coordinated Universal Time)
and then submitted as "20160801T083241Z".
X-Amz-Expires Provides the time period, in seconds, for which the generated
presigned URL is valid. For example, 86400 (24 hours). This value is
an integer. The minimum value you can set is 1, and the maximum
is 604800 (seven days).
X-Amz-SignedHeaders Lists the headers that you used to calculate the signature. The
following headers are required in the signature calculations:
Note
For added security, you should sign all the request headers
that you plan to include in your request.
Calculating a Signature
The following diagram illustrates the signature calculation process.
The following table describes the functions that are shown in the diagram. You need to implement code
for these functions.
Function Description
HMAC-SHA256() Computes HMAC by using the SHA256 algorithm with the signing
key provided. This is the final signature.
UriEncode() URI encode every byte. UriEncode() must enforce the following
rules:
Function Description
• Each URI encoded byte is formed by a '%' and the two-digit
hexadecimal value of the byte.
• Letters in the hexadecimal value must be uppercase, for example
"%1A".
• Encode the forward slash character, '/', everywhere except in the
object key name. For example, if the object key name is photos/
Jan/sample.jpg, the forward slash in the key name is not
encoded.
Important
The standard UriEncode functions provided by your
development platform may not work because of
differences in implementation and related ambiguity
in the underlying RFCs. We recommend that you write
your own custom UriEncode function to ensure that your
encoding will work.
For more information about the signing process (details of creating a canonical request, string to sign,
and signature calculations), see Signature Calculations for the Authorization Header: Transferring
Payload in a Single Chunk (AWS Signature Version 4) (p. 18). The process is generally the same except
that the creation of CanonicalRequest in a presigned URL differs as follows:
• You don't include a payload hash in the Canonical Request, because when you create a presigned URL,
you don't know the payload content because the URL is used to upload an arbitrary payload. Instead,
you use a constant string UNSIGNED-PAYLOAD.
• The Canonical Query String must include all the query parameters from the preceding table except
for X-Amz-Signature.
• Canonical Headers must include the HTTP host header. If you plan to include any of the x-amz-*
headers, these headers must also be added for signature calculation. You can optionally add all other
headers that you plan to include in your request. For added security, you should sign as many headers
as possible.
An Example
Suppose you have an object test.txt in your examplebucket bucket. You want to share this object
with others for a period of 24 hours (86400 seconds) by creating a presigned URL.
https://s3.amazonaws.com/examplebucket/test.txt
?X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request
&X-Amz-Date=20130524T000000Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host
&X-Amz-Signature=<signature-value>
The following steps illustrate first the signature calculations and then construction of the presigned URL.
The example makes the following additional assumptions:
You can use this example as a test case to verify the signature that your code calculates; however, you
must use the same bucket name, object key, time stamp, and the following example credentials:
Parameter Value
AWSAccessKeyId AKIAIOSFODNN7EXAMPLE
AWSSecretAccessKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
1. StringToSign
a. CanonicalRequest
GET
/test.txt
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE
%2F20130524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20130524T000000Z&X-Amz-
Expires=86400&X-Amz-SignedHeaders=host
host:examplebucket.s3.amazonaws.com
host
UNSIGNED-PAYLOAD
b. StringToSign
AWS4-HMAC-SHA256
20130524T000000Z
20130524/us-east-1/s3/aws4_request
3bfa292879f6447bbcda7001decf97f4a54dc650c8942174ae0a9121cf58ad04
2. SigningKey
3. Signature
aeeed9bbccd4d02ee5c0109b86d86835f995330da4c265957d157751f604d404
Now you have all information to construct a presigned URL. The resulting URL for this example is
shown as follows (you can use this to compare your presigned URL):
https://examplebucket.s3.amazonaws.com/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-
Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request&X-
Amz-Date=20130524T000000Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-
Signature=aeeed9bbccd4d02ee5c0109b86d86835f995330da4c265957d157751f604d404
For authenticated requests, unless you are using the AWS SDKs, you have to write code to calculate
signatures that provide authentication information in your requests. Signature calculation in AWS
Signature Version 4 (see Authenticating Requests (AWS Signature Version 4) (p. 14)) can be a complex
undertaking, and we recommend that you use the AWS SDKs whenever possible.
This section provides examples of signature calculations written in Java and C#. The code samples send
the following requests and use the HTTP Authorization header to provide authentication information:
• PUT object – Separate examples illustrate both uploading the full payload at once and uploading
the payload in chunks. For information about using the Authorization header for authentication, see
Authenticating Requests: Using the Authorization Header (AWS Signature Version 4) (p. 16).
• GET object – This example generates a presigned URL to get an object. Query parameters provide the
signature and other authentication information. Users can paste a presigned URL in their browser to
retrieve the object, or you can use the URL to create a clickable link. For information about using query
parameters for authentication, see Authenticating Requests: Using Query Parameters (AWS Signature
Version 4) (p. 36).
The rest of this section describes the examples in Java and C#. The topics include instructions for
downloading the samples and for executing them.
If bucket is in the US East (N. Virginia) region, use us-east-1 to specify the region. For a list of other
AWS regions, go to Amazon Simple Storage Service (S3) in the AWS General Reference.
4. Compile the source code and store the compiled classes into the bin/ directory.
java com.amazonaws.services.s3.sample.RunAllSamples
The code runs all the methods in main(). For each request, the output will show the canonical
request, the string to sign, and the signature.
Console.WriteLine("\n\n************************************************");
PutS3ObjectChunkedSample.Run(awsRegion, bucketName, "MySampleFileChunked.txt");
Console.WriteLine("\n\n************************************************");
GetS3ObjectSample.Run(awsRegion, bucketName, "MySampleFile.txt");
Console.WriteLine("\n\n************************************************");
PresignedUrlSample.Run(awsRegion bucketName, "MySampleFile.txt");
1. The form must include the following fields to provide signature and relevant information that Amazon
S3 can use to re-calculate the signature upon receiving the request:
<your-access-key-id>/<date>/<aws-
region>/<aws-service>/aws4_request
For example:
AKIAIOSFODNN7EXAMPLE/20130728/us-east-1/s3/
aws4_request. .
<your-access-key-id>/<date>/<aws-
region>/<aws-service>/aws4_request
For example,
AKIAIOSFODNN7EXAMPLE/20130728/us-east-1/s3/
aws4_request. .
Calculating a Signature
The following diagram illustrates the signature calculation process.
To Calculate a signature
For more information about creating HTML forms, security policies, and an example, see the following
subtopics:
Valid values:
Valid values:
REST-HEADER
REST-QUERY-STRING
POST
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Test",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::examplebucket/*",
"Condition": {
"StringEquals": {
"s3:signatureversion": "AWS4-HMAC-SHA256"
}
}
}
]
}
The following bucket policy denies any Amazon S3 presigned URL request on objects in examplebucket
if the signature is more than ten minutes old.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Deny a presigned URL request if the signature is more than 10 min old",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::examplebucket3/*",
"Condition": {
"NumericGreaterThan": {
"s3:signatureAge": 600000
}
}
}
]
}
The following bucket policy allows only requests that use the Authorization header for request
authentication. Any POST or presigned URL requests will be denied.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow only requests that use Authorization header for request
authentication. Deny POST or presigned URL requests.",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::examplebucket3/*",
"Condition": {
"StringNotEquals": {
"s3:authType": "REST-HEADER"
}
}
}
]
}
The following bucket policy denies any uploads that use presigned URLs.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow only requests that use Authorization header for request
authentication. Deny POST or presigned URL requests.",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::examplebucket3/*",
"Condition": {
"StringNotEquals": {
"s3:x-amz-content-sha256": "UNSIGNED-PAYLOAD"
}
}
}
]
}
Topics
• Browser-Based Uploads Using HTTP POST (p. 49)
• Calculating a Signature (p. 50)
• Creating an HTML Form (Using AWS Signature Version 4) (p. 51)
• Creating a POST Policy (p. 56)
• Example: Browser-Based Upload using HTTP POST (Using AWS Signature Version 4) (p. 61)
• Using POST with Adobe Flash to Upload Objects (p. 63)
• Browser-Based Uploads to Amazon S3 Using the AWS Amplify Library (p. 63)
2 Your webpage contains an HTML form that contains all the information necessary for the
user to upload content to Amazon S3.
1. Create a security policy specifying conditions that restrict what you want to allow in the request, such
as the bucket name where objects can be uploaded, and key name prefixes that you want to allow for
the object that is being created.
2. Create a signature that is based on the policy. For authenticated requests, the form must include a
valid signature and the policy.
3. Create an HTML form that your users can access in order to upload objects to your Amazon S3 bucket.
The following section describes how to create a signature to authenticate a request. For information
about creating forms and security policies, see Creating an HTML Form (Using AWS Signature Version
4) (p. 51).
Calculating a Signature
For authenticated requests, the HTML form must include fields for a security policy and a signature.
• A security policy (see Creating a POST Policy (p. 56)) controls what is allowed in the request.
• The security policy is the StringToSign (see Introduction to Signing Requests (p. 15)) in your
signature calculation.
To Calculate a signature
For more information about creating HTML forms, security policies, and an example, see the following:
To allow users to upload content to Amazon S3 by using their browsers (HTTP POST requests), you use
HTML forms. HTML forms consist of a form declaration and form fields. The form declaration contains
high-level information about the request. The form fields contain detailed request information.
This section describes how to create HTML forms. For a working example of browser-based upload using
HTTP POST and related signature calculations for request authentication, see Example: Browser-Based
Upload using HTTP POST (Using AWS Signature Version 4) (p. 61).
The form and policy must be UTF-8 encoded. You can apply UTF-8 encoding to the form by specifying
charset=UTF-8 in the content attribute. The following is an example of UTF-8 encoding in the HTML
heading.
<html>
<head>
...
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...
</head>
<body>
Note
The form data and boundaries (excluding the contents of the file) cannot exceed 20KB.
• action – The URL that processes the request, which must be set to the URL of the
bucket. For example, if the name of your bucket is examplebucket, the URL is http://
examplebucket.s3.amazonaws.com/.
Note
The key name is specified in a form field.
• method – The method must be POST.
• enctype – The enclosure type (enctype) must be set to multipart/form-data for both file uploads
and text area uploads. For more information about enctype, see RFC 1867.
enctype="multipart/form-data">
If you don't provide elements required for authenticated requests, such as the policy element, the
request is assumed to be anonymous and will succeed only if you have configured the bucket for public
read and write.
Type: String
Default: private
Content-Disposition
Content-Encoding
Expires
x-amz-credential In addition to your access key ID, this field also Required for
provides scope information identifying region authenticated
and service for which the signature is valid. This requests
should be the same scope you used in calculating
the signing key for signature calculation.
<your-access-key-id>/<date>/<aws-
region>/<aws-service>/aws4_request
For example:
AKIAIOSFODNN7EXAMPLE/20130728/us-
east-1/s3/aws4_request
For Amazon S3, the aws-service string is s3.
For a list of Amazon S3 aws-region strings,
see Regions and Endpoints in the AWS General
Reference. This is required if a policy document is
included with the request.
Conditional items are required for authenticated requests and are optional for anonymous requests.
Now that you know how to create forms, next you can create a security policy that you can sign. For
more information, see Creating a POST Policy (p. 56).
The policy required for making authenticated requests using HTTP POST is a UTF-8 and base64-encoded
document written in JavaScript Object Notation (JSON) that specifies conditions that the request must
meet. Depending on how you design your policy document, you can control the access granularity per-
upload, per-user, for all uploads, or according to other designs that meet your needs.
This section describes the POST policy. For example signature calculations using POST policy, see
Example: Browser-Based Upload using HTTP POST (Using AWS Signature Version 4) (p. 61).
Note
Although the policy document is optional, we highly recommend that you use one in order to
control what is allowed in the request. If you make the bucket publicly writable, you have no
control at all over which users can write to your bucket.
{ "expiration": "2007-12-01T12:00:00.000Z",
"conditions": [
{"acl": "public-read" },
{"bucket": "johnsmith" },
["starts-with", "$key", "user/eric/"],
]
}
The POST policy always contains the expiration and conditions elements. The example policy
uses two condition matching types (exact matching and starts-with matching). The following sections
describe these elements.
Expiration
The expiration element specifies the expiration date and time of the POST policy in ISO8601 GMT
date format. For example, 2013-08-01T12:00:00.000Z specifies that the POST policy is not valid
after midnight GMT on August 1, 2013.
Condition Matching
Following is a table that describes condition matching types that you can use to specify POST policy
conditions (described in the next section). Although you must specify one condition for each form field
that you specify in the form, you can create more complex matching criteria by specifying multiple
conditions for a form field.
Condition Description
Match Type
Exact Matches The form field value must match the value specified. This example indicates that
the ACL must be set to public-read:
Condition Description
Match Type
{"acl": "public-read" }
This example is an alternate way to indicate that the ACL must be set to public-read:
Starts With The value must start with the specified value. This example indicates that the object
key must start with user/user1:
Matching Any To configure the POST policy to allow any content within a form field, use
Content starts-with with an empty value (""). This example allows any value for
success_action_redirect:
Specifying For form fields that accept a range, separate the upper and lower limit with a
Ranges comma. This example allows a file size from 1 to 10 MiB:
The specific conditions supported in a POST policy are described in Conditions (p. 57).
Conditions
The conditions in a POST policy is an array of objects, each of which is used to validate the request.
You can use these conditions to restrict what is allowed in the request. For example, the preceding policy
conditions require the following:
Each form field that you specify in a form (except x-amz-signature, file, policy, and field names
that have an x-ignore- prefix) must appear in the list of conditions.
Note
All variables within the form are expanded prior to validating the POST policy. Therefore, all
condition matching should be against the expanded form fields. Suppose that you want to
restrict your object key name to a specific prefix (user/user1). In this case, you set the key
form field to user/user1/${filename}. Your POST policy should be [ "starts-with",
"$key", "user/user1/" ] (do not enter [ "starts-with", "$key", "user/user1/
${filename}" ]). For more information, see Condition Matching (p. 56).
acl Specifies the ACL value that must be used in the form
submission.
content-length-range The minimum and maximum allowable size for the uploaded
content.
Content-Encoding
Expires
success_action_status The status code returned to the client upon successful upload if
success_action_redirect is not specified.
<your-access-key-id>/<date>/<aws-region>/<aws-
service>/aws4_request
AKIAIOSFODNN7EXAMPLE/20130728/us-east-1/s3/
aws4_request
x-amz-date The date value specified in the ISO8601 formatted string. For
example, 20130728T000000Z. The date must be same that you
used in creating the signing key for signature calculation.
x-amz-* See POST Object (POST Object (p. 407) for other x-amz-*
headers.
Note
If your toolkit adds more form fields (for example, Flash adds filename), you must add them to
the POST policy document. If you can control this functionality, prefix x-ignore- to the field
so Amazon S3 ignores the feature and it won't affect future versions of this feature.
Character Escaping
Characters that must be escaped within a POST policy document are described in the following table.
Escape Description
Sequence
\\ Backslash
\$ Dollar symbol
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Horizontal tab
\v Vertical tab
Now that you are acquainted with forms and policies, and understand how signing works, you can try
a POST upload example. You need to write the code to calculate the signature. The example provides
a sample form, and a POST policy that you can use to test your signature calculations. For more
information, see Example: Browser-Based Upload using HTTP POST (Using AWS Signature Version
4) (p. 61).
The example uses the following example credentials the signature calculations. You can use these
credentials to verify your signature calculation code. However, you must then replace these with your
own credentials when sending requests to AWS.
Parameter Value
AWSAccessKeyId AKIAIOSFODNN7EXAMPLE
AWSSecretAccessKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
{ "expiration": "2015-12-30T12:00:00.000Z",
"conditions": [
{"bucket": "sigv4examplebucket"},
["starts-with", "$key", "user/user1/"],
{"acl": "public-read"},
{"success_action_redirect": "http://sigv4examplebucket.s3.amazonaws.com/
successful_upload.html"},
["starts-with", "$Content-Type", "image/"],
{"x-amz-meta-uuid": "14365123651274"},
{"x-amz-server-side-encryption": "AES256"},
["starts-with", "$x-amz-meta-tag", ""],
{"x-amz-credential": "AKIAIOSFODNN7EXAMPLE/20151229/us-east-1/s3/aws4_request"},
{"x-amz-algorithm": "AWS4-HMAC-SHA256"},
{"x-amz-date": "20151229T000000Z" }
]
}
• The upload must occur before noon UTC on December 30, 2015.
• The content can be uploaded only to the sigv4examplebucket. The bucket must be in the region
that you specified in the credential scope (x-amz-credential form parameter), because the
signature you provided is valid only within this scope.
• You can provide any key name that starts with user/user1. For example, user/user1/
MyPhoto.jpg.
• The ACL must be set to public-read.
• If the upload succeeds, the user's browser is redirected to http://
sigv4examplebucket.s3.amazonaws.com/successful_upload.html.
The following is a Base64-encoded version of this POST policy. You use this value as your StringToSign in
signature calculation.
eyAiZXhwaXJhdGlvbiI6ICIyMDE1LTEyLTMwVDEyOjAwOjAwLjAwMFoiLA0KICAiY29uZGl0aW9ucyI6IFsNCiAgICB7ImJ1Y2tldCI
When you copy/paste the preceding policy, it should only have newlines (not carriage return and new
line) for your computed hash to match this value.
Using example credentials to create a signature, the signature value is as follows (in signature
calculation, the date is same as the x-amz-date in the policy (20151229):
8afdbf4008c03f22c2cd3cdb72e4afbb1f6a588f3255ac628749a66d7f09699e
The following example form specifies the preceding POST policy and supports a POST request to the
sigv4examplebucket. Copy/paste the content in a text editor and save it as exampleform.html. You
can then upload image files to the specific bucket using the exampleform.html. Your request will succeed
if the signature you provide matches the signature Amazon S3 calculates.
Note
You must update the bucket name, dates, credential, policy, and signature with valid values for
this to successfully upload to S3.
<html>
<head>
</head>
<body>
</html>
The post parameters are case insensitive. For example, you can specify x-amz-signature or X-Amz-
Signature.
To override the default, you must upload a publicly readable crossdomain.xml file to the bucket that
will accept POST uploads. Here is a sample crossdomain.xml file:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false" />
</cross-domain-policy>
For more information about the Adobe Flash security model, go to the Adobe web site.
When you add the crossdomain.xml file to your bucket, any Adobe Flash Player can connect to the
crossdomain.xml file within your bucket. However, crossdomain.xml does not grant access to the
Amazon S3 bucket.
Some versions of the Adobe Flash Player do not properly handle HTTP responses that have an
empty body. To configure POST to return a response that does not have an empty body, set
success_action_status to 201. Then, Amazon S3 will return an XML document with a 201 status
code. For information about using this as an optional element (currently the only allowed value is the
content of the XML document), see POST Object (p. 407). For information about form fields, see HTML
Form Fields (p. 52).
For information about setting up the AWS Amplify library, see AWS Amplify Installation and
Configuration.
The following example shows the manual setup for using the AWS Amplify Storage module. The default
implementation of the Storage module uses Amazon S3.
The following example shows how to put public data into Amazon S3.
Storage.put('test.txt', 'Hello')
.then (result => console.log(result))
.catch(err => console.log(err));
The following example shows how to put private data into Amazon S3.
For more information about using the AWS Amplify Storage module, see AWS Amplify Storage.
More Info
AWS Amplify Quick Start
Topics
• GET Service (p. 65)
GET Service
Description
This implementation of the GET operation returns a list of all buckets owned by the authenticated
sender of the request.
To authenticate a request, you must use a valid AWS Access Key ID that is registered with Amazon S3.
Anonymous requests cannot list buckets, and you cannot list buckets that you did not create.
Requests
Syntax
GET / HTTP/1.1
Host: s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Elements
Name Description
Type: Container
Name Description
Children: Name, CreationDate
Ancestor: ListAllMyBucketsResult.Buckets
Type: Container
Children: Bucket
Ancestor: ListAllMyBucketsResult
Ancestor: ListAllMyBucketsResult.Buckets.Bucket
Type: String
Ancestor: ListAllMyBucketsResult.Owner
Type: String
Ancestor: ListAllMyBucketsResult.Owner
Type: Container
Ancestor: None
Type: String
Ancestor: ListAllMyBucketsResult.Buckets.Bucket
Type: Container
Ancestor: ListAllMyBucketsResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The GET operation on the Service endpoint (s3.amazonaws.com) returns a list of all of the buckets owned
by the authenticated sender of the request.
GET / HTTP/1.1
Host: s3.amazonaws.com
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: authorization string
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Owner>
<ID>bcaf1ffd86f461ca5fb16fd081034f</ID>
<DisplayName>webfile</DisplayName>
</Owner>
<Buckets>
<Bucket>
<Name>quotes</Name>
<CreationDate>2006-02-03T16:45:09.000Z</CreationDate>
</Bucket>
<Bucket>
<Name>samples</Name>
<CreationDate>2006-02-03T16:41:58.000Z</CreationDate>
</Bucket>
</Buckets>
</ListAllMyBucketsResult>
Related Resources
• GET Bucket (List Objects) Version 1 (p. 137)
• GET Object (p. 370)
Topics
• Block Public Access (p. 68)
• Batch Operations (p. 75)
Topics
• DELETE PublicAccessBlock (p. 68)
• GET PublicAccessBlock (p. 69)
• PUT PublicAccessBlock (p. 72)
DELETE PublicAccessBlock
Description
This operation removes the PublicAccessBlock configuration for an Amazon Web Services account.
In order to use this operation, you must have the s3:PutAccountPublicAccessBlock permission. For
more information about Amazon S3 permissions, see Specifying Permissions in a Policy in the Amazon
Simple Storage Service Developer Guide.
Requests
Syntax
Note
For information about locating your AWS account ID, see Finding your AWS Account ID in the
Amazon Web Services General Reference.
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• GET PublicAccessBlock (p. 179)
• PUT PublicAccessBlock (p. 302)
• DELETE PublicAccessBlock (p. 115)
• GET BucketPolicyStatus (p. 195)
• GET PublicAccessBlock (p. 69)
• PUT PublicAccessBlock (p. 72)
GET PublicAccessBlock
Description
This operation retrieves the PublicAccessBlock configuration for an Amazon Web Services account.
In order to use this operation, you must have the s3:GetAccountPublicAccessBlock permission. For
more information about Amazon S3 permissions, see Specifying Permissions in a Policy in the Amazon
Simple Storage Service Developer Guide.
Important
When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it
checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains
the object) and the bucket owner's account. If the PublicAccessBlock settings are different
between the bucket and the account, Amazon S3 uses the most restrictive combination of the
bucket-level and account-level settings.
For more information about when Amazon S3 considers a bucket or an object public, see The Meaning of
"Public" in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
Note
For information about locating your AWS account ID, see Finding your AWS Account ID in the
Amazon Web Services General Reference.
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
Name Description
A PublicAccessBlock configuration.
PublicAccessBlockConfiguration
Type: Container
BlockPublicAcls Specifies whether Amazon S3 will block public access control lists (ACLs) for
buckets and objects that are owned by this account.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
IgnorePublicAcls Specifies whether Amazon S3 will ignore public ACLs for buckets and objects
that are owned by this account.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
BlockPublicPolicy Specifies whether Amazon S3 will block public bucket policies for buckets that
are owned by this account.
Name Description
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Specifies whether Amazon S3 will restrict public bucket policies for buckets that
RestrictPublicBuckets
are owned by this account.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request gets an account PublicAccessBlock configuration.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 0
<PublicAccessBlockConfiguration>
<BlockPublicAcls>TRUE</BlockPublicAcls>
<IgnorePublicAcls>FALSE</IgnorePublicAcls>
<BlockPublicPolicy>FALSE</BlockPublicPolicy>
<RestrictPublicBuckets>FALSE</RestrictPublicBuckets>
</PublicAccessBlockConfiguration>
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• GET PublicAccessBlock (p. 179)
• PUT PublicAccessBlock (p. 302)
• DELETE PublicAccessBlock (p. 115)
• GET BucketPolicyStatus (p. 195)
• PUT PublicAccessBlock (p. 72)
PUT PublicAccessBlock
Description
This operation creates or modifies the PublicAccessBlock configuration for an Amazon Web Services
account. In order to use this operation, you must have the s3:PutAccountPublicAccessBlock
permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy
in the Amazon Simple Storage Service Developer Guide.
Important
When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it
checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains
the object) and the bucket owner's account. If the PublicAccessBlock configurations are
different between the bucket and the account, Amazon S3 uses the most restrictive combination
of the bucket-level and account-level settings.
For more information about when Amazon S3 considers a bucket or object public, see The Meaning of
"Public" in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
Note
For information about locating your AWS account ID, see Finding your AWS Account ID in the
Amazon Web Services General Reference.
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This operation uses the following request elements. You can enable BlockPublicAcls,
IgnorePublicAcls, BlockPublicPolicy, and RestrictPublicBuckets in any combination.
Type: Container
BlockPublicAcls Specifies whether Amazon S3 should block public access control lists No
(ACLs) for buckets and objects in this account. Setting this element to
TRUE causes the following behavior:
• PUT Bucket acl (p. 260) and PUT Object acl (p. 467) calls fail if
the specified ACL is public.
• PUT Object (p. 434) calls fail if the request includes a public ACL.
• PUT Bucket (p. 252) calls fail if the request includes a public ACL.
Important
Enabling this setting doesn't affect existing policies or ACLs.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
First Sample Request
The following request puts an account PublicAccessBlock configuration that blocks public ACLs for
buckets in the specified account.
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 0
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 0
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• GET PublicAccessBlock (p. 179)
• PUT PublicAccessBlock (p. 302)
• DELETE PublicAccessBlock (p. 115)
• GET BucketPolicyStatus (p. 195)
• GET PublicAccessBlock (p. 69)
• DELETE PublicAccessBlock (p. 68)
Batch Operations
This section describes how to use perform batch operations with Amazon S3 accounts.
Topics
• CreateJob (p. 77)
• DescribeJob (p. 81)
• ListJobs (p. 84)
• UpdateJobStatus (p. 87)
• UpdateJobPriority (p. 90)
CreateJob
Service: AWS S3 Control
Request Syntax
POST /v20180820/jobs HTTP/1.1
x-amz-account-id: AccountId
<?xml version="1.0" encoding="UTF-8"?>
<CreateJobRequest xmlns="http://awss3control.amazonaws.com/doc/2018-08-20/">
<ClientRequestToken>string</ClientRequestToken>
<ConfirmationRequired>boolean</ConfirmationRequired>
<Description>string</Description>
<Manifest>
<Location>
<ETag>string</ETag>
<ObjectArn>string</ObjectArn>
<ObjectVersionId>string</ObjectVersionId>
</Location>
<Spec>
<Fields>
<INVALID-TYPE-NAME>string</INVALID-TYPE-NAME>
</Fields>
<Format>string</Format>
</Spec>
</Manifest>
<Operation>
<S3PutObjectAcl>
<AccessControlPolicy>
<AccessControlList>
<Grants>
<S3Grant>
<Grantee>
<DisplayName>string</DisplayName>
<Identifier>string</Identifier>
<TypeIdentifier>string</TypeIdentifier>
</Grantee>
<Permission>string</Permission>
</S3Grant>
</Grants>
<Owner>
<DisplayName>string</DisplayName>
<ID>string</ID>
</Owner>
</AccessControlList>
<CannedAccessControlList>string</CannedAccessControlList>
</AccessControlPolicy>
</S3PutObjectAcl>
</Operation>
<Priority>integer</Priority>
<Report>
<Bucket>string</Bucket>
<Enabled>boolean</Enabled>
<Format>string</Format>
<Prefix>string</Prefix>
<ReportScope>string</ReportScope>
</Report>
<RoleArn>string</RoleArn>
</CreateJobRequest>
Request Body
The request accepts the following data in XML format.
Required: Yes
ClientRequestToken (p. 77)
An idempotency token to ensure that you don't accidentally submit the same request twice. You can
use any string up to the maximum length.
Type: String
Required: Yes
ConfirmationRequired (p. 77)
Indicates whether confirmation is required before Amazon S3 runs the job. By default,
ConfirmationRequired is false.
Type: Boolean
Required: No
Description (p. 77)
A description for this job. You can use any string within the permitted length. Descriptions don't
need to be unique and can be used for multiple jobs.
Type: String
Required: No
Manifest (p. 77)
Required: Yes
Operation (p. 77)
The operation that you want this job to perform on each object listed in the manifest. For more
information about the available operations, see Available Operations in the Amazon Simple Storage
Service Developer Guide.
Required: Yes
Priority (p. 77)
The numerical priority for this job. Higher numbers indicate higher priority.
Type: Integer
Required: Yes
Report (p. 77)
Required: Yes
RoleArn (p. 77)
The Amazon Resource Name (ARN) for the AWS Identity and Access Management (IAM) role that
batch operations use to execute this job's operation on each object in the manifest.
Type: String
Required: Yes
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<CreateJobResult>
<JobId>string</JobId>
</CreateJobResult>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Required: Yes
JobId (p. 79)
The ID for this job. Amazon S3 generates this ID automatically and returns it after a successful
Create Job request.
Type: String
Errors
BadRequestException
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
DescribeJob
Service: AWS S3 Control
Retrieves the configuration parameters and status for an Amazon S3 batch operations job.
Request Syntax
GET /v20180820/jobs/id HTTP/1.1
x-amz-account-id: AccountId
id (p. 81)
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<DescribeJobResult>
<Job>
<ConfirmationRequired>boolean</ConfirmationRequired>
<CreationTime>timestamp</CreationTime>
<Description>string</Description>
<FailureReasons>
<JobFailure>
<FailureCode>string</FailureCode>
<FailureReason>string</FailureReason>
</JobFailure>
</FailureReasons>
<JobArn>string</JobArn>
<JobId>string</JobId>
<Manifest>
<Location>
<ETag>string</ETag>
<ObjectArn>string</ObjectArn>
<ObjectVersionId>string</ObjectVersionId>
</Location>
<Spec>
<Fields>
<INVALID-TYPE-NAME>string</INVALID-TYPE-NAME>
</Fields>
<Format>string</Format>
</Spec>
</Manifest>
<Operation>
<S3PutObjectAcl>
<AccessControlPolicy>
<AccessControlList>
<Grants>
<S3Grant>
<Grantee>
<DisplayName>string</DisplayName>
<Identifier>string</Identifier>
<TypeIdentifier>string</TypeIdentifier>
</Grantee>
<Permission>string</Permission>
</S3Grant>
</Grants>
<Owner>
<DisplayName>string</DisplayName>
<ID>string</ID>
</Owner>
</AccessControlList>
<CannedAccessControlList>string</CannedAccessControlList>
</AccessControlPolicy>
</S3PutObjectAcl>
</Operation>
<Priority>integer</Priority>
<ProgressSummary>
<NumberOfTasksFailed>long</NumberOfTasksFailed>
<NumberOfTasksSucceeded>long</NumberOfTasksSucceeded>
<TotalNumberOfTasks>long</TotalNumberOfTasks>
</ProgressSummary>
<Report>
<Bucket>string</Bucket>
<Enabled>boolean</Enabled>
<Format>string</Format>
<Prefix>string</Prefix>
<ReportScope>string</ReportScope>
</Report>
<RoleArn>string</RoleArn>
<Status>string</Status>
<StatusUpdateReason>string</StatusUpdateReason>
<SuspendedCause>string</SuspendedCause>
<SuspendedDate>timestamp</SuspendedDate>
<TerminationDate>timestamp</TerminationDate>
</Job>
</DescribeJobResult>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Required: Yes
Job (p. 81)
Contains the configuration parameters and status for the job specified in the Describe Job
request.
Errors
BadRequestException
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ListJobs
Service: AWS S3 Control
Lists current jobs and jobs that have ended within the last 30 days for the AWS account that is making
the request. The job list that is returned is sorted by creation date, with the newest job first.
Request Syntax
GET /v20180820/jobs?jobStatuses=JobStatuses&maxResults=MaxResults&nextToken=NextToken
HTTP/1.1
x-amz-account-id: AccountId
The List Jobs request returns jobs that match the statuses listed in this element. If you don't
provide jobStatuses, the API returns all jobs. You can specify one or more jobStatuses as
follows:
https://acct-id.s3-control.us-west-2.amazonaws.com/v20180820/jobs?
jobStatuses=Active&jobStatuses=Complete&maxResults=2
The maximum number of jobs that Amazon S3 includes in the List Jobs response. If the number
of jobs is higher than this number, the response includes a pagination token in the NextToken field
to enable you to retrieve the next page of results. The operation might return fewer results than
maxResults, but as long as the nextToken returned is not empty, there are more results that you
can fetch.
A pagination token to request the next page of results. Use the token that Amazon S3 returned in
the NextToken element of the ListJobsResult from the previous List Jobs request.
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<ListJobsResult>
<Jobs>
<JobListDescriptor>
<CreationTime>timestamp</CreationTime>
<Description>string</Description>
<JobId>string</JobId>
<Operation>string</Operation>
<Priority>integer</Priority>
<ProgressSummary>
<NumberOfTasksFailed>long</NumberOfTasksFailed>
<NumberOfTasksSucceeded>long</NumberOfTasksSucceeded>
<TotalNumberOfTasks>long</TotalNumberOfTasks>
</ProgressSummary>
<Status>string</Status>
<TerminationDate>timestamp</TerminationDate>
</JobListDescriptor>
</Jobs>
<NextToken>string</NextToken>
</ListJobsResult>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Required: Yes
Jobs (p. 84)
The list of current jobs and jobs that have ended within the last 30 days. This is the list of jobs that
match the job statuses specified in the request, if any.
If the List Jobs request produced more than the maximum number of results, you can pass this
value into a subsequent List Jobs request to retrieve the next page of results. As long as the
NextToken is not empty, there are more results you can fetch (regardless of the number of jobs that
the operation produces in comparison to maxResults specified in the request).
Type: String
Errors
InternalServiceException
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
UpdateJobStatus
Service: AWS S3 Control
Updates the status for the specified job. Use this operation to confirm that you want to run a job or to
cancel an existing job.
Request Syntax
POST /v20180820/jobs/id/status?
requestedJobStatus=RequestedJobStatus&statusUpdateReason=StatusUpdateReason HTTP/1.1
x-amz-account-id: AccountId
id (p. 87)
The status that you want to move the specified job to. You move the job to the Ready state to
confirm the job. Amazon S3 then makes the job eligible for execution. You move the job to the
Cancelled state to cancel a job. This is a required parameter.
A description of the reason why you want to change the specified job's status. This field can be any
string up to the maximum length.
The ID is required.
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<UpdateJobStatusResult>
<JobId>string</JobId>
<Status>string</Status>
<StatusUpdateReason>string</StatusUpdateReason>
</UpdateJobStatusResult>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Required: Yes
JobId (p. 87)
Type: String
Type: String
Type: String
Errors
BadRequestException
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
UpdateJobPriority
Service: AWS S3 Control
Request Syntax
POST /v20180820/jobs/id/priority?priority=Priority HTTP/1.1
x-amz-account-id: AccountId
id (p. 90)
The ID for the job whose priority you want to update. The id is required.
The priority that you want to assign to this job. The priority is required.
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<UpdateJobPriorityResult>
<JobId>string</JobId>
<Priority>integer</Priority>
</UpdateJobPriorityResult>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Required: Yes
JobId (p. 90)
Type: String
Type: Integer
Errors
BadRequestException
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Requests
Element Description
AccountId The account ID for the Amazon S3 account that is associated with the batch operations
job.
Type: String
FunctionArn The Amazon Resource Name (ARN) of the AWS Lambda function that you want to
invoke with a batch operations job.
Type: String
Default: None
LogType The type of log that you want Lambda to produce when invoked by a batch operations
job.
Type: String
The arguments that you want to pass to each invocation of a Lambda function by a
UserArguments
batch operations job.
Restrictions: The total length of arguments must be fewer than or equal to 20,480
characters
A container element used to specify the parameters of a batch operations Copy Object
S3CopyObjectAction
request.
Type: Container
Child Elements
TargetResource S3BucketArnString
AccessControlList S3AccessControlList
CannedAccessControlList
S3CannedAccessControlList
MetadataDirective S3MetadataDirective
TimeStamp
ModifiedSinceConstraint
NewObjectMetadata S3ObjectMetadata
Element Description
NewObjectTagging S3TagSet
RequesterPays Boolean
StorageClass S3StorageClass
TimeStamp
UnmodifiedSinceConstraint
The ARN of the Amazon S3 bucket that you want to use with a batch operations job.
TargetResource
Type: String
A container element that is used to specify the permission grants for an object copied
AccessControlList
as part of a batch operations job.
Type: Container
Child Elements
Type: Container
S3ObjectOwner
Child Elements
ID String Required
Maximum length is 1,024
characters
Element Description
Type: Container
Child Elements
Type: Container
Child Elements
Identifies the type of grantee that is used to grant permissions for an Amazon S3
S3GranteeTypeIdentifier
resource.
Type: String
Type: String
Type: String
S3MetadataDirective
Type: String
S3StorageClass
JobId The ID of the batch operations job that you want to perform an action on.
Type: String
Element Description
JobReport
Type: String
JobStatusUpdateReason
Child Elements
AccountId AccountId
Responses
Element Description
Type: Container
JobDescriptor
Child Elements
JobId JobId
Element Description
Status JobStatus
Manifest JobManifest
Action JobAction
Priority JobPriority
ProgressSummary JobProgressSummary
StatusUpdateReason JobStatusUpdateReason
FailureReasons JobFailureReasonList
Report JobReport
CreationTime JobCreationTime
TerminationTime JobTerminationTime
Type: Container
JobProgressSummary
Child Elements
Element Type
TotalNumberOfTasks Long
NumberOfTasksSucceeded Long
NumberOfTasksFailed Long
Type: List
JobFailureReasonList
Type: String
JobFailureReason
Element Description
JobAction A container element that is used to specify what action you want batch operations or
Amazon S3 public lockdown to perform.
Type: Container
Element Description
Child Elements
LambdaInvoke LambdaInvokeAction
S3CopyObject S3CopyObjectAction
S3SetObjectAcl S3SetObjectAclAction
S3SetObjectTagging
S3SetObjectTaggingAction
S3InitiateRestoreObject
S3InitiateRestoreObjectAction
Child Elements
Type: Container
JobManifestSpec
Child Elements
Valid values:
S3Foreman_CSV_20180820
|
S3InventoryReport_CSV_20161130
Element Description
Type: Container
JobManifestLocation
Child Elements
AccountId AccountId
Type: String
S3BucketArnString
Type: Container
S3AccessControlPolicy
Child Elements
Element Type
AccessControlList S3AccessControlList
CannedAccessControlList S3CannedAccessControlList
Type: Container
S3AccessControlList
Child Elements
Element Type
Owner S3ObjectOwner
Grants S3GrantList
Type: String
S3CannedAccessControlList
Element Description
Child Elements
Type: Container
S3ObjectMetadata
Child Elements
UserMetadata S3UserMetadata
HttpExpiresDate TimeStamp
RequesterCharged Boolean
Type: Map
S3UserMetadata
Restrictions: The total length of the key + value must be fewer than or equal to 8,192
characters
Actions
Action Description
A container element that is used to specify the AWS Lambda action that you want to
LambdaInvokeAction
invoke with a batch operations job.
Type: Container
Child Elements
S3CopyObjectA container element that is used to specify the parameters of a batch operations Copy
Object request.
Type: Container
Child Elements
AccessControlList S3AccessControlList
CannedAccessControlList
S3CannedAccessControlList
MetadataDirective S3MetadataDirective
TimeStamp
ModifiedSinceConstraint
NewObjectMetadata S3ObjectMetadata
NewObjectTagging S3TagSet
RequesterPays Boolean
StorageClass S3StorageClass
TimeStamp
UnmodifiedSinceConstraint
Type: Container
S3SetObjectAcl
Action Description
Child Elements
Type: Container
S3SetObjectTagging
Child Elements
TagSet S3TagSet
Type: Container
S3InitiateRestoreObject
Child Elements
Special Errors
Error Description
Type: Container
TooManyRequestsException
Type: Container
BadRequestException
Type: Container
IdempotencyException
Type: Container
InternalServiceException
Type: Container
NotFoundException
Type: Container
NoSuchAccount
Operations on Buckets
This section describes operations you can perform on Amazon S3 buckets.
Topics
• DELETE Bucket (p. 104)
• DELETE Bucket analytics (p. 106)
• DELETE Bucket cors (p. 108)
• DELETE Bucket encryption (p. 110)
• DELETE Bucket inventory (p. 112)
• DELETE Bucket lifecycle (p. 114)
• DELETE PublicAccessBlock (p. 115)
• DELETE Bucket metrics (p. 116)
• DELETE Bucket policy (p. 119)
• DELETE Bucket replication (p. 121)
• DELETE Bucket tagging (p. 123)
• DELETE Bucket website (p. 125)
• GET Bucket (List Objects) Version 2 (p. 127)
• GET Bucket accelerate (p. 146)
• GET Bucket acl (p. 149)
• GET Bucket analytics (p. 152)
• GET Bucket cors (p. 157)
• GET Bucket encryption (p. 161)
• GET Bucket Inventory (p. 165)
• GET Bucket lifecycle (p. 171)
• GET Bucket location (p. 178)
• GET PublicAccessBlock (p. 179)
• GET Bucket logging (p. 183)
• GET Bucket metrics (p. 186)
• GET Bucket notification (p. 190)
• GET Bucket object lock configuration (p. 195)
• GET BucketPolicyStatus (p. 195)
• GET Bucket Object versions (p. 198)
• GET Bucket policy (p. 210)
• GET Bucket replication (p. 212)
• GET Bucket requestPayment (p. 219)
• GET Bucket tagging (p. 221)
• GET Bucket versioning (p. 224)
• GET Bucket website (p. 227)
• HEAD Bucket (p. 229)
• List Bucket Analytics Configurations (p. 231)
• List Bucket Inventory Configurations (p. 235)
• List Bucket Metrics Configurations (p. 240)
• List Multipart Uploads (p. 243)
DELETE Bucket
Description
Deletes the bucket named in the URI. All objects (including all object versions and delete markers) in the
bucket must be deleted before the bucket itself can be deleted.
Requests
Syntax
DELETE / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request deletes the bucket named "quotes".
DELETE / HTTP/1.1
Host: quotes.s3.amazonaws.com
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: authorization string
Sample Response
HTTP/1.1 204 No Content
x-amz-id-2: JuKZqmXuiwFeDQxhD7M8KtsKobSzWA1QEjLbTMTagkKdBX2z7Il/jGhDeJ3j6s80
x-amz-request-id: 32FE2CEB32F5EE25
Date: Wed, 01 Mar 2006 12:00:00 GMT
Connection: close
Server: AmazonS3
Related Resources
• PUT Bucket (p. 252)
• DELETE Object (p. 364)
To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about Amazon S3 analytics feature, see Amazon S3 Analytics – Storage Class Analysis in
the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
DELETE /?analytics&id=analytics-configuration-ID HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of DELETE uses the parameter in the following table.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Sample Request
The following DELETE request deletes the analytics configuration with the ID list1.
Sample Response
The following successful response shows Amazon S3 returning a 204 No Content response. The
analytics configuration with the ID list1 for the bucket has been removed.
Related Resources
• GET Bucket analytics (p. 152)
• List Bucket Analytics Configurations (p. 231)
• PUT Bucket analytics (p. 267)
To use this operation, you must have permission to perform the s3:PutBucketCORS action. The bucket
owner has this permission by default and can grant this permission to others.
For information more about cors, go to Enabling Cross-Origin Resource Sharing in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
DELETE /?cors HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Example 1: Retrieve cors subresource
The following DELETE request deletes the cors subresource from the specified bucket. This action
removes cors configuration that is stored in the subresource.
Sample Request
Host: examplebucket.s3.amazonaws.com
Date: Tue, 13 Dec 2011 19:14:42 GMT
Authorization: signatureValue
Sample Response
Related Resources
• PUT Bucket cors (p. 273)
• DELETE Bucket cors (p. 108)
• OPTIONS object (p. 404)
To use this operation, you must have permissions to perform the s3:PutEncryptionConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
DELETE /?encryption HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Sample Request
The following DELETE request deletes default encryption from the bucket.
Host: examplebucket.s3.amazonaws.com
Date: Wed, 06 Sep 2017 12:00:00 GMT
Authorization: signatureValue
Sample Response
The following successful response shows Amazon S3 returning a 204 No Content response confirming
that default encryption has been removed from the bucket.
Related Resources
• GET Bucket encryption (p. 161)
• PUT Bucket encryption (p. 279)
To use this operation, you must have permissions to perform the s3:PutInventoryConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about the Amazon S3 inventory feature, see Amazon S3 Inventory in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
DELETE /?inventory&id=inventory-configuration-ID HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of DELETE uses the parameter in the following table.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Sample Request
The following DELETE request deletes the inventory configuration with the ID list1.
Sample Response
The following successful response shows Amazon S3 returning a 204 No Content response. The
inventory configuration with the ID list1 for the bucket has been removed.
Related Resources
• GET Bucket Inventory (p. 165)
• List Bucket Inventory Configurations (p. 235)
• PUT Bucket inventory (p. 283)
To use this operation, you must have permission to perform the s3:PutLifecycleConfiguration
action. By default, the bucket owner has this permission and the bucket owner can grant this permission
to others.
There is usually some time lag before lifecycle configuration deletion is fully propagated to all the
Amazon S3 systems.
For more information about the object expiration, go to Elements to Describe Lifecycle Actions in the
Amazon Simple Storage Service Developer Guide.
Requests
Syntax
DELETE /?lifecycle HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Sample Request
The following DELETE request deletes the lifecycle subresource from the specified bucket. This
removes lifecycle configuration stored in the subresource.
Sample Response
The following successful response shows Amazon S3 returning a 204 No Content response. Objects in
your bucket no longer expire.
Related Resources
• PUT Bucket lifecycle (p. 290)
• GET Bucket lifecycle (p. 171)
DELETE PublicAccessBlock
Description
This operation removes the PublicAccessBlock configuration for an Amazon S3 bucket. In order
to use this operation, you must have the s3:PutBucketPublicAccessBlock permission. For more
information about Amazon S3 permissions, see Specifying Permissions in a Policy in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
DELETE /<bucket-name>?publicAccessBlock HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
x-amz-date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization string> (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• GET PublicAccessBlock (p. 179)
• PUT PublicAccessBlock (p. 302)
• GET BucketPolicyStatus (p. 195)
• GET PublicAccessBlock (p. 69)
• PUT PublicAccessBlock (p. 72)
• DELETE PublicAccessBlock (p. 68)
To use this operation, you must have permissions to perform the s3:PutMetricsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about CloudWatch request metrics for Amazon S3, see Monitoring Metrics with Amazon
CloudWatch in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
DELETE /?metrics&id=Id HTTP/1.1
HOST: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
Request Headers
This operation uses only Request Headers common to most requests. For more information, see Common
Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
Delete the metric configuration with a specified ID, which disables the CloudWatch metrics with the
ExampleMetrics value for the FilterId dimension.
Authorization: signatureValue
Sample Response
Delete the metric configuration with a specified ID, which disables the CloudWatch metrics with the
ExampleMetrics value for the FilterId dimension.
Related Resources
• GET Bucket metrics (p. 186)
• PUT Bucket metrics (p. 310)
• List Bucket Metrics Configurations (p. 240)
• Monitoring Metrics with Amazon CloudWatch in the Amazon Simple Storage Service Developer Guide.
If you don't have DeleteBucketPolicy permissions, Amazon S3 returns a 403 Access Denied error.
If you have the correct permissions, but you're not using an identity that belongs to the bucket owner's
account, Amazon S3 returns a 405 Method Not Allowed error.
Important
As a security precaution, the root user of the AWS account that owns a bucket can always use
this operation, even if the policy explicitly denies the root user the ability to perform this action.
For more information about bucket policies, see Using Bucket Policies and User Policies in the Amazon
Simple Storage Service Developer Guide.
Requests
Syntax
DELETE /?policy HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
The response elements contain the status of the DELETE operation including the error code if the
request failed.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request deletes the bucket named BucketName.
Sample Response
HTTP/1.1 204 No Content
x-amz-id-2: Uuag1LuByRx9e6j5OnimrSAMPLEtRPfTaOFg==
x-amz-request-id: 656c76696e672SAMPLE5657374
Date: Tue, 04 Apr 2010 20:34:56 GMT
Connection: keep-alive
Server: AmazonS3
Related Resources
• PUT Bucket (p. 252)
• DELETE Object (p. 364)
To use this operation, you must have permissions to perform the s3:PutReplicationConfiguration
action. The bucket owner has these permissions by default and can grant it to others. For information
about permissions, see Permissions Related to Bucket Subresource Operations and Managing Access
Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service Developer Guide.
Note
It can take a while for the deletion of a replication configuration to fully propagate.
For information about replication configuration, see Cross-Region Replication in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
DELETE /?replication HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string
For more information about authorization, see Authenticating Requests (AWS Signature Version
4) (p. 14).
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
The following DELETE request deletes the replication subresource from the specified bucket. This
removes the replication configuration that is set for the bucket.
When the replication subresource has been deleted, Amazon S3 returns a 204 No Content
response. It will not replicate new objects that are stored in the examplebucket bucket.
Related Resources
• PUT Bucket replication (p. 327)
• GET Bucket replication (p. 212)
To use this operation, you must have permission to perform the s3:PutBucketTagging action. By
default, the bucket owner has this permission and can grant this permission to others.
Requests
Syntax
DELETE /?tagging HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Sample Request
The following DELETE request deletes the tag set from the specified bucket.
Sample Response
The following successful response shows Amazon S3 returning a 204 No Content response. The tag set
for the bucket has been removed.
Related Resources
• GET Bucket tagging (p. 221)
• PUT Bucket tagging (p. 338)
This DELETE operation requires the S3:DeleteBucketWebsite permission. By default, only the bucket
owner can delete the website configuration attached to a bucket. However, bucket owners can grant
other users permission to delete the website configuration by writing a bucket policy granting them the
S3:DeleteBucketWebsite permission.
For more information about hosting websites, go to Hosting Websites on Amazon S3 in the Amazon
Simple Storage Service Developer Guide .
Requests
Syntax
DELETE /?website HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Examples
Sample Request
This request deletes the website configuration on the specified bucket.
Sample Response
HTTP/1.1 204 No Content
x-amz-id-2: aws-s3integ-s3ws-31008.sea31.amazon.com
x-amz-request-id: AF1DD829D3B49707
Date: Thu, 03 Feb 2011 22:10:26 GMT
Server: AmazonS3
Related Resources
• GET Bucket website (p. 227)
• PUT Bucket website (p. 345)
To use this implementation of the operation, you must have READ access to the bucket.
To use this operation in an AWS Identity and Access Management (IAM) policy, you must have
permissions to perform the s3:ListBucket action. The bucket owner has this permission by default
and can grant this permission to others. For more information about permissions, see Permissions
Related to Bucket Operations and Managing Access Permissions to Your Amazon S3 Resources in the
Amazon Simple Storage Service Developer Guide.
Important
This section describes the latest revision of the API. We recommend that you use this
revised API, GET Bucket (List Objects) version 2, for application development. For backward
compatibility, Amazon S3 continues to support the prior version of this API, GET Bucket (List
Objects) version 1. For more information about the previous version, see GET Bucket (List
Objects) Version 1 (p. 137).
Note
To get a list of your buckets, see GET Service (p. 65).
Requests
Syntax
GET /?list-type=2 HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameters in the following table.
If you specify a prefix, all of the keys that contain the same string between
the prefix and the first occurrence of the delimiter after the prefix are
grouped under a single result element called CommonPrefixes. If you don't
specify the prefix parameter, the substring starts at the beginning of the
key. The keys that are grouped under the CommonPrefixes result element
are not returned elsewhere in the response.
Type: String
Default: None
encoding- Requests Amazon S3 to encode the response and specifies the encoding No
type method to use.
An object key can contain any Unicode character. However, XML 1.0 parsers
cannot parse some characters, such as characters with an ASCII value from
0 to 10. For characters that are not supported in XML 1.0, you can add this
parameter to request that Amazon S3 encode the keys in the response.
Type: String
Default: None
max-keys Sets the maximum number of keys returned in the response body. If you No
want to retrieve fewer than the default 1,000 keys, you can add this to your
request.
The response might contain fewer keys, but it never contains more. If there
are additional keys that satisfy the search criteria, but these keys were
not returned because max-keys was exceeded, the response contains
<IsTruncated>true</IsTruncated>. To return the additional keys, see
NextContinuationToken.
Type: String
Default: 1000
prefix Limits the response to keys that begin with the specified prefix. You can use No
prefixes to separate a bucket into different groupings of keys. (You can think
of using prefix to make groups in the same way you'd use a folder in a file
system.)
Type: String
Default: None
list- Version 2 of the API requires this parameter and you must set its value to 2. Yes
type
Type: String
When the response to this API call is truncated (that is, the IsTruncated
continuation- No
token response element value is true), the response also includes the
NextContinuationToken element. To list the next set of objects, you
can use the NextContinuationToken element in the next request as the
continuation-token.
Type: String
Default: None
fetch- By default, the API does not return the Owner information in the response. No
owner If you want the owner information in the response, you can specify this
parameter with the value set to true.
Type: String
Default: false
start- If you want the API to return key names after a specific object key in your No
after key space, you can add this parameter. Amazon S3 lists objects in UTF-8
character encoding in lexicographical order.
This parameter is valid only in your first request. If the response is truncated,
you can specify this parameter along with the continuation-token
parameter, and then Amazon S3 ignores this parameter.
Type: String
Default: None
Request Elements
This implementation of the operation does not use request elements.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Ancestor: ListBucketResult
CommonPrefixes All of the keys rolled up into a common prefix count as a single return
when calculating the number of returns. See MaxKeys.
Name Description
• CommonPrefixes lists keys that act like subdirectories in the
directory specified by Prefix.
For example, if the prefix is notes/ and the delimiter is a slash (/) as in
notes/summer/july, the common prefix is notes/summer/. All of
the keys that roll up into a common prefix count as a single return when
calculating the number of returns. See MaxKeys.
Type: String
Ancestor: ListBucketResult
Delimiter Causes keys that contain the same string between the prefix and the
first occurrence of the delimiter to be rolled up into a single result
element in the CommonPrefixes collection. These rolled-up keys are
not returned elsewhere in the response. Each rolled-up result counts as
only one return against the MaxKeys value.
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult.Contents.Owner
Encoding-Type Encoding type used by Amazon S3 to encode object key names in the
XML response.
Type: String
Ancestor: ListBucketResult
ETag The entity tag is an MD5 hash of the object. ETag reflects only changes
to the contents of an object, not its metadata.
Type: String
Ancestor: ListBucketResult.Contents
Name Description
Type: String
Ancestor: ListBucketResult.Contents.Owner
IsTruncated Set to false if all of the results were returned. Set to true if more
keys are available to return. If the number of results exceeds that
specified by MaxKeys, all of the results might not be returned.
Type: Boolean
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult.Contents
Type: Date
Ancestor: ListBucketResult.Contents
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
Type: String
Children: DisplayName, ID
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult.Contents
Name Description
Type: String
Ancestor: ListBucketResult.Contents
Type: String
Ancestor: ListBucketResult
KeyCount Returns the number of keys included in the response. The value is
always less than or equal to the MaxKeys value.
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
StartAfter If StartAfter was sent with the request, it is included in the response.
Type: String
Ancestor: ListBucketResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Listing Keys
This request returns the objects in BucketName. The request specifies the list-type parameter, which
indicates version 2 of the API.
Sample Request
Sample Response
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: gyB+3jRPnrkN98ZajxHXr3u7EFM67bNgSAxexeEHndCX/7GRnfTXxReKUQF28IfP
x-amz-request-id: 3B3C7C725673C630
Date: Sat, 30 Apr 2016 23:29:37 GMT
Content-Type: application/xml
Content-Length: length
Connection: close
Server: AmazonS3
<Key>ExampleObject.txt</Key>
<LastModified>2013-09-17T18:07:53.000Z</LastModified>
<ETag>"599bab3ed2c697f1d26842727561fd94"</ETag>
<Size>857</Size>
<StorageClass>REDUCED_REDUNDANCY</StorageClass>
</Contents>
</ListBucketResult>
sample.jpg
photos/2006/January/sample.jpg
photos/2006/February/sample2.jpg
photos/2006/February/sample3.jpg
photos/2006/February/sample4.jpg
The following GET request specifies the delimiter parameter with value /.
The key sample.jpg does not contain the delimiter character, and Amazon S3 returns it in the
Contents element in the response. However, all other keys contain the delimiter character. Amazon S3
groups these keys and returns a single CommonPrefixes element with the prefix value photos/. The
element is a substring that starts at the beginning of these keys and ends at the first occurrence of the
specified delimiter.
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>example-bucket</Name>
<Prefix></Prefix>
<KeyCount>2</KeyCount>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>sample.jpg</Key>
<LastModified>2011-02-26T01:56:20.000Z</LastModified>
<ETag>"bf1d737a4d46a19f3bced6905cc8b902"</ETag>
<Size>142863</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<CommonPrefixes>
<Prefix>photos/</Prefix>
</CommonPrefixes>
</ListBucketResult>
The following GET request specifies the delimiter parameter with value /, and the prefix parameter
with value photos/2006/.
Host: example-bucket.s3.amazonaws.com
x-amz-date: 20160501T000433Z
Authorization: authorization string
In response, Amazon S3 returns only the keys that start with the specified prefix. Further, it uses the
delimiter character to group keys that contain the same substring until the first occurrence of
the delimiter character after the specified prefix. For each such key group Amazon S3 returns one
CommonPrefixes element in the response. The keys grouped under this CommonPrefixes element
are not returned elsewhere in the response. The value returned in the CommonPrefixes element is
a substring that starts at the beginning of the key and ends at the first occurrence of the specified
delimiter after the prefix.
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>example-bucket</Name>
<Prefix>photos/2006/</Prefix>
<KeyCount>3</KeyCount>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>photos/2006/</Key>
<LastModified>2016-04-30T23:51:29.000Z</LastModified>
<ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
<Size>0</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<CommonPrefixes>
<Prefix>photos/2006/February/</Prefix>
</CommonPrefixes>
<CommonPrefixes>
<Prefix>photos/2006/January/</Prefix>
</CommonPrefixes>
</ListBucketResult>
HTTP/1.1 200 OK
x-amz-id-2: gyB+3jRPnrkN98ZajxHXr3u7EFM67bNgSAxexeEHndCX/7GRnfTXxReKUQF28IfP
x-amz-request-id: 3B3C7C725673C630
Date: Sat, 30 Apr 2016 23:29:37 GMT
Content-Type: application/xml
Content-Length: length
Connection: close
Server: AmazonS3
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>bucket</Name>
<Prefix></Prefix>
<NextContinuationToken>1ueGcxLPRx1Tr/XYExHnhbYLgveDs2J/wm36Hy4vbOwM=</
NextContinuationToken>
<KeyCount>1000</KeyCount>
<MaxKeys>1000</MaxKeys>
<IsTruncated>true</IsTruncated>
<Contents>
<Key>happyface.jpg</Key>
<LastModified>2014-11-21T19:40:05.000Z</LastModified>
<ETag>"70ee1738b6b21e2c8a43f3a5ab0eee71"</ETag>
<Size>11</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
...
</ListBucketResult>
Host: bucket.s3.amazonaws.com
Date: Mon, 02 May 2016 23:17:07 GMT
Authorization: authorization string
Amazon S3 returns a list of the next set of keys starting where the previous request ended.
HTTP/1.1 200 OK
x-amz-id-2: gyB+3jRPnrkN98ZajxHXr3u7EFM67bNgSAxexeEHndCX/7GRnfTXxReKUQF28IfP
x-amz-request-id: 3B3C7C725673C630
Date: Sat, 30 Apr 2016 23:29:37 GMT
Content-Type: application/xml
Content-Length: length
Connection: close
Server: AmazonS3
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>bucket</Name>
<Prefix></Prefix>
<ContinuationToken>1ueGcxLPRx1Tr/XYExHnhbYLgveDs2J/wm36Hy4vbOwM=</ContinuationToken>
<KeyCount>112</KeyCount>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>happyfacex.jpg</Key>
<LastModified>2014-11-21T19:40:05.000Z</LastModified>
<ETag>"70ee1738b6b21e2c8a43f3a5ab0eee71"</ETag>
<Size>1111</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
...
</ListBucketResult>
More Info
• GET Object (p. 370)
• PUT Object (p. 434)
• PUT Bucket (p. 252)
This implementation of the GET operation returns some or all (up to 1,000) of the objects in a bucket.
You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
A 200 OK response can contain valid or invalid XML. Be sure to design your application to parse the
contents of the response and handle it appropriately.
To use this implementation of the operation, you must have READ access to the bucket.
Note
To get a list of your buckets, see GET Service (p. 65).
Requests
Syntax
GET / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameters in the following table to return a subset of the objects
in a bucket.
If you specify a prefix, all keys that contain the same string between the
prefix and the first occurrence of the delimiter after the prefix are grouped
under a single result element called CommonPrefixes. If you don't specify
the prefix parameter, the substring starts at the beginning of the key. The
keys that are grouped under the CommonPrefixes result element are not
returned elsewhere in the response.
Type: String
Default: None
encoding- Requests Amazon S3 to encode the response and specifies the encoding No
type method to use.
An object key can contain any Unicode character. However, XML 1.0 parsers
cannot parse some characters, such as characters with an ASCII value from
Type: String
Default: None
marker Specifies the key to start with when listing objects in a bucket. Amazon S3 No
returns object keys in UTF-8 binary order, starting with key after the marker
in order.
Type: String
Default: None
max-keys Sets the maximum number of keys returned in the response body. If you No
want to retrieve fewer than the default 1,000 keys, you can add this to your
request.
The response might contain fewer keys, but it never contains more. If there
are additional keys that satisfy the search criteria, but these keys were
not returned because max-keys was exceeded, the response contains
<IsTruncated>true</IsTruncated>. To return the additional keys, see
marker.
Type: String
Default: 1,000
prefix Limits the response to keys that begin with the specified prefix. You can use No
prefixes to separate a bucket into different groupings of keys. (You can think
of using prefix to make groups in the same way you would use a folder in a
file system.)
Type: String
Default: None
Request Elements
This implementation of the operation does not use request elements.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Ancestor: ListBucketResult
CommonPrefixes All of the keys rolled up in a common prefix count as a single return
when calculating the number of returns. See MaxKeys.
For example, if the prefix is notes/ and the delimiter is a slash (/) as in
notes/summer/july, the common prefix is notes/summer/. All of
the keys that roll up into a common prefix count as a single return when
calculating the number of returns. See MaxKeys.
Type: String
Ancestor: ListBucketResult
Delimiter Causes keys that contain the same string between the prefix and the
first occurrence of the delimiter to be rolled up into a single result
element in the CommonPrefixes collection. These rolled-up keys are
not returned elsewhere in the response. Each rolled-up result counts as
only one return against the MaxKeys value.
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult.Contents.Owner
Encoding-Type Encoding type used by Amazon S3 to encode object key names in the
XML response.
Name Description
If you specify the encoding-type request parameter, Amazon S3
includes this element in the response, and returns encoded key name
values in the following response elements:
Type: String
Ancestor: ListBucketResult
ETag The entity tag is an MD5 hash of the object. The ETag reflects only
changes to the contents of an object, not its metadata.
Type: String
Ancestor: ListBucketResult.Contents
Type: String
Ancestor: ListBucketResult.Contents.Owner
IsTruncated Specifies whether (true) or not (false) all of the results were returned.
If the number of results exceeds that specified by MaxKeys, all of the
results might not be returned.
Type: Boolean
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult.Contents
Type: Date
Ancestor: ListBucketResult.Contents
Marker Indicates where in the bucket listing begins. Marker is included in the
response if it was sent with the request.
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
Name Description
Type: String
Ancestor: ListBucketResult
NextMarker When the response is truncated (that is, the IsTruncated element
value in the response is true), you can use the key name in this field as
a marker in the subsequent request to get next set of objects. Amazon
S3 lists objects in UTF-8 character encoding in lexicographical order.
Note
This element is returned only if you specify a delimiter
request parameter. If the response does not include the
NextMarker and it is truncated, you can use the value of the
last Key in the response as the marker in the subsequent
request to get the next set of object keys.
Type: String
Ancestor: ListBucketResult
Type: String
Children: DisplayName, ID
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult.Contents
Type: String
Ancestor: ListBucketResult.Contents
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request returns the objects in BucketName.
GET / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain
Sample Response
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: gyB+3jRPnrkN98ZajxHXr3u7EFM67bNgSAxexeEHndCX/7GRnfTXxReKUQF28IfP
x-amz-request-id: 3B3C7C725673C630
Date: Wed, 01 Mar 2006 12:00:00 GMT
Content-Type: application/xml
Content-Length: 302
Connection: close
Server: AmazonS3
sample.jpg
photos/2006/January/sample.jpg
photos/2006/February/sample2.jpg
photos/2006/February/sample3.jpg
photos/2006/February/sample4.jpg
The following GET request specifies the delimiter parameter with value /.
The key sample.jpg does not contain the delimiter character, and Amazon S3 returns it in the
Contents element in the response. However, all other keys contain the delimiter character. Amazon S3
groups these keys and returns a single CommonPrefixes element with prefix value photos/ that is a
substring from the beginning of these keys to the first occurrence of the specified delimiter.
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>example-bucket</Name>
<Prefix></Prefix>
<Marker></Marker>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>sample.jpg</Key>
<LastModified>2011-02-26T01:56:20.000Z</LastModified>
<ETag>"bf1d737a4d46a19f3bced6905cc8b902"</ETag>
<Size>142863</Size>
<Owner>
<ID>canonical-user-id</ID>
<DisplayName>display-name</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<CommonPrefixes>
<Prefix>photos/</Prefix>
</CommonPrefixes>
</ListBucketResult>
The following GET request specifies the delimiter parameter with the value /, and the prefix
parameter with the value photos/2006/.
In response, Amazon S3 returns only the keys that start with the specified prefix. It uses the
delimiter character to group keys that contain the same substring until the first occurrence of the
delimiter character after the specified prefix. For each such key group, Amazon S3 returns one
<CommonPrefixes> element in the response. The keys grouped under this CommonPrefixes element
are not returned elsewhere in the response. The value returned in the CommonPrefixes element is
a substring that starts at the beginning of the key and ends at the first occurrence of the specified
delimiter after the prefix.
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>example-bucket</Name>
<Prefix>photos/2006/</Prefix>
<Marker></Marker>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<CommonPrefixes>
<Prefix>photos/2006/February/</Prefix>
</CommonPrefixes>
<CommonPrefixes>
<Prefix>photos/2006/January/</Prefix>
</CommonPrefixes>
</ListBucketResult>
Related Resources
• GET Object (p. 370)
• PUT Object (p. 434)
To use this operation, you must have permission to perform the s3:GetAccelerateConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
You set the Transfer Acceleration state of an existing bucket to Enabled or Suspended by using the PUT
Bucket accelerate (p. 257) operation.
A GET accelerate request does not return a state value for a bucket that has no transfer acceleration
state. A bucket has no Transfer Acceleration state, if a state has never been set on the bucket.
• If the transfer acceleration state is set to Enabled on a bucket, the response is:
<AccelerateConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</AccelerateConfiguration>
• If the transfer acceleration state is set to Suspended on a bucket, the response is:
<AccelerateConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Suspended</Status>
</AccelerateConfiguration>
• If the transfer acceleration state on a bucket has never been set to Enabled or Suspended, the
response is:
<AccelerateConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/>
For more information on transfer acceleration, see Transfer Acceleration in the Amazon Simple Storage
Service Developer Guide.
Requests
Syntax
GET /?accelerate HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Name Description
Type: Container
Ancestor: None
Type: Enum
Ancestor: AccelerateConfiguration
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Retrieve the transfer acceleration configuration for a
bucket
The following example shows a GET /?accelerate request to retrieve the transfer acceleration state
of the bucket named examplebucket.
The following is a sample of the response body (only) that shows bucket transfer acceleration is enabled.
<AccelerateConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</AccelerateConfiguration>
Related Resources
• PUT Bucket accelerate (p. 257)
Requests
Syntax
GET /?acl HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Ancestry: AccessControlPolicy
Name Description
Type: Container
Ancestry: None
DisplayName Bucket owner's display name. This is returned only if the owner's e-mail
address (or the forum name, if configured) can be determined from the
ID.
Important
This value is only included in the response in the US East
(N. Virginia), US West (N. California), US West (Oregon), Asia
Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo),
EU (Ireland), and South America (São Paulo) regions.
For a list of all the Amazon S3 supported regions and
endpoints, see Regions and Endpoints in the AWS General
Reference.
Type: String
Ancestry: AccessControlPolicy.Owner
Type: Container
Ancestry: AccessControlPolicy.AccessControlList
Type: Container
Ancestry: AccessControlPolicy.AccessControlList.Grant
Type: String
Ancestry: AccessControlPolicy.Owner
Type: Container
Ancestry: AccessControlPolicy
Type: String
Ancestry: AccessControlPolicy.AccessControlList.Grant
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the ACL of the specified bucket.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
Content-Length: 124
Content-Type: text/plain
Connection: close
Server: AmazonS3
<AccessControlPolicy>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>CustomersName@amazon.com</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>CustomersName@amazon.com</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Related Resources
• GET Bucket Objects (p. 137)
To use this operation, you must have permissions to perform the s3:GetAnalyticsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about Amazon S3 analytics feature, see Amazon S3 Analytics – Storage Class Analysis in
the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?analytics&id=analytics-configuration-ID HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameter in the following table.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
The Examples section shows an example of an analytics configuration XML. The following table describes
the XML elements in the analytics configuration returned by the GET request.
Name Description
AnalyticsConfiguration Contains the configuration and any analyses for the analytics filter.
Type: Container
Ancestor: None
Type: String
Ancestor: Filter
Bucket The Amazon Resource Name (ARN) of the bucket where analytics results
are published.
Type: String
Ancestor: S3BucketDestination
BucketAccountId The ID of the account that owns the destination bucket where the
analytics results are published.
Type: String
Ancestor: S3BucketDestination
DataExport A container used to describe how data related to the storage class
analysis should be exported.
Type: Container
Ancestor: StorageClassAnalysis
Type: Container
Children: S3BucketDestination
Name Description
Ancestor: DataExport
Filter Specifies an analytics filter. The analytics only includes objects that meet
the filter's criteria.
Type: Container
Children: And
Ancestor: AnalyticsConfiguration
Format Specifies the output format of the analytics results. Currently, Amazon
S3 supports the comma-separated value (CSV) format.
Type: String
Ancestor: S3BucketDestination
Type: String
Ancestor: AnalyticsConfiguration
Type: String
Ancestor: Tag
OutputSchemaVersion The version of the output schema to use when exporting data. Must be
V_1.
Type: String
Ancestor: DataExport
Prefix The prefix that an object must have to be included in the analytics
results.
Type: String
Ancestor: And
Type: String
Ancestor: S3BucketDestination
Name Description
Type: Container
Children: DataExport
Ancestor: AnalyticsConfiguration
S3BucketDestination Contains the bucket ARN, file format, bucket owner (optional), and prefix
(optional) where analytics results are published.
Type: Container
Ancestor: Destination.
Type: Container
Ancestor: And
Type: String
Ancestor: Tag
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example: Configure an Analytics Report
The following GET request for the bucket examplebucket returns the inventory configuration with the
ID list1.
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A02
Related Resources
• DELETE Bucket analytics (p. 106)
• List Bucket Analytics Configurations (p. 231)
• PUT Bucket analytics (p. 267)
To use this operation, you must have permission to perform the s3:GetBucketCORS action. By default,
the bucket owner has this permission and can grant it to others.
To learn more cors, go to Enabling Cross-Origin Resource Sharing in the Amazon Simple Storage Service
Developer Guide.
Requests
Syntax
GET /?cors HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Name Description
Type: Container
Children: CORSRules
Name Description
Ancestor: None
CORSRule A set of origins and methods (cross-origin access that you want to
allow). You can add up to 100 rules to the configuration.
Type: Container
Ancestor: CORSConfiguration
Ancestor: CORSRule
Ancestor: CORSRule
AllowedOrigin One or more response headers that you want customers to be able
to access from their applications (for example, from a JavaScript
XMLHttpRequest object).
Type: String
Ancestor: CORSRule
ExposeHeader One or more headers in the response that you want customers to be
able to access from their applications (for example, from a JavaScript
XMLHttpRequest object).
Type: String
Ancestor: CORSRule
Name Description
Type: String
Ancestor: CORSRule
MaxAgeSeconds The time in seconds that your browser is to cache the preflight
response for the specified resource.
Ancestor: CORSRule
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Retrieve cors subresource
The following example gets the cors subresource of a bucket.
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: 0FmFIWsh/PpBuzZ0JFRC55ZGVmQW4SHJ7xVDqKwhEdJmf3q63RtrvH8ZuxW1Bol5
x-amz-request-id: 0CF038E9BCF63097
Date: Tue, 13 Dec 2011 19:14:42 GMT
Server: AmazonS3
Content-Length: 280
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://www.example.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSec>
<ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
</CORSRule>
</CORSConfiguration>
Related Resources
• PUT Bucket cors (p. 273)
• DELETE Bucket cors (p. 108)
• OPTIONS object (p. 404)
To use this operation, you must have permission to perform the s3:GetEncryptionConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
GET /?encryption HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Name Description
Name Description
side encryption by
default.
Type: Container
Children:
SSEAlgorithm,
KMSMasterKeyID
Ancestor: Rule
Type: String
Ancestor:
ApplyServerSideEncryptionByDefault
Constraint: Can
only be used when
you set the value
of SSEAlgorithm
as aws:kms. The
default aws/s3 AWS
KMS master key is
used if this element
is absent while the
SSEAlgorithm is
aws:kms.
Type: Container
Children:
ApplyServerSideEncryptionByDefault
Ancestor:
ServerSideEncryptionConfiguration
Type: Container
Children: Rule
Ancestor: None
Name Description
Type: String
Valid Values:
AES256, aws:kms
Ancestor:
ApplyServerSideEncryptionByDefault
Constraint: Can
only be used
when you use
ApplyServerSideEncryptionByDefault.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Retrieve the Encryption Configuration for an S3
Bucket
The following example shows a GET /?encryption request.
HTTP/1.1 200 OK
x-amz-id-2: kDmqsuw5FDmgLmxQaUkd9A4NJ/PIiE0c1rAU/ue2Yp60toXs4I5k5fqlwZsA6fV+wJQCzRRwygQ=
x-amz-request-id: 5D8706FCB2673B7D
Date: Wed, 06 Sep 2017 12:00:00 GMT
Transfer-Encoding: chunked
Server: AmazonS3
<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ApplyServerSideEncryptionByDefault>
<SSEAlgorithm>aws:kms</SSEAlgorithm>
<KMSMasterKeyID>arn:aws:kms:us-east-1:1234/5678example</KMSMasterKeyID>
</ApplyServerSideEncryptionByDefault>
</Rule>
</ServerSideEncryptionConfiguration>
Related Resources
• PUT Bucket encryption (p. 279)
• DELETE Bucket encryption (p. 110)
To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration
action. The bucket owner has this permission by default and can grant this permission to others. For
more information about permissions, see Permissions Related to Bucket Subresource Operations and
Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service
Developer Guide.
For information about the Amazon S3 inventory feature, see Amazon S3 Inventory in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
GET /?inventory&id=inventory-configuration-ID HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameter in the following table.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
The Examples section shows an example of an inventory configuration XML. The following table
describes the XML elements in the inventory configuration returned by the GET request.
Name Description
AccountId The ID of the account that owns the destination bucket where the
inventory is published.
Type: String
Ancestor: S3BucketDestination
Bucket The Amazon Resource Name (ARN) of the bucket where inventory results
are published.
Type: String
Ancestor: S3BucketDestination
Type: Container
Children: S3BucketDestination
Ancestor: InventoryConfiguration
Type: Container
Ancestor: S3BucketDestination
Field Contains the optional fields that are included in the inventory results.
Multiple Field elements can be contained in OptionalFields.
Type: String
Ancestor: OptionalFields
Name Description
Filter Specifies an inventory filter. The inventory only includes objects that
meet the filter's criteria.
Type: Container
Children: Prefix
Ancestor: InventoryConfiguration
Format Specifies the output format of the inventory results. Currently, Amazon
S3 supports the comma-separated values (CSV) format, the Apache
optimized row columnar (ORC) format, and the Apache Parquet
(Parquet) format.
Type: String
Ancestor: S3BucketDestination
Type: String
Ancestor: Schedule
Type: String
Ancestor: InventoryConfiguration
IncludedObjectVersions Object versions to include in the inventory list. If set to All, the list
includes all the object versions, which adds the version-related fields
VersionId, IsLatest, and DeleteMarker to the list. If set to
Current, the list does not contain these version-related fields.
Type: String
Ancestor: InventoryConfiguration
Type: Container
Ancestor: None
Name Description
Type: String
Ancestor: InventoryConfiguration
KeyId The AWS KMS customer master key (CMK) used to encrypt the inventory
file.
Type: String
Ancestor: SSE-KMS
Type: Container
Children: Field
Ancestor: InventoryConfiguration
Prefix The prefix that an object must have to be included in the inventory
results.
Type: String
Ancestor:Filter
Type: String
Ancestor: S3BucketDestination
Type: Container
Children: Frequency
Ancestor: Destination.
Type: Container
Children: KeyId
Ancestor: Encryption
Name Description
Type: Container
Ancestor: Encryption
S3BucketDestination Contains the bucket ARN, file format, bucket owner (optional), prefix
where inventory results are published (optional), and the type of server-
side encryption that is used to encrypt the file (optional).
Type: Container
Ancestor: Destination.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example: Configure an Inventory Report
The following GET request for the bucket examplebucket returns the inventory configuration with the
ID list1.
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A02
Date: Mon, 31 Oct 2016 12:00:00 GMT
Server: AmazonS3
Content-Length: length
</S3BucketDestination>
</Destination>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<Filter>
<Prefix>myprefix/</Prefix>
</Filter>
<IncludedObjectVersions>All</IncludedObjectVersions>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>StorageClass</Field>
<Field>IsMultipartUploaded</Field>
<Field>ReplicationStatus</Field>
<Field>ObjectLockRetainUntilDate</Field>
<Field>ObjectLockMode</Field>
<Field>ObjectLockLegalHoldStatus</Field>
</OptionalFields>
</InventoryConfiguration>
Related Resources
• DELETE Bucket inventory (p. 112)
• List Bucket Inventory Configurations (p. 235)
• PUT Bucket inventory (p. 283)
Returns the lifecycle configuration information set on the bucket. For information about lifecycle
configuration, go to Object Lifecycle Management in the Amazon Simple Storage Service Developer Guide.
To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration
action. The bucket owner has this permission, by default. The bucket owner can grant this permission to
others. For more information about permissions, see Managing Access Permissions to Your Amazon S3
Resources in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?lifecycle HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Name Description
Type: Container
Ancestor: Filter
Child: DaysAfterInitiation
Type: Container
Ancestor: Rule
Date Date when you want Amazon S3 to take the action. For
more information, see Lifecycle Rules: Based on a Specific
Date in the Amazon Simple Storage Service Developer
Guide.
Type: String
Ancestor: AbortIncompleteMultipartUpload
Name Description
• Otherwise, if your bucket is versioning-enabled (or
versioning is suspended), the action applies only to the
current version of the object. Buckets with versioning-
enabled or versioning-suspended can have many
versions of the same object, one current version, and
zero or more noncurrent versions.
Type: Container
Ancestor: Rule
Child: Prefix, Tag, or And (if both prefix and tag are
specified)
Type: String
Ancestor: Rule
Type: String
Ancestor: Rule
Type: String
Ancestor: Tag
Name Description
LifecycleConfiguration Container for lifecycle rules. You can add as many as 1000
rules.
Type: Container
Children: Rule
Ancestor: None
Type: String
Ancestor: Expiration
Ancestor: NoncurrentVersionExpiration or
NoncurrentVersionTransition
Type: Container
Children: NoncurrentDays
Ancestor: Rule
Name Description
Type: Container
Ancestor: Rule
Type: String
Type: Container
Ancestor: LifecycleConfiguration
Type: String
Ancestor: Rule
Type: String
Tag Container listing the tag key and value used to filter
objects to which the rule applies.
Type: String
Ancestor: Filter
Name Description
Type: Container
Ancestor: Rule
Type: String
Ancestor: Tag
Special Errors
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Retrieve the Lifecycle Subresource
This example is a GET request to retrieve the lifecycle subresource from the specified bucket. The
example response returns the lifecycle configuration.
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4RyTmXa3rPi4hklTXouTf0hccUjo0iCPjz6FnfIutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991C342C575321
Date: Thu, 15 Nov 2012 00:17:23 GMT
Server: AmazonS3
Content-Length: 358
Related Resources
• PUT Bucket lifecycle (p. 290)
• DELETE Bucket lifecycle (p. 114)
To use this operation in an AWS Identity and Access Management (IAM) policy, you must have
permissions to perform the s3:ListBucket action. The bucket owner has this permission by default
and can grant this permission to others. For more information about permissions, see Permissions
Related to Bucket Operations and Managing Access Permissions to Your Amazon S3 Resources in the
Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?location HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Type: String
Name Description
Valid Values: For a list of all the Amazon S3 supported location constraints
by region, see Regions and Endpoints in the AWS General Reference.
Ancestry: None
When the bucket's region is US East (N. Virginia), Amazon S3 returns an empty string for the bucket's
region:
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/>
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the region of the specified bucket.
Sample Response
Related Resources
• GET Bucket Objects (p. 137)
• PUT Bucket (p. 252)
GET PublicAccessBlock
Description
This operation retrieves the PublicAccessBlock configuration for an Amazon S3 bucket. In order
to use this operation, you must have the s3:GetBucketPublicAccessBlock permission. For more
information about Amazon S3 permissions, see Specifying Permissions in a Policy in the Amazon Simple
Storage Service Developer Guide.
Important
When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it
checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains
the object) and the bucket owner's account. If the PublicAccessBlock settings are different
between the bucket and the account, Amazon S3 uses the most restrictive combination of the
bucket-level and account-level settings.
For more information about when Amazon S3 considers a bucket or an object public, see The Meaning of
"Public" in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /<bucket-name>?publicAccessBlock HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
x-amz-date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization string> (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
Name Description
A PublicAccessBlock configuration.
PublicAccessBlockConfiguration
Type: Container
Ancestor: None
BlockPublicAcls Specifies whether Amazon S3 will block public access control lists (ACLs) for this
bucket and objects in this bucket.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Name Description
IgnorePublicAcls Specifies whether Amazon S3 will ignore public ACLs for this bucket and objects
in this bucket.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
BlockPublicPolicy Specifies whether Amazon S3 will block public bucket policies for this bucket.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Specifies whether Amazon S3 will restrict public bucket policies for this bucket.
RestrictPublicBuckets
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request gets a bucket PublicAccessBlock configuration.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 0
<PublicAccessBlockConfiguration>
<BlockPublicAcls>TRUE</BlockPublicAcls>
<IgnorePublicAcls>FALSE</IgnorePublicAcls>
<BlockPublicPolicy>FALSE</BlockPublicPolicy>
<RestrictPublicBuckets>FALSE</RestrictPublicBuckets>
</PublicAccessBlockConfiguration>
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• PUT PublicAccessBlock (p. 302)
• DELETE PublicAccessBlock (p. 115)
• GET BucketPolicyStatus (p. 195)
• GET PublicAccessBlock (p. 69)
• PUT PublicAccessBlock (p. 72)
• DELETE PublicAccessBlock (p. 68)
Description
This implementation of the GET operation uses the logging subresource to return the logging status
of a bucket and the permissions users have to view and modify that status. To use GET, you must be the
bucket owner.
Requests
Syntax
GET /?logging HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Ancestry: None
EmailAddress E-mail address of the person whose logging permissions are displayed.
Name Description
Type: String
Ancestry:
BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant.Grantee
Type: Container
Ancestry: BucketLoggingStatus.LoggingEnabled.TargetGrants
Type: Container
Ancestry: BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant
LoggingEnabled Container for logging information. This element and its children are
present when logging is enabled, otherwise, this element and its children
are absent.
Type: Container
Ancestry: BucketLoggingStatus
Type: String
Ancestry: BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant
TargetBucket Specifies the bucket whose logging status is being returned. This
element specifies the bucket where server access logs will be delivered.
Type: String
Ancestry: BucketLoggingStatus.LoggingEnabled
Type: Container
Ancestry: BucketLoggingStatus.LoggingEnabled
TargetPrefix Specifies the prefix for the keys that the log files are being stored under.
Type: String
Ancestry: BucketLoggingStatus.LoggingEnabled
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the logging status for mybucket.
Related Resources
• PUT Bucket (p. 252)
• PUT Bucket logging (p. 306)
To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about CloudWatch request metrics for Amazon S3, see Monitoring Metrics with Amazon
CloudWatch in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?metrics&id=id HTTP/1.1
Host: BucketName.s3.amazonaws.com
x-amz-date: Thu, 15 Nov 2016 00:17:21 GMT
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
The Examples section shows an example of a metrics configuration XML. The following table describes
the XML elements in the metrics configuration returned by the GET request.
Name Description
Type: Container
Ancestor: Filter
Type: Container
Children: And
Ancestor: MetricsConfiguration
Type: String
Ancestor: MetricsConfiguration
Type: String
Ancestor: Tag
Type: Container
Children: Filter, Id
Ancestor: None
Type: String
Ancestor: And
Type: Container
Ancestor: And
Type: String
Name Description
Ancestor: Tag
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
First Sample Request
Retrieve a metrics configuration that filters metrics based on a specified prefix.
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 180
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 480
Related Resources
• PUT Bucket metrics (p. 310)
• DELETE Bucket metrics (p. 116)
• List Bucket Metrics Configurations (p. 240)
• Monitoring Metrics with Amazon CloudWatch in the Amazon Simple Storage Service Developer Guide.
If notifications are not enabled on the bucket, the operation returns an empty
NotificationConfiguration element.
By default, you must be the bucket owner to read the notification configuration of a bucket. However,
the bucket owner can use a bucket policy to grant permission to other users to read this configuration
with the s3:GetBucketNotification permission.
For more information about setting and reading the notification configuration on a bucket, see Setting
Up Notification of Bucket Events. For more information about bucket policies, see Using Bucket Policies.
Requests
Syntax
GET /?notification HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Name Description
Type: String
Ancestry: CloudFunctionConfiguration
Type: Container
Ancestry: NotificationConfiguration
Type: String
Type: Container
Children: S3Key
Ancestor: TopicConfiguration,
QueueConfiguration, or
CloudFunctionConfiguration.
FilterRule Container for key value pair that defines the criteria
for the filter rule.
Container S3Key
Type: Container
Ancestor: S3Key
Name Description
Type: String
Type: String
Ancestor: FilterRule
Type: Container
Ancestry: None
Type: String
Ancestry: TopicConfiguration
Type: Container
Ancestry: NotificationConfiguration
Name Description
Type: Container
Ancestor: Filter
Type: String
Ancestry: TopicConfiguration
Type: Container
Ancestry: NotificationConfiguration
Type: String
Ancestor: FilterRule
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request returns the notification configuration on the bucket quotes.s3.amazonaws.com.
Sample Response
This response returns that the notification configuration for the specified bucket.
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A02
Date: Wed, 15 Oct 2014 16:59:04 GMT
Server: AmazonS3
<?xml version="1.0" encoding="UTF-8"?>
<NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<TopicConfiguration>
<Id>YjVkM2Y0YmUtNGI3NC00ZjQyLWEwNGItNDIyYWUxY2I0N2M4</Id>
<Topic>arn:aws:sns:us-east-1:account-id:s3notificationtopic2</Topic>
<Event>s3:ReducedRedundancyLostObject</Event>
<Event>s3:ObjectCreated:*</Event>
</TopicConfiguration>
</NotificationConfiguration>
Related Resources
• PUT Bucket notification (p. 315)
Gets the Object Lock configuration for a bucket. The rule specified in the Object Lock configuration will
be applied by default to every new object placed in the specified bucket.
Request Syntax
GET /?object-lock HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
Date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization-string> (see Authenticating Requests (AWS Signature Version
4))
Request Body
The request does not have a request body.
Response Syntax
<ObjectLockConfiguration>
<ObjectLockEnabled>string</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>string</Mode>
<Years>integer</Years>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
For more information about the response elements that this operation returns, see
ObjectLockConfiguration (p. 544).
Related Resources
Locking Objects in the Amazon Simple Storage Service Developer Guide.
GET BucketPolicyStatus
Description
This operation retrieves the policy status for an Amazon S3 bucket, indicating whether the bucket is
public. In order to use this operation, you must have the s3:GetBucketPolicyStatus permission. For
more information about Amazon S3 permissions, see Specifying Permissions in a Policy in the Amazon
Simple Storage Service Developer Guide.
For more information about when Amazon S3 considers a bucket public, see The Meaning of "Public" in
the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /<bucket-name>?policyStatus HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
x-amz-date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization string> (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Children: IsPublic
IsPublic Indicates whether this bucket currently has a public access policy.
Type: Boolean
Ancestor: PolicyStatus
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request gets a bucket policy status.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 0
<PolicyStatus>
<IsPublic>TRUE</IsPublic>
</PolicyStatus>
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• GET PublicAccessBlock (p. 179)
• PUT PublicAccessBlock (p. 302)
• DELETE PublicAccessBlock (p. 115)
• GET PublicAccessBlock (p. 69)
• PUT PublicAccessBlock (p. 72)
• DELETE PublicAccessBlock (p. 68)
To use this operation, you must have READ access to the bucket.
Requests
Syntax
GET /?versions HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameters in the following table to return a subset of the objects
in a bucket.
delimiter A delimiter is a character that you specify to group keys. All keys No
that contain the same string between the prefix and the first
occurrence of the delimiter are grouped under a single result
element in CommonPrefixes. These groups are counted as
one result against the max-keys limitation. These keys are not
returned elsewhere in the response. Also, see prefix.
Type: String
Default: None
Type: String
Default: None
key-marker Specifies the key in the bucket that you want to start listing from. No
Also, see version-id-marker.
Type: String
Default: None
max-keys Sets the maximum number of keys returned in the response body. No
The response might contain fewer keys, but will never contain
more. If additional keys satisfy the search criteria, but were not
returned because max-keys was exceeded, the response contains
<isTruncated>true</isTruncated>. To return the additional
keys, see key-marker and version-id-marker.
Type: String
Default: 1000
prefix Use this parameter to select only those keys that begin with the No
specified prefix. You can use prefixes to separate a bucket into
different groupings of keys. (You can think of using prefix to
make groups in the same way you'd use a folder in a file system.)
You can use prefix with delimiter to roll up numerous
objects into a single result under CommonPrefixes. Also, see
delimiter.
Type: String
Default: None
version-id- Specifies the object version you want to start listing from. Also, No
marker see key-marker.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Ancestor: ListVersionsResult
Type: String
Ancestor: ListVersionsResult.Version.Owner |
ListVersionsResult.DeleteMarker.Owner
Encoding-Type Encoding type used by Amazon S3 to encode object key names in the
XML response.
Type: String
Ancestor: ListBucketResult
ETag The entity tag is an MD5 hash of the object. The ETag only reflects
changes to the contents of an object, not its metadata.
Type: String
Ancestor: ListVersionsResult.Version
Type: String
Ancestor: ListVersionsResult.Version.Owner |
ListVersionsResult.DeleteMarker.Owner
IsLatest Specifies whether the object is (true) or is not (false) the current
version of an object.
Type: Boolean
Name Description
Valid Values: true | false
IsTruncated A flag that indicates whether (true) or not (false) Amazon S3 returned
all of the results that satisfied the search criteria. If your results were
truncated, you can make a follow-up paginated request using the
NextKeyMarker and NextVersionIdMarker response parameters as
a starting place in another request to return the rest of the results.
Type: Boolean
Ancestor: ListVersionsResult
Type: String
Type: String
Ancestor: ListVersionsResult
Type: Date
Type: Container
Ancestor: ListVersionsResult
Type: String
Default: 1000
Ancestor: ListVersionsResult
Type: String
Ancestor: ListVersionsResult
Name Description
Type: String
Ancestor: ListVersionsResult
Type: String
Ancestor: ListVersionsResult
Type: String
Children: DisplayName, ID
Prefix Selects objects that start with the value supplied by this parameter.
Type: String
Ancestor: ListVersionsResult
Type: String
Ancestor: ListVersionsResult.Version
Type: String
Ancestor: ListVersionsResult.Version
Type: Container
Ancestor: ListVersionsResult
Type: String
Name Description
VersionIdMarker Marks the last version of the Key returned in a truncated response.
Type: String
Ancestor: ListVersionsResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns all of the versions of all of the objects in the specified bucket.
<ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Name>bucket</Name>
<Prefix>my</Prefix>
<KeyMarker/>
<VersionIdMarker/>
<MaxKeys>5</MaxKeys>
<IsTruncated>false</IsTruncated>
<Version>
<Key>my-image.jpg</Key>
<VersionId>3/L4kqtJl40Nr8X8gdRQBpUMLUo</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-10-12T17:50:30.000Z</LastModified>
<ETag>"fba9dede5f27731c9771645a39863328"</ETag>
<Size>434234</Size>
<StorageClass>STANDARD</StorageClass>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
</Version>
<DeleteMarker>
<Key>my-second-image.jpg</Key>
<VersionId>03jpff543dhffds434rfdsFDN943fdsFkdmqnh892</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-11-12T17:50:30.000Z</LastModified>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
</DeleteMarker>
<Version>
<Key>my-second-image.jpg</Key>
<VersionId>QUpfdndhfd8438MNFDN93jdnJFkdmqnh893</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-10-10T17:50:30.000Z</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
<Size>166434</Size>
<StorageClass>STANDARD</StorageClass>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
</Version>
<DeleteMarker>
<Key>my-third-image.jpg</Key>
<VersionId>03jpff543dhffds434rfdsFDN943fdsFkdmqnh892</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-10-15T17:50:30.000Z</LastModified>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
</DeleteMarker>
<Version>
<Key>my-third-image.jpg</Key>
<VersionId>UIORUnfndfhnw89493jJFJ</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-10-11T12:50:30.000Z</LastModified>
<ETag>"772cf535f27731c974343645a3985328"</ETag>
<Size>64</Size>
<StorageClass>STANDARD</StorageClass>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
</Version>
</ListVersionsResult>
Sample Request
The following request returns objects in the order they were stored, returning the most recently stored
object first starting with the value for key-marker.
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>mtp-versioning-fresh</Name>
<Prefix/>
<KeyMarker>key2</KeyMarker>
<VersionIdMarker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<Version>
<Key>key3</Key>
<VersionId>I5VhmK6CDDdQ5Pwfe1gcHZWmHDpcv7gfmfc29UBxsKU.</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-12-09T00:19:04.000Z</LastModified>
<ETag>"396fefef536d5ce46c7537ecf978a360"</ETag>
<Size>217</Size>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
<DeleteMarker>
<Key>sourcekey</Key>
<VersionId>qDhprLU80sAlCFLu2DWgXAEDgKzWarn-HS_JU0TvYqs.</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-12-10T16:38:11.000Z</LastModified>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
</DeleteMarker>
<Version>
<Key>sourcekey</Key>
<VersionId>wxxQ7ezLaL5JN2Sislq66Syxxo0k7uHTUpb9qiiMxNg.</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-12-10T16:37:44.000Z</LastModified>
<ETag>"396fefef536d5ce46c7537ecf978a360"</ETag>
<Size>217</Size>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
</ListVersionsResult>
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>mtp-versioning-fresh</Name>
<Prefix>source</Prefix>
<KeyMarker/>
<VersionIdMarker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<DeleteMarker>
<Key>sourcekey</Key>
<VersionId>qDhprLU80sAlCFLu2DWgXAEDgKzWarn-HS_JU0TvYqs.</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-12-10T16:38:11.000Z</LastModified>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
</DeleteMarker>
<Version>
<Key>sourcekey</Key>
<VersionId>wxxQ7ezLaL5JN2Sislq66Syxxo0k7uHTUpb9qiiMxNg.</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-12-10T16:37:44.000Z</LastModified>
<ETag>"396fefef536d5ce46c7537ecf978a360"</ETag>
<Size>217</Size>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
</ListVersionsResult>
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>mtp-versioning-fresh</Name>
<Prefix/>
<KeyMarker>key3</KeyMarker>
<VersionIdMarker>t46ZenlYTZBnj</VersionIdMarker>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<DeleteMarker>
<Key>sourcekey</Key>
<VersionId>qDhprLU80sAlCFLu2DWgXAEDgKzWarn-HS_JU0TvYqs.</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2009-12-10T16:38:11.000Z</LastModified>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
</DeleteMarker>
<Version>
<Key>sourcekey</Key>
<VersionId>wxxQ7ezLaL5JN2Sislq66Syxxo0k7uHTUpb9qiiMxNg.</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-12-10T16:37:44.000Z</LastModified>
<ETag>"396fefef536d5ce46c7537ecf978a360"</ETag>
<Size>217</Size>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
</ListVersionsResult>
GET /?versions&key-marker=key3&version-id-marker=t46Z0menlYTZBnj&max-keys=3
Host: bucket.s3.amazonaws.com
Date: Wed, 28 Oct 2009 22:32:00 +0000
Authorization: authorization string
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>mtp-versioning-fresh</Name>
<Prefix/>
<KeyMarker>key3</KeyMarker>
<VersionIdMarker>null</VersionIdMarker>
<NextKeyMarker>key3</NextKeyMarker>
<NextVersionIdMarker>d-d309mfjFrUmoQ0DBsVqmcMV15OI.</NextVersionIdMarker>
<MaxKeys>3</MaxKeys>
<IsTruncated>true</IsTruncated>
<Version>
<Key>key3</Key>
<VersionId>8XECiENpj8pydEDJdd-_VRrvaGKAHOaGMNW7tg6UViI.</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-12-09T00:18:23.000Z</LastModified>
<ETag>"396fefef536d5ce46c7537ecf978a360"</ETag>
<Size>217</Size>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
<Version>
<Key>key3</Key>
<VersionId>d-d309mfjFri40QYukDozqBt3UmoQ0DBsVqmcMV15OI.</VersionId>
<IsLatest>false</IsLatest>
<LastModified>2009-12-09T00:18:08.000Z</LastModified>
<ETag>"396fefef536d5ce46c7537ecf978a360"</ETag>
<Size>217</Size>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
</ListVersionsResult>
photos/2006/January/sample.jpg
photos/2006/February/sample.jpg
photos/2006/March/sample.jpg
videos/2006/March/sample.wmv
sample.jpg
The following GET versions request specifies the delimiter parameter with value "/".
The list of keys from the specified bucket are shown in the following response.
The response returns the sample.jpg key in a <Version> element. However, because all the other keys
contain the specified delimiter, a distinct substring, from the beginning of the key to the first occurrence
of the delimiter, from each of these keys is returned in a <CommonPrefixes> element. The key substrings,
photos/ and videos/, in the <CommonPrefixes> element indicate that there are one or more keys with
these key prefixes.
This is a useful scenario if you use key prefixes for your objects to create a logical folder like structure. In
this case you can interpret the result as the folders photos/ and videos/ have one or more objects.
<ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>mvbucketwithversionon1</Name>
<Prefix></Prefix>
<KeyMarker></KeyMarker>
<VersionIdMarker></VersionIdMarker>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Version>
<Key>Sample.jpg</Key>
<VersionId>toxMzQlBsGyGCz1YuMWMp90cdXLzqOCH</VersionId>
<IsLatest>true</IsLatest>
<LastModified>2011-02-02T18:46:20.000Z</LastModified>
<ETag>"3305f2cfc46c0f04559748bb039d69ae"</ETag>
<Size>3191</Size>
<Owner>
<ID>852b113e7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc</ID>
<DisplayName>display-name</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Version>
<CommonPrefixes>
<Prefix>photos/</Prefix>
</CommonPrefixes>
<CommonPrefixes>
<Prefix>videos/</Prefix>
</CommonPrefixes>
</ListVersionsResult>
In addition to the delimiter parameter you can filter results by adding a prefix parameter as shown in
the following request.
In this case the response will include only objects keys that start with the specified prefix. The value
returned in the <CommonPrefixes> element is a substring from the beginning of the key to the first
occurrence of the specified delimiter after the prefix.
Related Resources
• GET Bucket Objects (p. 137)
• GET Object (p. 370)
• PUT Object (p. 434)
• DELETE Object (p. 364)
If you don't have GetBucketPolicy permissions, Amazon S3 returns a 403 Access Denied error. If
you have the correct permissions, but you're not using an identity that belongs to the bucket owner's
account, Amazon S3 returns a 405 Method Not Allowed error.
Important
As a security precaution, the root user of the AWS account that owns a bucket can always use
this operation, even if the policy explicitly denies the root user the ability to perform this action.
For more information about bucket policies, see Using Bucket Policies and User Policies in the Amazon
Simple Storage Service Developer Guide.
Requests
Syntax
GET /?policy HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
The response contains the (JSON) policy of the specified bucket.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the policy of the specified bucket.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByru9pO4SAMPLEAtRPfTaOFg==
x-amz-request-id: 656c76696e67SAMPLE57374
Date: Tue, 04 Apr 2010 20:34:56 GMT
Connection: keep-alive
Server: AmazonS3
{
"Version":"2008-10-17",
"Id":"aaaa-bbbb-cccc-dddd",
"Statement" : [
{
"Effect":"Deny",
"Sid":"1",
"Principal" : {
"AWS":["111122223333","444455556666"]
},
"Action":["s3:*"],
"Resource":"arn:aws:s3:::bucket/*"
}
]
}
Related Resources
• GET Bucket Objects (p. 137)
For information about replication configuration, see Cross-Region Replication (CRR) in the Amazon
Simple Storage Service Developer Guide.
This operation requires permissions for the s3:GetReplicationConfiguration action. For more
information about permissions, see Using Bucket Policies and User Policies in the Amazon Simple Storage
Service Developer Guide.
Requests
Syntax
GET /?replication HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string
For more information about authorization, see Authenticating Requests (AWS Signature Version
4) (p. 14).
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Element Description
Type: Container
Children: Rule
Ancestor: None
Type: Container
Ancestor: ReplicationConfiguration
Type: String
Ancestor: Rule
Type: String
Ancestor: Rule
Type: String
Ancestor: Rule
Prefix The object key name prefix that identifies the objects that
the rule applies to.
Note
If the replication configuration uses the Filter
element instead of Prefix, Amazon S3 returns
the Filter element. For more information about
the Filter element, see the next table.
Type: String
Ancestor: Rule
Type: Container
Ancestor: Rule
Element Description
replica ownership to the AWS account that owns the
destination bucket, this is the account ID of the owner of
the destination bucket. For more information, see Cross-
Region Replication Additional Configuration: Change
Replica Owner in the Amazon Simple Storage Service
Developer Guide.
Type: String
Ancestor: Destination
Type: String
Ancestor: Destination
Type: String
Ancestor: Destination
Type: String
Ancestor: Destination
Type: String
Ancestor: AccessControlTranslation
Element Description
Ancestor: Rule
And The container for the Prefix and one or more Tag
elements. If the And element is present, it includes at
least one child element.
Ancestor: Filter
Prefix The object key prefix that identifies one or more objects
that the rule applies to.
Note
The earlier version of replication configuration
(V1) supported only the key prefix as a rule
filter. In V1, the response returns the Prefix
element as a child of the Rule element.
Amazon S3 supports this behavior for backward
compatibility. For more information, see
Backward Compatibility in the Amazon S3
Developer Guide.
Type: String
Type: String
Ancestor: Tag
Type: String
Ancestor: Tag
If you include the Filter element in a replication configuration, you must also include the
DeleteMarkerReplication and Priority elements. The response also returns those elements.
Element Description
Ancestor: Rule
Element Description
Type: String
Ancestor: DeleteMarkerReplication
Type: Integer
Ancestor: Rule
Element Description
Type: String
Ancestor: Rule
Type: String
Ancestor: SourceSelectionCriteria
Type: String
Ancestor: SseKmsEncryptedObjects
Type: String
Ancestor: Destination
ReplicaKmsKeyID The AWS KMS Key ID—the Key Amazon Resource Name
(ARN) or Alias ARN—of the destination bucket. Amazon
S3 uses this key to encrypt replicas.
Type: String
Element Description
Ancestor: EncryptionConfiguration
Special Errors
Error Code Description HTTP Status SOAP Fault
Code Code Prefix
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Retrieve Replication Configuration Information
The following GET request retrieves information about the replication configuration set for the
examplebucket bucket:
The following response shows that replication is enabled on the bucket. The empty prefix indicates that
Amazon S3 will replicate all objects that are created in the examplebucket bucket. The Destination
element identifies the target bucket where Amazon S3 creates the object replicas, and the storage class
(STANDARD_IA) that Amazon S3 uses when creating replicas.
Amazon S3 assumes the specified IAM role to replicate objects on behalf of the bucket owner, which is
the AWS account that created the bucket.
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4RyTmXa3rPi4hklTXouTf0hccUjo0iCPjz6FnfIutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991C342example
Date: Tue, 10 Feb 2015 00:17:23 GMT
Server: AmazonS3
Content-Length: contentlength
<Key>key1</Key>
<Value>value1</Value>
</Tag>
<Tag>
<Key>key1</Key>
<Value>value1</Value>
</Tag>
</And>
</Filter>
<Destination>
<Bucket>arn:aws:s3:::exampletargetbucket</Bucket>
</Destination>
</Rule>
</ReplicationConfiguration>
Related Resources
• PUT Bucket replication (p. 327)
• DELETE Bucket replication (p. 121)
Requests
Syntax
GET ?requestPayment HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: Date
Authorization: authorization string
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Payer Specifies who pays for the download and request fees.
Type: Enum
Ancestor: RequestPaymentConfiguration
Type: Container
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the payer for the bucket, colorpictures.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2009 12:00:00 GMT
Content-Type: [type]
Content-Length: 0
Connection: close
Server: AmazonS3
This response shows that the bucket is a Requester Pays bucket, meaning the person requesting a
download from this bucket pays the transfer fees.
Related Resources
• GET Bucket (List Objects) Version 1 (p. 137)
To use this operation, you must have permission to perform the s3:GetBucketTagging action. By
default, the bucket owner has this permission and can grant this permission to others.
Requests
Syntax
GET /?tagging HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Ancestry: None
Name Description
Type: Container
Ancestry: Tagging
Type: Container
Ancestry: TagSet
Type: String
Ancestry: Tag
Type: String
Ancestry: Tag
Special Errors
• NoSuchTagSetError - There is no tag set associated with the bucket.
Examples
Sample Request
The following request returns the tag set of the specified bucket.
Sample Response
HTTP/1.1 200 OK
Date: Wed, 25 Nov 2009 12:00:00 GMT
Connection: close
Server: AmazonS3
<Tagging>
<TagSet>
<Tag>
<Key>Project</Key>
<Value>Project One</Value>
</Tag>
<Tag>
<Key>User</Key>
<Value>jsmith</Value>
</Tag>
</TagSet>
</Tagging>
Related Resources
• PUT Bucket tagging (p. 338)
• DELETE Bucket tagging (p. 123)
This implementation also returns the MFA Delete status of the versioning state, i.e., if the MFA Delete
status is enabled, the bucket owner must use an authentication device to change the versioning state of
the bucket.
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</VersioningConfiguration>
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Suspended</Status>
</VersioningConfiguration>
• If you never enabled (or suspended) versioning on a bucket, the response is:
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/>
Requests
Syntax
GET /?versioning HTTP/1.1
Host: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Name Description
Type: Enum
Ancestor: VersioningConfiguration
Type: Enum
Ancestor: VersioningConfiguration
Type: Container
Ancestor: None
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This example returns the versioning state of myBucket.
Sample Response
The following is a sample of the response body (only) that shows bucket versioning is enabled.
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</VersioningConfiguration>
Related Resources
• GET Object (p. 370)
• PUT Object (p. 434)
• DELETE Object (p. 364)
This GET operation requires the S3:GetBucketWebsite permission. By default, only the bucket owner
can read the bucket website configuration. However, bucket owners can allow other users to read
the website configuration by writing a bucket policy granting them the S3:GetBucketWebsite
permission.
Requests
Syntax
GET /?website HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
The response XML includes same elements that were uploaded when you configured the bucket as
website. For more information, see PUT Bucket website (p. 345).
Examples
Sample Request
This request retrieves website configuration on the specified bucket.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 3848CD259D811111
Date: Thu, 27 Jan 2011 00:49:26 GMT
Content-Length: 240
Content-Type: application/xml
Transfer-Encoding: chunked
Server: AmazonS3
Related Resources
• DELETE Bucket website (p. 125)
• PUT Bucket website (p. 345)
HEAD Bucket
Description
This operation is useful to determine if a bucket exists and you have permission to access it. The
operation returns a 200 OK if the bucket exists and you have permission to access it. Otherwise, the
operation might return responses such as 404 Not Found and 403 Forbidden.
To use this operation, you must have permissions to perform the s3:ListBucket action. The bucket
owner has this permission by default and can grant this permission to others. For more information
about permissions, see Permissions Related to Bucket Operations and Managing Access Permissions to
Your Amazon S3 Resources in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
HEAD / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Elements
This implementation of the operation does not use request elements.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
HEAD / HTTP/1.1
Date: Fri, 10 Feb 2012 21:34:55 GMT
Authorization: authorization string
Host: myawsbucket.s3.amazonaws.com
Connection: Keep-Alive
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: JuKZqmXuiwFeDQxhD7M8KtsKobSzWA1QEjLbTMTagkKdBX2z7Il/jGhDeJ3j6s80
x-amz-request-id: 32FE2CEB32F5EE25
Date: Fri, 10 2012 21:34:56 GMT
Server: AmazonS3
This operation supports list pagination and does not return more than 100 configurations at a time. You
should always check the IsTruncated element in the response. If there are no more configurations to
list, IsTruncated is set to false. If there are more configurations to list, IsTruncated is set to true,
and there will be a value in NextContinuationToken. You use the NextContinuationToken value to
continue the pagination of the list by passing the value in continuation-token in the request to GET
the next page.
To use this operation, you must have permissions to perform the s3:GetAnalyticsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about Amazon S3 analytics feature, see Amazon S3 Analytics – Storage Class Analysis in
the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?analytics HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameters in the following table.
continuation- When the Amazon S3 response to this API call is truncated (that is, No
token when the IsTruncated response element value is true), the response
also includes the NextContinuationToken element, the value of
which you can use in the next request as the continuation-token
to list the next page. The continuation token is an opaque value that
Amazon S3 understands.
Type: String
Default: None
Request Elements
This implementation of the operation does not use request elements.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
ContinuationToken The marker that is used as a starting point for this analytics
configuration list response. This value is present if it was sent
in the request.
Type: String
Ancestor: ListBucketAnalyticsConfigurationsResult
Type: Boolean
Ancestor: ListAnalyticsConfigurationsResult
Type: Container
Ancestor: ListAnalyticsConfigurationsResult
Type: Container
Type: String
Ancestor: ListBucketAnalyticsConfigurationsResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Listing Analytics Configurations
The following request returns the analytics configurations in example-bucket.
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: gyB+3jRPnrkN98ZajxHXr3u7EFM67bNgSAxexeEHndCX/7GRnfTXxReKUQF28IfP
x-amz-request-id: 3B3C7C725673C630
Date: Sat, 30 Apr 2016 23:29:37 GMT
Content-Length: length
Server: AmazonS3
<ListBucketAnalyticsConfigurationResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<AnalyticsConfiguration>
<Id>list1</Id>
<Filter>
<And>
<Prefix>images/</Prefix>
<Tag>
<Key>dog</Key>
<Value>corgi</Value>
</Tag>
</And>
</Filter>
<StorageClassAnalysis>
<DataExport>
<OutputSchemaVersion>V_1</OutputSchemaVersion>
<Destination>
<S3BucketDestination>
<Format>CSV</Format>
<BucketAccountId>123456789012</BucketAccountId>
<Bucket>arn:aws:s3:::destination-bucket</Bucket>
<Prefix>destination-prefix</Prefix>
</S3BucketDestination>
</Destination>
</DataExport>
</StorageClassAnalysis>
</AnalyticsConfiguration>
<AnalyticsConfiguration>
<Id>report1</Id>
<Filter>
<And>
<Prefix>images/</Prefix>
<Tag>
<Key>dog</Key>
<Value>bulldog</Value>
</Tag>
</And>
</Filter>
<StorageClassAnalysis>
<DataExport>
<OutputSchemaVersion>V_1</OutputSchemaVersion>
<Destination>
<S3BucketDestination>
<Format>CSV</Format>
<BucketAccountId>123456789012</BucketAccountId>
<Bucket>arn:aws:s3:::destination-bucket</Bucket>
<Prefix>destination-prefix</Prefix>
</S3BucketDestination>
</Destination>
</DataExport>
</StorageClassAnalysis>
</AnalyticsConfiguration>
...
<IsTruncated>false</IsTruncated>
<!-- If ContinuationToken was provided in the request. -->
<ContinuationToken>...</ContinuationToken>
<!-- if IsTruncated == true -->
<IsTruncated>true</IsTruncated>
<NextContinuationToken>...</NextContinuationToken>
</ListBucketAnalyticsConfigurationResult>
For an example of using the ContinuationToken with a list, see Example 4: Using a Continuation
Token (p. 135).
Related Resources
• GET Bucket analytics (p. 152)
• DELETE Bucket analytics (p. 106)
• PUT Bucket analytics (p. 267)
This operation supports list pagination and does not return more than 100 configurations at a time.
Always check the IsTruncated element in the response. If there are no more configurations to list,
IsTruncated is set to false. If there are more configurations to list, IsTruncated is set to true, and
there is a value in NextContinuationToken. You use the NextContinuationToken value to continue
the pagination of the list by passing the value in continuation-token in the request to GET the next
page.
To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about the Amazon S3 inventory feature, see Amazon S3 Inventory in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
GET /?inventory HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of GET uses the parameters in the following table.
Default: None
Request Elements
This implementation of the operation does not use request elements.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
ContinuationToken The marker that is used as a starting point for this inventory
configuration list response. This value is present if it was sent
in the request.
Type: String
Ancestor: ListInventoryConfigurationsResult
Type: Boolean
Ancestor: ListInventoryConfigurationsResult
Type: Container
Ancestor: ListInventoryConfigurationsResult
Type: Container
Type: String
Ancestor: ListInventoryConfigurationsResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Listing Inventory Configurations
The following request returns the inventory configurations in example-bucket.
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: gyB+3jRPnrkN98ZajxHXr3u7EFM67bNgSAxexeEHndCX/7GRnfTXxReKUQF28IfP
x-amz-request-id: 3B3C7C725673C630
Date: Sat, 30 Apr 2016 23:29:37 GMT
Content-Type: application/xml
Content-Length: length
Connection: close
Server: AmazonS3
<IsEnabled>true</IsEnabled>
<Destination>
<S3BucketDestination>
<Format>CSV</Format>
<AccountId>123456789012</AccountId>
<Bucket>arn:aws:s3:::bucket2</Bucket>
<Prefix>prefix2</Prefix>
</S3BucketDestination>
</Destination>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<Filter>
<Prefix>prefix/Two</Prefix>
</Filter>
<IncludedObjectVersions>All</IncludedObjectVersions>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>StorageClass</Field>
<Field>IsMultipartUploaded</Field>
<Field>ReplicationStatus</Field>
<Field>ObjectLockRetainUntilDate</Field>
<Field>ObjectLockMode</Field>
<Field>ObjectLockLegalHoldStatus</Field>
</OptionalFields>
</InventoryConfiguration>
<InventoryConfiguration>
<Id>report3</Id>
<IsEnabled>true</IsEnabled>
<Destination>
<S3BucketDestination>
<Format>CSV</Format>
<AccountId>123456789012</AccountId>
<Bucket>arn:aws:s3:::bucket3</Bucket>
<Prefix>prefix3</Prefix>
</S3BucketDestination>
</Destination>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<Filter>
<Prefix>prefix/Three</Prefix>
</Filter>
<IncludedObjectVersions>All</IncludedObjectVersions>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>StorageClass</Field>
<Field>IsMultipartUploaded</Field>
<Field>ReplicationStatus</Field>
</OptionalFields>
</InventoryConfiguration>
...
<IsTruncated>false</IsTruncated>
<!-- If ContinuationToken was provided in the request. -->
<ContinuationToken>...</ContinuationToken>
<!-- if IsTruncated == true -->
<IsTruncated>true</IsTruncated>
<NextContinuationToken>...</NextContinuationToken>
</ListBucketAnalyticsConfigurationResult>
</ListInventoryConfigurationsResult>
For an example of using the ContinuationToken with a list, see Example 4: Using a Continuation
Token (p. 135).
Related Resources
• GET Bucket Inventory (p. 165)
• DELETE Bucket inventory (p. 112)
• PUT Bucket inventory (p. 283)
This operation supports list pagination and does not return more than 100 configurations at a time.
Always check the IsTruncated element in the response. If there are no more configurations to list,
IsTruncated is set to false. If there are more configurations to list, IsTruncated is set to true, and
there is a value in NextContinuationToken. You use the NextContinuationToken value to continue
the pagination of the list by passing the value in continuation-token in the request to GET the next
page.
To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For more information about metrics configurations and CloudWatch request metrics, see Monitoring
Metrics with Amazon CloudWatch in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?metrics HTTP/1.1
HOST: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
continuation- When the Amazon S3 response to this API call is truncated (that is, No
token when the IsTruncated response element value is true), the response
also includes the NextContinuationToken element. You can use
the value of that element in the next request as the continuation-
token to list the next page. The continuation token is an opaque
value that Amazon S3 understands.
Type: String
Default: None
Request Headers
This operation uses only Request Headers common to most requests. For more information, see Common
Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
Name Description
Type: Boolean
Ancestor: ListMetricsConfigurationResult
ContinuationToken The marker that is used as a starting point for this metrics
configuration list response. This value is present if it was sent
in the request.
Type: String
Ancestor: ListMetricsConfigurationResult
Type: String
Ancestor: ListMetricsConfigurationResult
Type: Container
Examples
Sample Request
GET /?metrics HTTP/1.1
Host: examplebucket.s3.amazonaws.com
x-amz-date: Thu, 15 Nov 2016 00:17:21 GMT
Authorization: signatureValue
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991EXAMPLE5321
Date: Thu, 15 Nov 2016 00:17:22 GMT
Server: AmazonS3
Content-Length: 758
Related Resources
• PUT Bucket metrics (p. 310)
• DELETE Bucket metrics (p. 116)
• GET Bucket metrics (p. 186)
• Monitoring Metrics with Amazon CloudWatch in the Amazon Simple Storage Service Developer Guide.
This operation returns at most 1,000 multipart uploads in the response. 1,000 multipart uploads is the
maximum number of uploads a response can include, which is also the default value. You can further
limit the number of uploads in a response by specifying the max-uploads parameter in the response. If
additional multipart uploads satisfy the list criteria, the response will contain an IsTruncated element
with the value true. To list the additional multipart uploads, use the key-marker and upload-id-
marker request parameters.
In the response, the uploads are sorted by key. If your application has initiated more than one multipart
upload using the same object key, then uploads in the response are first sorted by key. Additionally,
uploads are sorted in ascending order within each key by the upload initiation time.
For more information on multipart uploads, see Uploading Objects Using Multipart Upload in the
Amazon Simple Storage Service Developer Guide.
For information on permissions required to use the multipart upload API, see Multipart Upload API and
Permissions in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /?uploads HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: Date
Authorization: authorization string
Request Parameters
All keys that contain the same string between the prefix, if
specified, and the first occurrence of the delimiter after the prefix
are grouped under a single result element, CommonPrefixes.
If you don't specify the prefix parameter, then the substring
starts at the beginning of the key. The keys that are grouped under
CommonPrefixes result element are not returned elsewhere in the
response.
Type: String
An object key can contain any Unicode character; however, XML 1.0
parser cannot parse some characters, such as characters with an ASCII
Type: String
Default: None
Type: Integer
Default: 1,000
Type: String
prefix Lists in-progress uploads only for those keys that begin with the No
specified prefix. You can use prefixes to separate a bucket into
different grouping of keys. (You can think of using prefix to make
groups in the same way you'd use a folder in a file system.)
Type: String
Type: String
Request Headers
This operation uses only Request Headers common to most requests. For more information, see Common
Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
This operation uses only response headers that are common to most responses. For more information,
see Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Ancestor: None
Type: String
Ancestor: ListMultipartUploadsResult
Type: String
Ancestor: ListMultipartUploadsResult
Type: String
Ancestor: ListMultipartUploadsResult
NextKeyMarker When a list is truncated, this element specifies the value that
should be used for the key-marker request parameter in a
subsequent request.
Type: String
Ancestor: ListMultipartUploadsResult
Type: String
Ancestor: ListMultipartUploadsResult
Name Description
If you specify encoding-type request parameter, Amazon
S3 includes this element in the response, and returns encoded
key name values in the following response elements:
Type: String
Ancestor: ListBucketResult
Type: Integer
Ancestor: ListMultipartUploadsResult
Type: Boolean
Ancestor: ListMultipartUploadsResult
Type: Container
Ancestor: ListMultipartUploadsResult
Key Key of the object for which the multipart upload was
initiated.
Type: Integer
Ancestor: Upload
Type: Integer
Ancestor: Upload
Name Description
Type: Container
Ancestor: Upload
Type: String
Type: String
Type: Container
Ancestor: Upload
Type: String
Ancestor: Upload
Initiated Date and time at which the multipart upload was initiated.
Type: Date
Ancestor: Upload
Type: String
Ancestor: ListMultipartUploadsResult
Name Description
Type: String
Ancestor: ListMultipartUploadsResult
Type: Container
Ancestor: ListMultipartUploadsResult
Type: String
Ancestor: CommonPrefixes
Examples
Sample Request
The following request lists three multipart uploads. The request specifies the max-uploads request
parameter to set the maximum number of multipart uploads to return in the response body.
Sample Response
The following sample response indicates that the multipart upload list was truncated and provides
the NextKeyMarker and the NextUploadIdMarker elements. You specify these values in
your subsequent requests to read the next set of multipart uploads. That is, send a subsequent
request specifying key-marker=my-movie2.m2ts (value of the NextKeyMarker element) and
upload-id-marker=YW55IGlkZWEgd2h5IGVsdmluZydzIHVwbG9hZCBmYWlsZWQ (value of the
NextUploadIdMarker).
The sample response also shows a case of two multipart uploads in progress with the same key (my-
movie.m2ts). That is, the response shows two uploads with the same key. This response shows the
uploads sorted by key, and within each key the uploads are sorted in ascending order by the time the
multipart upload was initiated.
HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
Content-Length: 1330
Connection: keep-alive
Server: AmazonS3
photos/2006/January/sample.jpg
photos/2006/February/sample.jpg
photos/2006/March/sample.jpg
videos/2006/March/sample.wmv
sample.jpg
The following list multipart upload request specifies the delimiter parameter with value "/".
The following sample response lists multipart uploads on the specified bucket, example-bucket.
The response returns multipart upload for the sample.jpg key in an <Upload> element.
However, because all the other keys contain the specified delimiter, a distinct substring, from the
beginning of the key to the first occurrence of the delimiter, from each of these keys is returned in a
<CommonPrefixes> element. The key substrings, photos/ and videos/, in the <CommonPrefixes>
element indicate that there are one or more in-progress multipart uploads with these key prefixes.
This is a useful scenario if you use key prefixes for your objects to create a logical folder like structure. In
this case you can interpret the result as the folders photos/ and videos/ have one or more multipart
uploads in progress.
<ListMultipartUploadsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Bucket>example-bucket</Bucket>
<KeyMarker/>
<UploadIdMarker/>
<NextKeyMarker>sample.jpg</NextKeyMarker>
<NextUploadIdMarker>Xgw4MJT6ZPAVxpY0SAuGN7q4uWJJM22ZYg1W99trdp4tpO88.PT6.MhO0w2E17eutfAvQfQWoajgE_W2gp
</NextUploadIdMarker>
<Delimiter>/</Delimiter>
<Prefix/>
<MaxUploads>1000</MaxUploads>
<IsTruncated>false</IsTruncated>
<Upload>
<Key>sample.jpg</Key>
<UploadId>Agw4MJT6ZPAVxpY0SAuGN7q4uWJJM22ZYg1N99trdp4tpO88.PT6.MhO0w2E17eutfAvQfQWoajgE_W2gpcxQw--
</UploadId>
<Initiator>
<ID>314133b66967d86f031c7249d1d9a80249109428335cd0ef1cdc487b4566cb1b</ID>
<DisplayName>s3-nickname</DisplayName>
</Initiator>
<Owner>
<ID>314133b66967d86f031c7249d1d9a80249109428335cd0ef1cdc487b4566cb1b</ID>
<DisplayName>s3-nickname</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
<Initiated>2010-11-26T19:24:17.000Z</Initiated>
</Upload>
<CommonPrefixes>
<Prefix>photos/</Prefix>
</CommonPrefixes>
<CommonPrefixes>
<Prefix>videos/</Prefix>
</CommonPrefixes>
</ListMultipartUploadsResult>
In addition to the delimiter parameter you can filter results by adding a prefix parameter as shown in
the following request.
In this case the response will include only multipart uploads for keys that start with the specified prefix.
The value returned in the <CommonPrefixes> element is a substring from the beginning of the key to the
first occurrence of the specified delimiter after the prefix.
Related Actions
• Initiate Multipart Upload (p. 512)
• Upload Part (p. 528)
• Complete Multipart Upload (p. 506)
• Abort Multipart Upload (p. 504)
• List Parts (p. 522)
PUT Bucket
Description
This implementation of the PUT operation creates a new bucket. To create a bucket, you must register
with Amazon S3 and have a valid AWS Access Key ID to authenticate requests. Anonymous requests are
never allowed to create buckets. By creating the bucket, you become the bucket owner.
Not every string is an acceptable bucket name. For information on bucket naming restrictions, see
Working with Amazon S3 Buckets.
By default, the bucket is created in the US East (N. Virginia) region. You can optionally specify a region in
the request body. You might choose a region to optimize latency, minimize costs, or address regulatory
requirements. For example, if you reside in Europe, you will probably find it advantageous to create
buckets in the EU (Ireland) region. For more information, see How to Select a Region for Your Buckets.
Note
If you create a bucket in a region other than US East (N. Virginia) region, your application
must be able to handle 307 redirect. For more information, go to Virtual Hosting of Buckets in
Amazon Simple Storage Service Developer Guide.
When creating a bucket using this operation, you can optionally specify the accounts or groups that
should be granted specific permissions on the bucket. There are two ways to grant the appropriate
permissions using the request headers.
• Specify a canned ACL using the x-amz-acl request header. For more information, see Canned ACL in
the Amazon Simple Storage Service Developer Guide.
• Specify access permissions explicitly using the x-amz-grant-read, x-amz-grant-write, x-amz-
grant-read-acp, x-amz-grant-write-acp, x-amz-grant-full-control headers. These
headers map to the set of permissions Amazon S3 supports in an ACL. For more information, go to
Access Control List (ACL) Overview in the Amazon Simple Storage Service Developer Guide.
Note
You can use either a canned ACL or specify access permissions explicitly. You cannot do both.
Requests
Syntax
PUT / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>BucketRegion</LocationConstraint>
</CreateBucketConfiguration>
Note
The syntax shows some of the request headers. For a complete list, see the Request Headers
section.
Note
If you send your create bucket request to the s3.amazonaws.com endpoint, the request go
to the us-east-1 region. Accordingly, the signature calculations in Signature Version 4 must
use us-east-1 as region, even if the location constraint in the request specifies another region
where the bucket is to be created.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
When creating a bucket, you can grant permissions to individual AWS accounts or predefined groups
defined by Amazon S3. This results in creation of the Access Control List (ACL) on the bucket. For more
information, see Using ACLs. You have the following two ways to grant these permissions:
• Specify a canned ACL — Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each
canned ACL has a predefined set of grantees and permissions. For more information, go to Canned
ACL.
x-amz-acl The canned ACL to apply to the bucket you are creating. For more No
information, go to Canned ACL in the Amazon Simple Storage
Service Developer Guide.
Type: String
• Specify access permissions explicitly — If you want to explicitly grant access permissions to specific
AWS accounts or groups, you use the following headers. Each of these headers maps to specific
permissions Amazon S3 supports in an ACL. For more information, go to Access Control List (ACL)
Overview. In the header value, you specify a list of grantees who get the specific permission
Default: None
Constraints: None
x-amz-grant- Allows grantee to create, overwrite, and delete any object in the No
write bucket.
Type: String
Default: None
Constraints: None
Default: None
Constraints: None
x-amz-grant- Allows grantee to write the ACL for the applicable bucket. No
write-acp
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
You specify each grantee as a type=value pair, where the type can be one of the following::
For example, the following x-amz-grant-read header grants list objects permission to the AWS
accounts identified by their email addresses.
Request Elements
Type: Container
Ancestor: None
Type: Enum
Ancestor: CreateBucketConfiguration
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request creates a bucket named colorpictures.
PUT / HTTP/1.1
Host: colorpictures.s3.amazonaws.com
Content-Length: 0
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: authorization string
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Location: /colorpictures
Content-Length: 0
Connection: close
Server: AmazonS3
PUT / HTTP/1.1
Host: bucketName.s3.amazonaws.com
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain
Content-Length: 124
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>EU</LocationConstraint>
</CreateBucketConfiguration >
Sample Response
Sample Request: Creating a bucket and configuring access
permission using a canned ACL
This request creates a bucket named "colorpictures" and sets the ACL to private.
PUT / HTTP/1.1
Host: colorpictures.s3.amazonaws.com
Content-Length: 0
x-amz-acl: private
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: authorization string
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Location: /colorpictures
Content-Length: 0
Connection: close
Server: AmazonS3
PUT HTTP/1.1
Host: colorpictures.s3.amazonaws.com
x-amz-date: Sat, 07 Apr 2012 00:54:40 GMT
Authorization: authorization string
x-amz-grant-write: emailAddress="xyz@amazon.com", emailAddress="abc@amazon.com"
Sample Response
HTTP/1.1 200 OK
Related Resources
• PUT Object (p. 434)
• DELETE Bucket (p. 104)
To use this operation, you must have permission to perform the s3:PutAccelerateConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
The Transfer Acceleration state of a bucket can be set to one of the following two values:
The GET Bucket accelerate (p. 146) operation returns the transfer acceleration state of a bucket.
After setting the Transfer Acceleration state of a bucket to Enabled, it might take up to thirty minutes
before the data transfer rates to the bucket increase.
The name of the bucket used for Transfer Acceleration must be DNS-compliant and must not contain
periods (".").
For more information about transfer acceleration, see Transfer Acceleration in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
PUT /?accelerate HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Body
In the request, you specify the acceleration configuration in the request body. The acceleration
configuration is specified as XML. The following is an example of an acceleration configuration used in a
request. The Status indicates whether to set the transfer acceleration state to Enabled or Suspended.
<AccelerateConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>transfer acceleration state</Status>
</AccelerateConfiguration>
The following table describes the XML elements in the acceleration configuration:
Type: Container
Children: Status
Ancestor: None
Type: Enum
Ancestor: AccelerateConfiguration
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Add Transfer Acceleration Configuration to Set
Acceleration Status
The following is an example of a PUT /?accelerate request that enables transfer acceleration for the
bucket named examplebucket.
<AccelerateConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</AccelerateConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Mon, 11 Apr 2016 12:00:00 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• GET Bucket accelerate (p. 146)
• PUT Bucket (p. 252)
You can use one of the following two ways to set a bucket's permissions:
Note
You cannot specify access permission using both the body and the request headers.
Depending on your application needs, you may choose to set the ACL on a bucket using either the
request body or the headers. For example, if you have an existing application that updates a bucket ACL
using the request body, then you can continue to use that approach.
Requests
Syntax
The following request shows the syntax for sending the ACL in the request body. If you want to use
headers to specify the permissions for the bucket, you cannot send the ACL in the request body. Instead,
see Request Headers section for a list of headers you can use.
<AccessControlPolicy>
<Owner>
<ID>ID</ID>
<DisplayName>EmailAddress</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>ID</ID>
<DisplayName>EmailAddress</DisplayName>
</Grantee>
<Permission>Permission</Permission>
</Grant>
...
</AccessControlList>
</AccessControlPolicy>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
You can use the following request headers in addition to the Common Request Headers (p. 2).
These headers enable you to set access permissions using one of the following methods:
Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each canned ACL has a predefined
set of grantees and permissions. For more information, see Canned ACL. To grant access permissions by
specifying canned ACLs, you use the following header and specify the canned ACL name as its value. If
you use this header, you cannot use other access control specific headers in your request.
x-amz-acl Sets the ACL of the bucket using the specified canned ACL. For No
more information, go to Canned ACL in the Amazon Simple Storage
Service Developer Guide.
Type: String
Default: private
If you need to grant individualized access permissions on a bucket, you can use the following "x-amz-
grant-permission" headers. When using these headers you specify explicit access permissions and
grantees (AWS accounts or a Amazon S3 groups) who will receive the permission. If you use these ACL
specific headers, you cannot use x-amz-acl header to set a canned ACL.
Note
Each of the following request headers maps to specific permissions Amazon S3 supports in an
ACL. For more information go to Access Control List (ACL) Overview.
x-amz-grant- Allows the specified grantee(s) to list the objects in the bucket. No
read
Type: String
Default: None
Constraints: None
x-amz-grant- Allows the specified grantee(s) to create, overwrite, and delete any No
write object in the bucket.
Type: String
Default: None
Constraints: None
Default: None
Constraints: None
x-amz-grant- Allows the specified grantee(s) to write the ACL for the applicable No
write-acp bucket.
Type: String
Default: None
Constraints: None
x-amz-grant- Allows the specified grantee(s) the READ, WRITE, READ_ACP, and No
full-control WRITE_ACP permissions on the bucket.
Type: String
Default: None
Constraints: None
For each of these headers, the value is a comma-separated list of one or more grantees. You specify each
grantee as a type=value pair, where the type can be one of the following:
For example, the following x-amz-grant-write header grants create, overwrite, and delete objects
permission to LogDelivery group predefined by Amazon S3 and two AWS accounts identified by their
email addresses.
x-amz-grant-write: uri="http://acs.amazonaws.com/groups/s3/LogDelivery",
emailAddress="xyz@amazon.com", emailAddress="abc@amazon.com"
For more information, go to Access Control List (ACL) Overview. For more information about bucket
logging, go to Server Access Logging.
Request Elements
If you decide to use the request body to specify an ACL, you must use the following elements.
Note
If you request the request body, you cannot use the request headers to set an ACL.
Type: Container
Ancestors: AccessControlPolicy
AccessControlPolicy Contains the elements that set the ACL permissions for an No
object per grantee.
Type: String
Ancestors: None
Type: String
Ancestors: AccessControlPolicy.Owner
Type: Container
Ancestors: AccessControlPolicy.AccessControlList
Grantee The subject whose permissions are being set. For more No
information, see Grantee Values (p. 263).
Type: String
Ancestors:
AccessControlPolicy.AccessControlList.Grant
Type: String
Ancestors: AccessControlPolicy.Owner |
AccessControlPolicy.AccessControlList.Grant
Owner Container for the bucket owner's display name and ID. Yes
Type: Container
Ancestors: AccessControlPolicy
Type: String
Ancestors:
AccessControlPolicy.AccessControlList.Grant
Grantee Values
You can specify the person (grantee) to whom you're assigning access rights (using request elements) in
the following ways:
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser"><ID><replaceable>ID</replaceable></
ID><DisplayName><replaceable>GranteesEmail</replaceable></DisplayName>
</Grantee>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AmazonCustomerByEmail"><EmailAddress><replaceable>Grantees@email.com</
replaceable></EmailAddress>lt;/Grantee>
The grantee is resolved to the CanonicalUser and, in a response to a GET Object acl request,
appears as the CanonicalUser.
• By URI:
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="Group"><URI><replaceable>http://acs.amazonaws.com/groups/global/
AuthenticatedUsers</replaceable></URI></Grantee>
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
This operation does not return special errors. For general information about Amazon S3 errors and a list
of error codes, see Error Responses (p. 6).
Examples
Sample Request: Access permissions specified in the body
The following request grants access permission to the existing examplebucket bucket. The request
specifies the ACL in the body. In addition to granting full control to the bucket owner, the XML specifies
the following grants.
Content-Length: 1660
x-amz-date: Thu, 12 Apr 2012 20:04:21 GMT
Authorization: authorization string
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID>
<DisplayName>OwnerDisplayName</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID>
<DisplayName>OwnerDisplayName</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
<URI xmlns="">http://acs.amazonaws.com/groups/global/AllUsers</URI>
</Grantee>
<Permission xmlns="">READ</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
<URI xmlns="">http://acs.amazonaws.com/groups/s3/LogDelivery</URI>
</Grantee>
<Permission xmlns="">WRITE</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AmazonCustomerByEmail">
<EmailAddress xmlns="">xyz@amazon.com</EmailAddress>
</Grantee>
<Permission xmlns="">WRITE_ACP</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID xmlns="">f30716ab7115dcb44a5ef76e9d74b8e20567f63TestAccountCanonicalUserID</ID>
</Grantee>
<Permission xmlns="">READ_ACP</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: NxqO3PNiMHXXGwjgv15LLgUoAmPVmG0xtZw2sxePXLhpIvcyouXDrcQUaWWXcOK0
x-amz-request-id: C651BC9B4E1BD401
Date: Thu, 12 Apr 2012 20:04:28 GMT
Content-Length: 0
Server: AmazonS3
• Write permission to the Amazon S3 LogDelivery group and an AWS account identified by the email
xyz@amazon.com.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: 0w9iImt23VF9s6QofOTDzelF7mrryz7d04Mw23FQCi4O205Zw28Zn+d340/RytoQ
x-amz-request-id: A6A8F01A38EC7138
Date: Sun, 29 Apr 2012 22:01:10 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• PUT Bucket (p. 252)
• DELETE Bucket (p. 104)
• GET Object ACL (p. 383)
You can choose to have storage class analysis export analysis reports to a comma-separated values
(CSV) flat file, see the DataExport request element. Reports are updated daily and are based on the
object filters you configure. When selecting data export you specify a destination bucket and optional
destination prefix where the file is written. You can export the data to a destination bucket in a different
account. However, the destination bucket must be in the same region as the bucket that you are making
the PUT analytics configuration to. For more information, see Amazon S3 Analytics – Storage Class
Analysis in the Amazon Simple Storage Service Developer Guide.
Important
You must create a bucket policy on the destination bucket where the exported file is written
to grant permissions to Amazon S3 to write objects to the bucket. For an example policy, see
Granting Permissions for Amazon S3 Inventory and Storage Class Analysis.
To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
PUT /?analytics&id=configuration-ID HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of PUT uses the parameter in the following table.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
In the request, you must specify the analytics configuration in the request body, which is specified as
XML. The Examples section shows an example of an analytics configuration.
The following table describes the XML elements in the analytics configuration:
Type: Container
Ancestor: None
Type: String
Ancestor: Filter
Type: String
Ancestor: S3BucketDestination
Type: String
Ancestor: S3BucketDestination
Type: Container
Type: Container
Children: S3BucketDestination
Ancestor: DataExport
Type: Container
Children: And
Ancestor: AnalyticsConfiguration
Type: String
Ancestor: S3BucketDestination
Type: String
Ancestor: AnalyticsConfiguration
Type: String
Ancestor: Tag
Type: String
Ancestor: DataExport
Type: String
Ancestor: And
Type: String
Ancestor: S3BucketDestination
Type: Container
Children: DataExport
Ancestor: AnalyticsConfiguration
Type: Container
Ancestor: Destination.
Type: Container
Ancestor: And
Type: String
Ancestor: Tag
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
Amazon S3 checks the validity of the proposed AnalyticsConfiguration element and verifies
whether the proposed configuration is valid when you call the PUT operation. The following table lists
the errors and possible causes.
HTTP 403 AccessDenied You are not the owner of the specified bucket, or you do
Forbidden not have the s3:PutAnalyticsConfiguration bucket
permission to set the configuration on the bucket.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Creating an Analytics Configuration
The following PUT request for the bucket examplebucket creates a new or replaces an existing
analytics configuration with the ID report1. The configuration is defined in the request body.
<Prefix>destination-prefix</Prefix>
</S3BucketDestination>
</Destination>
</DataExport>
</StorageClassAnalysis>
</AnalyticsConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Mon, 31 Oct 2016 12:00:00 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• GET Bucket analytics (p. 152)
• DELETE Bucket analytics (p. 106)
• List Bucket Analytics Configurations (p. 231)
To use this operation, you must be allowed to perform the s3:PutBucketCORS action. By default, the
bucket owner has this permission and can grant it to others.
You set this configuration on a bucket so that the bucket can service cross-origin requests. For example,
you might want to enable a request whose origin is http://www.example.com to access your Amazon
S3 bucket at my.example.bucket.com by using the browser's XMLHttpRequest capability.
To enable cross-origin resource sharing (CORS) on a bucket, you add the cors subresource to the bucket.
The cors subresource is an XML document in which you configure rules that identify origins and the
HTTP methods that can be executed on your bucket. The document is limited to 64 KB in size. For
example, the following cors configuration on a bucket has two rules:
• The first CORSRule allows cross-origin PUT, POST and DELETE requests whose origin is http://
www.example.com origins. The rule also allows all headers in a pre-flight OPTIONS request through
the Access-Control-Request-Headers header. Therefore, in response to any pre-flight OPTIONS
request, Amazon S3 will return any requested headers.
• The second rule allows cross-origin GET requests from all the origins. The '*' wildcard character refers
to all origins.
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://www.example.com</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
</CORSRule>
</CORSConfiguration>
The cors configuration also allows additional optional configuration parameters as shown in the
following cors configuration on a bucket. For example, this cors configuration allows cross-origin PUT
and POST requests from http://www.example.com.
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://www.example.com</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
</CORSRule>
</CORSConfiguration>
In the preceding configuration, CORSRule includes the following additional optional parameters:
• MaxAgeSeconds—Specifies the time in seconds that the browser will cache an Amazon S3 response
to a pre-flight OPTIONS request for the specified resource. In this example, this parameter is 3000
seconds. Caching enables the browsers to avoid sending pre-flight OPTIONS request to Amazon S3 for
repeated requests.
• ExposeHeader—Identifies the response header (in this case x-amz-server-side-encryption)
that you want customers to be able to access from their applications (for example, from a JavaScript
XMLHttpRequest object).
When Amazon S3 receives a cross-origin request (or a pre-flight OPTIONS request) against a bucket,
it evaluates the cors configuration on the bucket and uses the first CORSRule rule that matches the
incoming browser request to enable a cross-origin request. For a rule to match, the following conditions
must be met:
For more information about CORS, go to Enabling Cross-Origin Resource Sharing in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
PUT /?cors HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Content-MD5: MD5
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>Origin you want to allow cross-domain requests from</AllowedOrigin>
<AllowedOrigin>...</AllowedOrigin>
...
<AllowedMethod>HTTP method</AllowedMethod>
<AllowedMethod>...</AllowedMethod>
...
<MaxAgeSeconds>Time in seconds your browser to cache the pre-flight OPTIONS response
for a resource</MaxAgeSeconds>
<AllowedHeader>Headers that you want the browser to be allowed to send</AllowedHeader>
<AllowedHeader>...</AllowedHeader>
...
<ExposeHeader>Headers in the response that you want accessible from client
application</ExposeHeader>
<ExposeHeader>...</ExposeHeader>
...
</CORSRule>
<CORSRule>
...
</CORSRule>
...
</CORSConfiguration>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Name Description Required
Content-MD5 The base64-encoded 128-bit MD5 digest of the data. This header Yes
must be used as a message integrity check to verify that the request
body was not corrupted in transit. For more information, go to RFC
1864.
Type: String
Default: None
Request Elements
Name Description Required
Type: Container
Children: CORSRules
Ancestor: None
Type: Container
Ancestor: CORSConfiguration
Type: String
Ancestor: CORSRule
AllowedMethod An HTTP method that you want to allow the origin to Yes
execute.
AllowedOrigin An origin that you want to allow cross-domain requests from. Yes
This can contain at most one * wild character.
The origin value can include at most one '*' wild character. For
example, "http://*.example.com". You can also specify only *
as the origin value allowing all origins cross-domain access.
Type: String
Ancestor: CORSRule
Type: String
Ancestor: CORSRule
Ancestor: CORSRule
Type: String
Ancestor: CORSRule
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
The following examples add the cors subresource to a bucket.
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://www.example.com</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
<MaxAgeSeconds>3000</MaxAgeSec>
<ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
</CORSRule>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
<MaxAgeSeconds>3000</MaxAgeSeconds>
</CORSRule>
</CORSConfiguration>
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: CCshOvbOPfxzhwOADyC4qHj/Ck3F9Q0viXKw3rivZ+GcBoZSOOahvEJfPisZB7B
x-amz-request-id: BDC4B83DF5096BBE
Date: Tue, 21 Aug 2012 17:54:50 GMT
Server: AmazonS3
Related Resources
• GET Bucket cors (p. 157)
• DELETE Bucket cors (p. 108)
This implementation of the PUT operation sets default encryption for a buckets using server-side
encryption with Amazon S3-managed keys SSE-S3 or AWS KMS-managed Keys (SSE-KMS) bucket. For
information about the Amazon S3 default encryption feature, see Amazon S3 Default Bucket Encryption
in the Amazon Simple Storage Service Developer Guide.
Important
This operation requires AWS Signature Version 4. For more information, see Authenticating
Requests (AWS Signature Version 4) (p. 14).
To use this operation, you must have permissions to perform the s3:PutEncryptionConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
PUT /?encryption HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Body
In the request, you specify the encryption configuration in the request body. The encryption
configuration is specified as XML, as shown in the following examples that show setting encryption using
SSE-S3 or SSE-KMS.
<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ApplyServerSideEncryptionByDefault>
<SSEAlgorithm>AES256</SSEAlgorithm>
</ApplyServerSideEncryptionByDefault>
</Rule>
</ServerSideEncryptionConfiguration>
<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ApplyServerSideEncryptionByDefault>
<SSEAlgorithm>aws:kms</SSEAlgorithm>
<KMSMasterKeyID>arn:aws:kms:us-east-1:1234/5678example</KMSMasterKeyID>
</ApplyServerSideEncryptionByDefault>
</Rule>
</ServerSideEncryptionConfiguration>
The following table describes the XML elements in the encryption configuration:
Type: Container
Ancestor: Rule
KMSMasterKeyID The AWS KMS master key ID used for the SSE-KMS No
encryption.
Type: String
Ancestor:
ApplyServerSideEncryptionByDefault
Type: Container
Children:
ApplyServerSideEncryptionByDefault
Ancestor:
ServerSideEncryptionConfiguration
Type: Container
Children: Rule
Ancestor: None
Type: String
Ancestor:
ApplyServerSideEncryptionByDefault
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Set the Default Encryption Configuration for an S3
Bucket
The following is an example of a PUT /?encryption request that specifies to use AWS KMS encryption.
<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ApplyServerSideEncryptionByDefault>
<SSEAlgorithm>aws:kms</SSEAlgorithm>
<KMSMasterKeyID>arn:aws:kms:us-east-1:1234/5678example</KMSMasterKeyID>
</ApplyServerSideEncryptionByDefault>
</Rule>
</ServerSideEncryptionConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: B3Z1w/R0GaUCDHStDVuoz+4NSndjUDYuE3jvJ5kvrDroucdFCygEQYEwpC0Lj0Cv
x-amz-request-id: E0DE682C2FDDBCF8
Date: Wed, 06 Sep 2017 12:00:00 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• GET Bucket encryption (p. 161)
• DELETE Bucket encryption (p. 110)
Amazon S3 inventory generates inventories of the objects in the bucket on a daily or weekly basis, and
the results are published to a flat file. The bucket that is inventoried is called the source bucket, and the
bucket where the inventory flat file is stored is called the destination bucket. The destination bucket must
be in the same AWS Region as the source bucket.
When you configure an inventory for a source bucket, you specify the destination bucket where you
want the inventory to be stored, and whether to generate the inventory daily or weekly. You can also
configure what object metadata to include and whether to inventory all object versions or only current
versions. For more information, see Amazon S3 Inventory in the Amazon Simple Storage Service Developer
Guide.
Important
You must create a bucket policy on the destination bucket to grant permissions to Amazon
S3 to write objects to the bucket in the defined location. For an example policy, see Granting
Permissions for Amazon S3 Inventory and Storage Class Analysis.
To use this operation, you must have permissions to perform the s3:PutInventoryConfiguration
action. The bucket owner has this permission by default and can grant this permission to others. For
more information about permissions, see Permissions Related to Bucket Subresource Operations and
Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service
Developer Guide.
Requests
Syntax
PUT /?inventory&id=configuration-ID HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of PUT uses the parameter in the following table.
Type: String
Default: None
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
In the request, you must specify the inventory configuration in the request body, which is specified as
XML. The Examples section shows an example of an inventory configuration.
The following table describes the XML elements in the inventory configuration:
Type: String
Ancestor: S3BucketDestination
Type: String
Ancestor: S3BucketDestination
Type: Container
Children: S3BucketDestination
Ancestor: InventoryConfiguration
Type: Container
Ancestor: S3BucketDestination
Type: String
Ancestor: OptionalFields
Type: Container
Children: Prefix
Ancestor: InventoryConfiguration
Type: String
Ancestor: S3BucketDestination
Type: String
Ancestor: Schedule
Type: String
Ancestor:InventoryConfiguration
Type: String
Ancestor: InventoryConfiguration
Type: Container
Ancestor: None
Type: String
Ancestor: InventoryConfiguration
Type: String
Ancestor: SSE-KMS
Type: Container
Children: Field
Ancestor: InventoryConfiguration
Type: String
Ancestor: Filter
Type: String
Ancestor: S3BucketDestination
Type: Container
Children: Frequency
Ancestor: Destination
Type: Container
Children: KeyId
Ancestor: Encryption
Type: Container
Ancestor: Encryption
Type: Container
Ancestor: Destination
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
Amazon S3 checks the validity of the proposed InventoryConfiguration element and verifies
whether the proposed configuration is valid when you call the PUT operation. The following table lists
the errors and possible causes.
HTTP 403 AccessDenied You are not the owner of the specified bucket, or you do
Forbidden not have the s3:PutInventoryConfiguration bucket
permission to set the configuration on the bucket.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Creating an Inventory Configuration
The following PUT request for the bucket examplebucket creates a new or replaces an existing
inventory configuration with the ID report1. The configuration is defined in the request body.
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>StorageClass</Field>
<Field>IsMultipartUploaded</Field>
<Field>ReplicationStatus</Field>
<Field>EncryptionStatus</Field>
<Field>ObjectLockRetainUntilDate</Field>
<Field>ObjectLockMode</Field>
<Field>ObjectLockLegalHoldStatus</Field>
</OptionalFields>
</InventoryConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Mon, 31 Oct 2016 12:00:00 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• GET Bucket Inventory (p. 165)
• DELETE Bucket inventory (p. 112)
• List Bucket Inventory Configurations (p. 235)
Permissions
By default, all Amazon S3 resources are private, including buckets, objects, and related subresources
(for example, lifecycle configuration and website configuration). Only the resource owner (that is,
the AWS account that created it) can access the resource. The resource owner can optionally grant
access permissions to others by writing an access policy. For this operation, a user must get the
s3:PutLifecycleConfiguration permission.
You can also explicitly deny permissions. Explicit deny also supersedes any other permissions. If you want
to block users or accounts from removing or deleting objects from your bucket, you must deny them
permissions for the following actions:
• s3:DeleteObject
• s3:DeleteObjectVersion
• s3:PutLifecycleConfiguration
For more information about permissions, see Managing Access Permissions to Your Amazon S3 Resources
in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /?lifecycle HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string
Content-MD5: MD5
For details about authorization string, see Authenticating Requests (AWS Signature Version
4) (p. 14).
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Type: String
Default: None
Request Body
You specify the lifecycle configuration in your request body. The lifecycle configuration is specified as
XML consisting of one or more rules.
<LifecycleConfiguration>
<Rule>
...
</Rule>
<Rule>
...
</Rule>
…
</LifecycleConfiguration>
• Filter identifying a subset of objects to which the rule applies. The filter can be based on a key name
prefix, object tags, or a combination of both.
• Status whether the rule is in effect.
• One or more lifecycle transition and expiration actions that you want Amazon S3 to perform on
the objects identified by the filter. If the state of your bucket is versioning-enabled or versioning-
suspended, you can have many versions of the same object (one current version and zero or more
noncurrent versions). Amazon S3 provides predefined actions that you can specify for current and
noncurrent object versions.
For example,
<LifecycleConfiguration>
<Rule>
<Filter>
<Prefix>key-prefix</Prefix>
</Filter>
<Status>rule-status</Status>
One or more Transition/Expiration lifecycle actions.
</Rule>
</LifecycleConfiguration>
For more information, see Object Lifecycle Management in the Amazon Simple Storage Service Developer
Guide.
For more information, see Lifecycle Configuration Elements in the Amazon Simple Storage Service
Developer Guide.
The following table describes the XML elements in the lifecycle configuration:
Child: DaysAfterInitiation
Type: Container
Ancestor: Rule.
And Container for specify rule filters. These filters Yes, if you
determine the subset of objects to which the rule specify
applies. more than
one filter
Type: String condition
(for
Ancestor: Rule example,
one prefix
and one or
more tags).
Type: String
Ancestor:
AbortIncompleteMultipartUpload.
Type: Container
Ancestor: Rule
Type: String
Ancestor: Rule
Type: String
Ancestor: Rule
Key Specifies the key of a tag. A tag key can be up to Yes, if <Tag>
128 Unicode characters in length. parent is
specified.
Tag keys that you specify in a lifecycle rule filter
must be unique.
Type: String
Ancestor: Tag
LifecycleConfiguration Container for lifecycle rules. You can add as many Yes
as 1,000 rules.
Type: Container
Children: Rule
Ancestor: None
Type: String
Ancestor: Expiration.
Ancestor: NoncurrentVersionExpiration or
NoncurrentVersionTransition
Type: Container
Children: NoncurrentDays
Ancestor: Rule
Type: Container
Ancestor: Rule
Type: String
Type: Container
Ancestor: LifecycleConfiguration
Type: String
Ancestor: Rule
Type: Container
Type: Container
Ancestor: Rule
Value Specifies the value for a tag key. Each object tag Yes, if <Tag>
is a key-value pair. parent is
specified.
Tag value can be up to 256 Unicode characters in
length.
Type: String
Ancestor: Tag
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Add lifecycle configuration - bucket not versioning-
enabled
The following lifecycle configuration specifies two rules, each with one action.
• The Transition action requests Amazon S3 to transition objects with the "documents/" prefix to the
GLACIER storage class 30 days after creation.
• The Expiration action requests Amazon S3 to delete objects with the "logs/" prefix 365 days after
creation.
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Filter>
<Prefix>documents/</Prefix>
</Filter>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>id2</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
The following is a sample PUT /?lifecycle request that adds the preceding lifecycle configuration to
the examplebucket bucket.
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Filter>
<Prefix>documents/</Prefix>
</Filter>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>id2</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: r+qR7+nhXtJDDIJ0JJYcd+1j5nM/rUFiiiZ/fNbDOsd3JUE8NWMLNHXmvPfwMpdc
x-amz-request-id: 9E26D08072A8EF9E
Date: Wed, 14 May 2014 02:11:22 GMT
Content-Length: 0
Server: AmazonS3
<LifeCycleConfiguration>
<Rule>
<ID>DeleteAfterBecomingNonCurrent</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<NoncurrentVersionExpiration>
<NoncurrentDays>100</NoncurrentDays>
</NoncurrentVersionExpiration>
</Rule>
<Rule>
<ID>TransitionAfterBecomingNonCurrent</ID>
<Filter>
<Prefix>documents/</Prefix>
</Filter>
<Status>Enabled</Status>
<NoncurrentVersionTransition>
<NoncurrentDays>30</NoncurrentDays>
<StorageClass>GLACIER</StorageClass>
</NoncurrentVersionTransition>
</Rule>
</LifeCycleConfiguration>
The following is a sample PUT /?lifecycle request that adds the preceding lifecycle configuration to
the examplebucket bucket.
<LifeCycleConfiguration>
<Rule>
<ID>DeleteAfterBecomingNonCurrent</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<NoncurrentVersionExpiration>
<NoncurrentDays>1</NoncurrentDays>
</NoncurrentVersionExpiration>
</Rule>
<Rule>
<ID>TransitionSoonAfterBecomingNonCurrent</ID>
<Filter>
<Prefix>documents/</Prefix>
</Filter>
<Status>Enabled</Status>
<NoncurrentVersionTransition>
<NoncurrentDays>0</NoncurrentDays>
<StorageClass>GLACIER</StorageClass>
</NoncurrentVersionTransition>
</Rule>
</LifeCycleConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: aXQ+KbIrmMmoO//3bMdDTw/CnjArwje+J49Hf+j44yRb/VmbIkgIO5A+PT98Cp/6k07hf+LD2mY=
x-amz-request-id: 02D7EC4C10381EB1
Date: Wed, 14 May 2014 02:21:50 GMT
Content-Length: 0
Server: AmazonS3
Additional Examples
Lifecycle configuration topic in the developer guide provides additional examples. For more information,
go to Examples of Lifecycle Configuration.
Related Resources
• GET Bucket lifecycle (p. 171)
• DELETE Bucket lifecycle (p. 114)
PUT PublicAccessBlock
Description
This operation creates or modifies the PublicAccessBlock configuration for an Amazon S3 bucket.
In order to use this operation, you must have the s3:PutBucketPublicAccessBlock permission. For
more information about Amazon S3 permissions, see Specifying Permissions in a Policy in the Amazon
Simple Storage Service Developer Guide.
Important
When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it
checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains
the object) and the bucket owner's account. If the PublicAccessBlock configurations are
different between the bucket and the account, Amazon S3 uses the most restrictive combination
of the bucket-level and account-level settings.
For more information about when Amazon S3 considers a bucket or an object public, see The Meaning of
"Public" in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /<bucket-name>?publicAccessBlock HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
x-amz-date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization string> (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This operation uses the following request elements. You can enable BlockPublicAcls,
IgnorePublicAcls, BlockPublicPolicy, and RestrictPublicBuckets in any combination.
A PublicAccessBlock configuration.
PublicAccessBlockConfiguration Yes
Type: Container
Important
Enabling this setting doesn't affect existing policies or ACLs.
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Type: Boolean
Ancestor: PublicAccessBlockConfiguration
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
First Sample Request
The following request puts a bucket PublicAccessBlock configuration that rejects public ACLs.
<PublicAccessBlockConfiguration>
<BlockPublicAcls>FALSE</BlockPublicAcls>
<IgnorePublicAcls>TRUE</IgnorePublicAcls>
<BlockPublicPolicy>FALSE</BlockPublicPolicy>
<RestrictPublicBuckets>TRUE</RestrictPublicBuckets>
</PublicAccessBlockConfiguration>
Related Resources
• Using Amazon S3 Block Public Access in the Amazon Simple Storage Service Developer Guide.
• GET PublicAccessBlock (p. 179)
• DELETE PublicAccessBlock (p. 115)
• GET BucketPolicyStatus (p. 195)
• GET PublicAccessBlock (p. 69)
• PUT PublicAccessBlock (p. 72)
• DELETE PublicAccessBlock (p. 68)
The bucket owner is automatically granted FULL_CONTROL to all logs. You use the Grantee request
element to grant access to other people. The Permissions request element specifies the kind of access
the grantee has to the logs.
To enable logging, you use LoggingEnabled and its children request elements. To disable logging, you
use an empty BucketLoggingStatus request element:
For more information about server access logging, see Server Access Logging in the Amazon Simple
Storage Service Developer Guide.
For more information about creating a bucket, see PUT Bucket (p. 252). For more information about
returning the logging status of a bucket, see GET Bucket logging (p. 183).
Requests
Syntax
PUT /?logging HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
Type: Container
Children: LoggingEnabled
Type: String
Children: None
Ancestry:
BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant.Grantee
Type: Container
Ancestry:
BucketLoggingStatus.LoggingEnabled.TargetGrants
Type: Container
Children: EmailAddress
Ancestry:
BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant
Type: Container
Ancestry: BucketLoggingStatus
Permission Logging permissions given to the Grantee for the bucket. The No
bucket owner is automatically granted FULL_CONTROL to all
logs delivered to the bucket. This optional element enables
you to grant access to others.
Type: String
Children: None
Ancestry:
BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant
Type: String
Children: None
Ancestry: BucketLoggingStatus.LoggingEnabled
Type: Container
Ancestry: BucketLoggingStatus.LoggingEnabled
TargetPrefix This element lets you specify a prefix for the keys that the log Yes,
files will be stored under. if the
TargetBucket
Type: String element
is
Children: None specified.
Ancestry: BucketLoggingStatus.LoggingEnabled
Grantee Values
You can specify the person (grantee) to whom you're assigning access rights (using request elements) in
the following ways:
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser"><ID><replaceable>ID</replaceable></
ID><DisplayName><replaceable>GranteesEmail</replaceable></DisplayName>
</Grantee>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AmazonCustomerByEmail"><EmailAddress><replaceable>Grantees@email.com</
replaceable></EmailAddress>lt;/Grantee>
The grantee is resolved to the CanonicalUser and, in a response to a GET Object acl request,
appears as the CanonicalUser.
• By URI:
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="Group"><URI><replaceable>http://acs.amazonaws.com/groups/global/
AuthenticatedUsers</replaceable></URI></Grantee>
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request enables logging and gives the grantee of the bucket READ access to the logs.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Related Resources
• PUT Object (p. 434)
• DELETE Bucket (p. 104)
• PUT Bucket (p. 252)
• GET Bucket logging (p. 183)
To use this operation, you must have permissions to perform the s3:PutMetricsConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
For information about CloudWatch request metrics for Amazon S3, see Monitoring Metrics with Amazon
CloudWatch in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /?metrics&id=id HTTP/1.1
HOST: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Request Parameters
This implementation of PUT uses the parameter in the following table.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
In the request, you must specify the metrics configuration in the request body, which is specified as XML.
The Examples section shows an example of a metrics configuration.
The following table describes the XML elements in the metrics configuration:
Type: Container
Ancestor: Filter
Type: Container
Children: And
Type: String
Ancestor: MetricsConfiguration
Ancestor: Tag
Type: Container
Ancestor: None
Type: String
Ancestor: And
Type: Container
Ancestor: And
Type: String
Ancestor: Tag
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
Amazon S3 checks the validity of the proposed MetricsConfiguration element and verifies whether
the proposed configuration is valid when you call the PUT operation. The following table lists the errors
and possible causes.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
First Sample Request
Put a metric configuration that enables metrics for an entire bucket.
Related Resources
• DELETE Bucket metrics (p. 116)
• GET Bucket metrics (p. 186)
• List Bucket Metrics Configurations (p. 240)
• Monitoring Metrics with Amazon CloudWatch in the Amazon Simple Storage Service Developer Guide.
Using this API, you can replace an existing notification configuration. The configuration is an XML file
that defines the event types that you want Amazon S3 to publish and the destination where you want
Amazon S3 to publish an event notification when it detects an event of the specified type.
By default, your bucket has no event notifications configured. That is, the notification configuration will
be an empty NotificationConfiguration.
<NotificationConfiguration>
</NotificationConfiguration>
This operation replaces the existing notification configuration with the configuration you include in the
request body.
After Amazon S3 receives this request, it first verifies that any Amazon Simple Notification Service
(Amazon SNS) or Amazon Simple Queue Service (Amazon SQS) destination exists, and that the bucket
owner has permission to publish to it by sending a test notification. In the case of AWS Lambda
destinations, Amazon S3 verifies that the Lambda function permissions grant Amazon S3 permission to
invoke the function from the Amazon S3 bucket. For more information, go to Configuring Notifications
for Amazon S3 Events in the Amazon Simple Storage Service Developer Guide.
By default, only the bucket owner can configure notifications on a bucket. However, bucket
owners can use a bucket policy to grant permission to other users to set this configuration with
s3:PutBucketNotification permission.
Note
The PUT notification is an atomic operation. For example, suppose your notification
configuration includes SNS topic, SQS queue, and Lambda function configurations. When
you send a PUT request with this configuration, Amazon S3 sends test messages to your SNS
topic. If the message fails, the entire PUT operation will fail, and Amazon S3 will not add the
configuration to your bucket.
Requests
Syntax
PUT /?notification HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
<NotificationConfiguration>
<TopicConfiguration>
<Id>ConfigurationId</Id>
<Filter>
<S3Key>
<FilterRule>
<Name>prefix</Name>
<Value>prefix-value</Value>
</FilterRule>
<FilterRule>
<Name>suffix</Name>
<Value>suffix-value</Value>
</FilterRule>
</S3Key>
</Filter>
<Topic>TopicARN</Topic>
<Event>event-type</Event>
<Event>event-type</Event>
...
</TopicConfiguration>
<QueueConfiguration>
<Id>ConfigurationId</Id>
<Filter>
...
</Filter>
<Queue>QueueARN</Queue>
<Event>event-type</Event>
<Event>event-type</Event>
...
</QueueConfiguration>
...
<CloudFunctionConfiguration>
<Id>ConfigurationId</Id>
<Filter>
...
</Filter>
<CloudFunction>cloud-function-arn</CloudFunction>
<Event>event-type</Event>
...
</CloudFunctionConfiguration>
...
</NotificationConfiguration>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
CloudFunction Lambda cloud function ARN that Amazon S3 can invoke Required if
when it detects events of the specified type. CloudFunctionConfigurat
is added.
Type: String
Ancestor: CloudFunctionConfiguration
Type: Container
Ancestor: NotificationConfiguration
Type: String
Type: Container
Children: S3Key
FilterRule Container for key value pair that defines the criteria for the No
filter rule.
Container S3Key
Type: Container
Ancestor: S3Key
Type: String
Type: String
Ancestor: FilterRule
Type: Container
Ancestor: None
Queue Amazon SQS queue ARN to which Amazon S3 will publish a Required if
message when it detects events of specified type. QueueConfiguration
is added.
Type: String
Ancestor: TopicConfiguration
Type: Container
Ancestor: NotificationConfiguration
S3Key Container for object key name prefix and suffix filtering No
rules.
Type: Container
Ancestor: Filter
Topic Amazon SNS topic ARN to which Amazon S3 will publish a Required if
message when it detects events of specified type. TopicConfiguration
is added.
Type: String
Ancestor: TopicConfiguration
Type: Container
Ancestor: NotificationConfiguration
Value Specifies the object key name prefix or suffix to filter on. No
Type: String
Ancestor: FilterRule
Responses
Response Headers
In addition to the common response headers (see Common Response Headers (p. 4)), if the
configuration in the request body includes only one TopicConfiguration specifying only the
s3:ReducedRedundancyLostObject event type, the response will also include the x-amz-sns-test-message-
id header containing the message ID of the test notification sent to topic.
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
Amazon S3 checks the validity of the proposed NotificationConfiguration element and verifies
whether the proposed configuration is valid when you call the PUT operation. The following table lists
the errors and possible causes.
HTTP 400 Bad InvalidArgument The following conditions can cause this error:
Request
• A specified event is not supported for notifications.
• A specified destination ARN does not exist or is not well-
formed. Verify the destination ARN.
• A specified destination is in a different region than the
bucket. You must use a destination that resides in the
same region as the bucket.
• The bucket owner does not have appropriate
permissions on the specified destination.
• An object key name filtering rule defined with
overlapping prefixes, overlapping suffixes, or
overlapping combinations of prefixes and suffixes for
the same event types.
HTTP 403 AccessDenied You are not the owner of the specified bucket, or you
Forbidden do not have the s3:PutBucketNotification bucket
permission to set the notification configuration on the
bucket.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Configure Notification to Invoke a cloud function in
Lambda
The following notification configuration includes CloudFunctionConfiguration, which identifies
the event type for which Amazon S3 can invoke a cloud function and the name of the cloud function to
invoke.
<NotificationConfiguration>
<CloudFunctionConfiguration>
<Id>ObjectCreatedEvents</Id>
<CloudFunction>arn:aws:lambda:us-west-2:35667example:function:CreateThumbnail</
CloudFunction>
<Event>s3:ObjectCreated:*</Event>
</CloudFunctionConfiguration>
</NotificationConfiguration>
The following PUT uploads the notification configuration. The operation replaces the existing
notification configuration.
[request body]
HTTP/1.1 200 OK
x-amz-id-2: 8+FlwagBSoT2qpMaGlfCUkRkFR5W3OeS7UhhoBb17j+kqvpS2cSFlgJ5coLd53d2
x-amz-request-id: E5BA4600A3937335
Date: Fri, 31 Oct 2014 01:49:50 GMT
Content-Length: 0
Server: AmazonS3
• A topic configuration identifying an SNS topic for Amazon S3 to publish events of the
s3:ReducedRedundancyLostObject type.
• A queue configuration identifying an SQS queue for Amazon S3 to publish events of the
s3:ObjectCreated:* type.
<NotificationConfiguration>
<TopicConfiguration>
<Topic>arn:aws:sns:us-east-1:356671443308:s3notificationtopic2</Topic>
<Event>s3:ReducedRedundancyLostObject</Event>
</TopicConfiguration>
<QueueConfiguration>
<Queue>arn:aws:sqs:us-east-1:356671443308:s3notificationqueue</Queue>
<Event>s3:ObjectCreated:*</Event>
</QueueConfiguration>
</NotificationConfiguration>
The following PUT request against the notification subresource of the examplebucket bucket sends the
preceding notification configuration in the request body. The operation replaces the existing notification
configuration on the bucket.
HTTP/1.1 200 OK
x-amz-id-2: SlvJLkfunoAGILZK3KqHSSUq4kwbudkrROmESoHOpDacULy+cxRoR1Svrfoyvg2A
x-amz-request-id: BB1BA8E12D6A80B7
Date: Mon, 13 Oct 2014 22:58:44 GMT
Content-Length: 0
Server: AmazonS3
<NotificationConfiguration>
<QueueConfiguration>
<Id>1</Id>
<Filter>
<S3Key>
<FilterRule>
<Name>prefix</Name>
<Value>images/</Value>
</FilterRule>
<FilterRule>
<Name>suffix</Name>
<Value>.jpg</Value>
</FilterRule>
</S3Key>
</Filter>
<Queue>arn:aws:sqs:us-west-2:444455556666:s3notificationqueue</Queue>
<Event>s3:ObjectCreated:Put</Event>
</QueueConfiguration>
</NotificationConfiguration>
The following PUT request against the notification subresource of the examplebucket bucket sends the
preceding notification configuration in the request body. The operation replaces the existing notification
configuration on the bucket.
HTTP/1.1 200 OK
x-amz-id-2: SlvJLkfunoAGILZK3KqHSSUq4kwbudkrROmESoHOpDacULy+cxRoR1Svrfoyvg2A
x-amz-request-id: BB1BA8E12D6A80B7
Date: Mon, 13 Oct 2014 22:58:44 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• GET Bucket notification (p. 190)
Places an Object Lock configuration on the specified bucket. The rule specified in the Object Lock
configuration will be applied by default to every new object placed in the specified bucket.
Request Syntax
PUT /?object-lock HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
Date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization-string> (see Authenticating Requests (AWS Signature Version
4))
<ObjectLockConfiguration>
<ObjectLockEnabled><value></ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode><value></Mode>
<Days><value></Days>
<Years><value></Years>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
Note
DefaultRetention requires either Days or Years. You can't specify both at the same time.
Request Body
For more information about the request elements that this operation uses, see
ObjectLockConfiguration (p. 544).
<ObjectLockConfiguration>
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>GOVERNANCE</Mode>
<Days>30</Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Related Resources
Locking Objects in the Amazon Simple Storage Service Developer Guide.
If you don't have PutBucketPolicy permissions, Amazon S3 returns a 403 Access Denied error. If
you have the correct permissions, but you're not using an identity that belongs to the bucket owner's
account, Amazon S3 returns a 405 Method Not Allowed error.
Important
As a security precaution, the root user of the AWS account that owns a bucket can always use
this operation, even if the policy explicitly denies the root user the ability to perform this action.
For more information about bucket policies, see Using Bucket Policies and User Policies in the Amazon
Simple Storage Service Developer Guide.
Requests
Syntax
PUT /?policy HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
The body is a JSON string containing the policy contents containing the policy statements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
PUT response elements return whether the operation succeeded or not.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request shows the PUT individual policy request for the bucket.
{
"Version":"2008-10-17",
"Id":"aaaa-bbbb-cccc-dddd",
"Statement" : [
{
"Effect":"Allow",
"Sid":"1",
"Principal" : {
"AWS":["111122223333","444455556666"]
},
"Action":["s3:*"],
"Resource":"arn:aws:s3:::bucket/*"
}
]
}
Sample Response
HTTP/1.1 204 No Content
x-amz-id-2: Uuag1LuByR5Onimru9SAMPLEAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732SAMPLE7374
Date: Tue, 04 Apr 2010 20:34:56 GMT
Connection: keep-alive
Server: AmazonS3
Related Resources
• PUT Bucket (p. 252)
• DELETE Bucket (p. 104)
Requests
Syntax
PUT /?replication HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string
Content-MD5: MD5
• For an overview of replication configuration XML and examples, see Replication Configuration
Overview in the Amazon S3 Developer Guide.
Important
This topic describes all of the XML elements that are supported in the latest version of the
replication configuration XML. For backward compatibility, Amazon S3 also continues to
support earlier versions. For more information, see Backward Compatibility in the Amazon S3
Developer Guide.
• For authorization, see Authenticating Requests (AWS Signature Version 4) (p. 14).
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Type: String
Default: None
Type: String
Request Body
Specify the replication configuration in the request body. In the replication configuration, you provide
the name of the destination bucket where you want Amazon S3 to replicate objects, the IAM role that
Amazon S3 can assume to replicate objects on your behalf, and other relevant information.
A replication configuration must include at least one rule, and can contain a maximum of 1,000. Each
rule identifies a subset of objects to replicate by filtering the objects in the source bucket. To choose
additional subsets of objects to replicate, add a rule for each subset. All rules must specify the same
destination bucket.
You can add other configuration options to rules. For more information, see Replication Configuration
Overview in the Amazon S3 Developer Guide.
Type: String
Ancestor: Destination
Type: Container
Children: Rule
Ancestor: None
Type: Container
Children: Rule
Ancestor: None
Type: String
Ancestor: Rule
Type: Container
Ancestor:ReplicationConfiguration
Type: String
Ancestor: Rule
Status If you don't set the Status to Enabled, the rule Yes
is ignored.
Type: String
Ancestor: Rule
Type: Container
Ancestor: Rule
Type: String
Ancestor: Destination
Type: String
Ancestor: Destination
Type: String
Ancestor: Destination
Specifying a Filter
To specify a subset of the objects in the source bucket to apply a replication rule to, add the Filter
element as a child of the Rule element. You can filter objects based on an object key prefix, one or more
object tags, or both. The following table describes the elements for filtering in a Rule.
Ancestor: Rule
And A container element for a Prefix and one or Yes, if you want to specify
more Tag elements. At least one child element is more than one filtering criteria.
required. For example, one object key
prefix and one or more object
Ancestor: Filter tags.
Type: String
Ancestor: Filter
Ancestor: Filter
Type: String
Ancestor: EncryptionConfiguration
Value Provides the object Tag Value. The Tag Key and No
Value are case sensitive. The Tag Value can have
0-256 characters.
Type: String
Ancestor: EncryptionConfiguration
When you add the Filter element in the configuration, you must also add the elements described in
this table.
Ancestor: Rule
Priority If you specify multiple rules with overlapping Yes, if Filter is specified
filters, identifies the rule priority. For example,
if two rules apply to the same object based on
the Filter specified, then the rule with higher
priority supersedes. The higher the numerical
value of this element, the higher the rule priority.
For more information, see Backward Compatibility
in the Amazon S3 Developer Guide.
Type: Integer
Ancestor: Rule
Type: String
Ancestor: SseKmsEncryptedObjects
ReplicaKmsKeyID Provides the AWS KMS Key ID (Key ARN or Alias Yes, if
ARN) of the destination bucket. Amazon S3 uses EncryptionConfigurati
this key to encrypt replicas. is specified
Type: String
Ancestor: EncryptionConfiguration
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
When you call the PUT operation, Amazon S3 checks the validity of the proposed
AnalyticsConfiguration element and verifies that the proposed configuration is valid. The following
table lists errors and possible causes.
HTTP 400 InvalidArgument The <Account> element is empty. It must contain a valid
account ID.
HTTP 400 InvalidArgument The AWS account specified in the <Account> element
must match the destination bucket owner.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
The following example shows how to add a replication configuration.
After you add a replication configuration to your bucket, Amazon S3 assumes the AWS Identity and
Access Management (IAM) role specified in the configuration to replicate objects on behalf of the bucket
owner. The bucket owner is the AWS account that created the bucket.
<ReplicationConfiguration>
<Role>arn:aws:iam::35667example:role/CrossRegionReplicationRoleForS3</Role>
<Rule>
<ID>rule1</ID>
<Status>Enabled</Status>
<Priority>1</Priority>
<DeleteMarkerReplication>
<Status>Disabled</Status>
</DeleteMarkerReplication>
<Filter>
<And>
<Prefix>TaxDocs</Prefix>
<Tag>
<Key>key1</Key>
<Value>value1</Value>
</Tag>
<Tag>
<Key>key1</Key>
<Value>value1</Value>
</Tag>
</And>
</Filter>
<Destination>
<Bucket>arn:aws:s3:::exampletargetbucket</Bucket>
</Destination>
</Rule>
</ReplicationConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: r+qR7+nhXtJDDIJ0JJYcd+1j5nM/rUFiiiZ/fNbDOsd3JUE8NWMLNHXmvPfwMpdc
x-amz-request-id: 9E26D08072A8EF9E
Date: Wed, 11 Feb 2015 02:11:22 GMT
Content-Length: 0
Server: AmazonS3
Filtering using the <Filter> element is supported in the latest XML configuration. If you are using
an earlier version of the XML configuration, you can filter only on key prefix. In that case, you add the
<Prefix> element as a child of the <Rule>.
For more examples of replication configuration, see Replication Configuration Overview in the Amazon
S3 Developer Guide.
Related Resources
• GET Bucket replication (p. 212).
• DELETE Bucket replication (p. 121).
• For information about enabling versioning on a bucket, see Using Versioning in the Amazon Simple
Storage Service Developer Guide.
• By default, a resource owner, in this case the AWS account that created the bucket, can perform this
operation. The resource owner can also grant others permissions to perform the operation. For more
information, see the following topics in the Amazon Simple Storage Service Developer Guide:
• Specifying Permissions in a Policy
• Managing Access Permissions to Your Amazon S3 Resources
Requests
Syntax
PUT ?requestPayment HTTP/1.1
Host: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization:signatureValue
<RequestPaymentConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Payer>payer</Payer>
</RequestPaymentConfiguration>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
Name Description
Payer Specifies who pays for the download and request fees.
Type: Enum
Ancestor: RequestPaymentConfiguration
Type: Container
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This request creates a Requester Pays bucket named "colorpictures."
<RequestPaymentConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Payer>Requester</Payer>
</RequestPaymentConfiguration>
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Location: /colorpictures
Content-Length: 0
Connection: close
Server: AmazonS3
Related Resources
• PUT Bucket (p. 252)
• GET Bucket requestPayment (p. 219)
Use tags to organize your AWS bill to reflect your own cost structure. To do this, sign up to get your AWS
account bill with tag key values included. Then, to see the cost of combined resources, organize your
billing information according to resources with the same tag key values. For example, you can tag several
resources with a specific application name, and then organize your billing information to see the total
cost of that application across several services. For more information, see Cost Allocation and Tagging in
About AWS Billing and Cost Management.
Note
Within a bucket, if you add a tag that has the same key as an existing tag, the new value
overwrites the old value. For more information, see Using Cost Allocation in Amazon S3 Bucket
Tags in AWS Billing and Cost Management.
To use this operation, you must have permissions to perform the s3:PutBucketTagging action.
The bucket owner has this permission by default and can grant this permission to others. For more
information about permissions, see Permissions Related to Bucket Subresource Operations and
Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service
Developer Guide.
Requests
Syntax
The following request shows the syntax for sending tagging information in the request body.
<Tagging>
<TagSet>
<Tag>
<Key>Tag Name</Key>
<Value>Tag Value</Value>
</Tag>
</TagSet>
</Tagging>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Content-MD5 will be a required header for this operation.
Request Elements
Type: String
Ancestors: None
Type: Container
Ancestors: Tagging
Type: Container
Ancestors: TagSet
Type: String
Ancestors: Tag
Type: String
Ancestors: Tag
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
• InvalidTagError - The tag provided was not a valid tag. This error can occur if the tag did not pass
input validation. For information about tag restrictions, see User-Defined Tag Restrictions and AWS-
Generated Cost Allocation Tag Restrictions in the AWS Billing and Cost Management User Guide.
• MalformedXMLError - The XML provided does not match the schema.
• OperationAbortedError - A conflicting conditional operation is currently in progress against this
resource. Please try again.
• InternalError - The service was unable to apply the provided tag to the bucket.
Examples
Sample Request: Add tag set to a bucket
The following request adds a tag set to the existing examplebucket bucket.
<Tagging>
<TagSet>
<Tag>
<Key>Project</Key>
<Value>Project One</Value>
</Tag>
<Tag>
<Key>User</Key>
<Value>jsmith</Value>
</Tag>
</TagSet>
</Tagging>
Sample Response
HTTP/1.1 204 No Content
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Oct 2012 12:00:00 GMT
Related Resources
• GET Bucket tagging (p. 221)
• DELETE Bucket tagging (p. 123)
You can set the versioning state with one of the following values:
If the versioning state has never been set on a bucket, it has no versioning state; a GET versioning
request does not return a versioning state value.
If the bucket owner enables MFA Delete in the bucket versioning configuration, the bucket owner must
include the x-amz-mfa request header and the Status and the MfaDelete request elements in a
request to set the versioning state of the bucket.
Important
If you have an object expiration lifecycle policy in your non-versioned bucket and you want to
maintain the same permanent delete behavior when you enable versioning, you must add a
noncurrent expiration policy. The noncurrent expiration lifecycle policy will manage the deletes
of the noncurrent object versions in the version-enabled bucket. (A version-enabled bucket
maintains one current and zero or more noncurrent object versions.) For more information, see
Lifecycle and Versioning in the Amazon Simple Storage Service Developer Guide.
For more information about creating a bucket, see PUT Bucket (p. 252). For more information about
returning the versioning state of a bucket, see GET Bucket Versioning Status (p. 224).
Requests
Syntax
PUT /?versioning HTTP/1.1
Host: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
x-amz-mfa: [SerialNumber] [TokenCode]
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>VersioningState</Status>
<MfaDelete>MfaDeleteState</MfaDelete>
</VersioningConfiguration>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
x-amz-mfa The value is the concatenation of the authentication device's serial Conditional
number, a space, and the value displayed on your authentication
device.
Type: String
Default: None
Request Elements
Type: Enum
Ancestor: VersioningConfiguration
Type: Enum
Ancestor: VersioningConfiguration
Type: Container
Children: Status
Ancestor: None
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request enables versioning for the specified bucket.
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</VersioningConfiguration>
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Sample Request
The following request suspends versioning for the specified bucket.
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Suspended</Status>
</VersioningConfiguration>
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Sample Request
The following request enables versioning and MFA Delete on a bucket.
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
<MfaDelete>Enabled</MfaDelete>
</VersioningConfiguration>
Note the space between [SerialNumber] and [TokenCode] and that you must include Status
whenever you use MfaDelete.
Sample Response
HTTPS/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar 2006 12:00:00 GMT
Location: /colorpictures
Content-Length: 0
Connection: close
Server: AmazonS3
Related Resources
• DELETE Bucket (p. 104)
• PUT Bucket (p. 252)
This PUT operation requires the S3:PutBucketWebsite permission. By default, only the bucket owner
can configure the website attached to a bucket; however, bucket owners can allow other users to set
the website configuration by writing a bucket policy that grants them the S3:PutBucketWebsite
permission.
Requests
Syntax
PUT /?website HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Content-Length: ContentLength
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<!-- website configuration information. -->
</WebsiteConfiguration>
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
You can use a website configuration to redirect all requests to the website endpoint of a bucket, or you
can add routing rules that redirect only specific requests.
• To redirect all website requests sent to the bucket's website endpoint, you add a website configuration
with the following elements. Because all requests are sent to another website, you don't need to
provide index document name for the bucket.
Type: Container
Type: Container
Ancestors: WebsiteConfiguration
Type: String
Ancestors: RedirectAllRequestsTo
Type: String
Ancestors: RedirectAllRequestsTo
• If you want granular control over redirects, you can use the following elements to add routing rules
that describe conditions for redirecting requests and information about the redirect destination. In
this case, the website configuration must provide an index document for the bucket, because some
requests might not be redirected.
Type: Container
Ancestors: None
Type: Container
Ancestors: WebsiteConfiguration
Type: String
Ancestors: WebsiteConfiguration.IndexDocument
Ancestors: WebsiteConfiguration
Key The object key name to use when a 4XX class error Conditional
occurs. This key identifies the page that is returned when
such an error occurs.
Type: String
Ancestors: WebsiteConfiguration.ErrorDocument
Type: Container
Ancestors: WebsiteConfiguration
RoutingRule Container for one routing rule that identifies a condition Yes
and a redirect that applies when the condition is met.
Type: String
Ancestors: WebsiteConfiguration.RoutingRules
Type: Container
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule
KeyPrefixEquals The object key name prefix when the redirect Conditional
is applied. For example, to redirect requests
for ExamplePage.html, the key prefix will be
ExamplePage.html. To redirect request for all pages
with the prefix docs/, the key prefix will be /docs,
which identifies all objects in the docs/ folder.
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Condition
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Condition
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
ReplaceKeyWith The specific object key to use in the redirect request. For No
example, redirect request to error.html.
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Type: String
Ancestors:
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Examples
Example 1: Configure bucket as a website (add website
configuration)
The following request configures a bucket example.com as a website. The configuration in the
request specifies index.html as the index document. It also specifies the optional error document,
SomeErrorDocument.html.
<WebsiteConfiguration xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>SomeErrorDocument.html</Key>
</ErrorDocument>
</WebsiteConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 80CD4368BD211111
Date: Thu, 27 Jan 2011 00:00:00 GMT
Content-Length: 0
Server: AmazonS3
<WebsiteConfiguration xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>
<RedirectAllRequestsTo>
<HostName>example.com</HostName>
</RedirectAllRequestsTo>
</WebsiteConfiguration>
This redirect can be useful when you want to serve requests for both http://www.example.com and
http://example.com, but you want to maintain the website content in only one bucket, in this case
example.com. For more information, go to Hosting Websites on Amazon S3 in the Amazon Simple
Storage Service Developer Guide.
index.html
docs/article1.html
docs/article2.html
If you decided to rename the folder from docs/ to documents/, you would need to redirect requests
for prefix /docs to documents/. For example, a request for docs/article1.html will need to be
redirected to documents/article1.html.
In this case, you update the website configuration and add a routing rule as shown in the following
request:
<WebsiteConfiguration xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>Error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>docs/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith>documents/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
Host: www.example.com.s3.amazonaws.com
Content-Length: 580
Date: Thu, 27 Jan 2011 12:00:00 GMT
Authorization: signatureValue
<WebsiteConfiguration xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>Error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals >
</Condition>
<Redirect>
<HostName>ec2-11-22-333-44.compute-1.amazonaws.com</HostName>
<ReplaceKeyPrefixWith>report-404/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
images/photo1.jpg
images/photo2.jpg
images/photo3.jpg
Now you want to route requests for all pages with the images/ prefix to go to a single page,
errorpage.html. You can add a website configuration to your bucket with the routing rule shown in
the following request:
<WebsiteConfiguration xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>Error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>images/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>errorpage.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
Operations on Objects
This section describes operations you can perform on Amazon S3 objects.
Topics
• Delete Multiple Objects (p. 354)
• DELETE Object (p. 364)
• DELETE Object tagging (p. 368)
• GET Object (p. 370)
• GET Object ACL (p. 383)
• GET Object legal hold (p. 387)
• GET Object retention (p. 388)
• GET Object tagging (p. 389)
• GET Object torrent (p. 392)
• HEAD Object (p. 394)
• OPTIONS object (p. 404)
• POST Object (p. 407)
• POST Object restore (p. 419)
• PUT Object (p. 434)
• PUT Object legal hold (p. 449)
• PUT Object retention (p. 450)
• PUT Object - Copy (p. 451)
• PUT Object acl (p. 467)
• PUT Object tagging (p. 474)
• SELECT Object Content (p. 477)
• Abort Multipart Upload (p. 504)
• Complete Multipart Upload (p. 506)
• Initiate Multipart Upload (p. 512)
• List Parts (p. 522)
• Upload Part (p. 528)
• Upload Part - Copy (p. 534)
The Multi-Object Delete request contains a list of up to 1000 keys that you want to delete. In the XML,
you provide the object key names, and optionally, version IDs if you want to delete a specific version of
the object from a versioning-enabled bucket. For each key, Amazon S3 performs a delete operation and
returns the result of that delete, success, or failure, in the response. Note that, if the object specified in
the request is not found, Amazon S3 returns the result as deleted.
The Multi-Object Delete operation supports two modes for the response; verbose and quiet. By default,
the operation uses verbose mode in which the response includes the result of deletion of each key in
your request. In quiet mode the response includes only keys where the delete operation encountered an
error. For a successful deletion, the operation does not return any information about the delete in the
response body.
When performing a Multi-Object Delete operation on an MFA Delete enabled bucket, that attempts
to delete any versioned objects, you must include an MFA token. If you do not provide one, the entire
request will fail, even if there are non versioned objects you are attempting to delete. If you provide
an invalid token, whether there are versioned keys in the request or not, the entire Multi-Object Delete
request will fail. For information about MFA Delete, see MFA Delete.
Finally, the Content-MD5 header is required for all Multi-Object Delete requests. Amazon S3 uses the
header value to ensure that your request body has not been altered in transit.
Requests
Syntax
POST /?delete HTTP/1.1
Host: bucketname.s3.amazonaws.com
Authorization: authorization string
Content-Length: Size
Content-MD5: MD5
Request Parameters
The Multi-Object Delete operation requires a single query string parameter called "delete" to distinguish
it from other bucket POST operations.
Request Headers
This operation uses the following Request Headers in addition to the request headers common to most
requests. For more information, see Common Request Headers (p. 2).
Content-MD5 The base64-encoded 128-bit MD5 digest of the data. This header Yes
must be used as a message integrity check to verify that the request
body was not corrupted in transit. For more information, go to RFC
1864.
Type: String
Default: None
Default: None
Type: String
Default: None
Request Elements
Ancestor: None
Type: Container
Quiet Element to enable quiet mode for the request. When you No
add this element, you must set its value to true.
Ancestor: Delete
Type: Boolean
Default: false
Object Container element that describes the delete request for an Yes
object.
Ancestor: Delete
Type: Container
Ancestor: Object
Type: String
Ancestor: Object
Responses
Response Headers
This operation uses only response headers that are common to most responses. For more information,
see Common Response Headers (p. 4).
Response Elements
Name Description
Type: Container
Ancestor: None
Type: Container
Ancestor: DeleteResult
Type: String
Type: String
Ancestor: Deleted
Type: Boolean
Name Description
Ancestor: Deleted
Type: String
Ancestor: Deleted
Type: String
Ancestor: DeleteResult
Type: String
Ancestor: Error
Type: String
Type: String
Ancestor: Error
Name Description
Type: String
Ancestor: Error
Examples
Example 1: Multi-Object Delete resulting in mixed success/error
response
This example illustrates a Multi-Object Delete request to delete objects that result in mixed success and
errors response.
Sample Request
The following Multi-Object Delete request deletes two objects from a bucket (bucketname). In this
example, the requester does not have permission to delete the sample2.txt object.
<Delete>
<Object>
<Key>sample1.txt</Key>
</Object>
<Object>
<Key>sample2.txt</Key>
</Object>
</Delete>
Sample Response
The response includes a DeleteResult element that includes a Deleted element for the item that
Amazon S3 successfully deleted and an Error element that Amazon S3 did not delete because you
didn't have permission to delete the object.
HTTP/1.1 200 OK
x-amz-id-2: 5h4FxSNCUS7wP5z92eGCWDshNpMnRuXvETa4HH3LvvH6VAIr0jU7tH9kM7X+njXx
x-amz-request-id: A437B3B641629AEE
Date: Fri, 02 Dec 2011 01:53:42 GMT
Content-Type: application/xml
Server: AmazonS3
Content-Length: 251
<Error>
<Key>sample2.txt</Key>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
</Error>
</DeleteResult>
The following scenarios describe the behavior of a Multi-Object Delete request when versioning is
enabled for your bucket.
<Delete>
<Object>
<Key>SampleDocument.txt</Key>
</Object>
</Delete>
Because versioning is enabled on the bucket, Amazon S3 does not delete the object. Instead, it
adds a delete marker for this object. The response indicates that a delete marker was added (the
DeleteMarker element in the response as a value of true) and the version number of the delete marker
it added.
HTTP/1.1 200 OK
x-amz-id-2: P3xqrhuhYxlrefdw3rEzmJh8z5KDtGzb+/FB7oiQaScI9Yaxd8olYXc7d1111ab+
x-amz-request-id: 264A17BF16E9E80A
Date: Wed, 30 Nov 2011 03:39:32 GMT
Content-Type: application/xml
Server: AmazonS3
Content-Length: 276
Host: bucketname.s3.amazonaws.com
Accept: */*
x-amz-date: Wed, 30 Nov 2011 03:39:05 GMT
Content-MD5: p5/WA/oEr30qrEEl21PAqw==
Authorization: AWS AKIAIOSFODNN7EXAMPLE:W0qPYCLe6JwkZAD1ei6hp9XZIxx=
Content-Length: 140
Connection: Keep-Alive
<Delete>
<Object>
<Key>SampleDocument.txt</Key>
<VersionId>OYcLXagmS.WaD..oyH4KRguB95_YhLs7</VersionId>
</Object>
</Delete>
In this case, Amazon S3 deletes the specific object version from the bucket and returns the following
response. In the response, Amazon S3 returns the key and version ID of the object deleted.
HTTP/1.1 200 OK
x-amz-id-2: P3xqrhuhYxlrefdw3rEzmJh8z5KDtGzb+/FB7oiQaScI9Yaxd8olYXc7d1111xx+
x-amz-request-id: 264A17BF16E9E80A
Date: Wed, 30 Nov 2011 03:39:32 GMT
Content-Type: application/xml
Server: AmazonS3
Content-Length: 219
HTTP/1.1 200 OK
x-amz-id-2: IIPUZrtolxDEmWsKOae9JlSZe6yWfTye3HQ3T2iAe0ZE4XHa6NKvAJcPp51zZaBr
x-amz-request-id: D6B284CEC9B05E4E
Date: Wed, 30 Nov 2011 03:43:25 GMT
Content-Type: application/xml
Server: AmazonS3
Content-Length: 331
In general, when a Multi-Object Delete request results in Amazon S3 either adding a delete marker or
removing a delete marker, the response returns the following elements.
Example
<DeleteMarker>true</DeleteMarker>
<DeleteMarkerVersionId>NeQt5xeFTfgPJD8B4CGWnkSLtluMr11s</DeleteMarkerVersionId>
Sample Request
The following requests sends a malformed XML document (missing the Delete end element).
<Delete>
<Object>
<Key>404.txt</Key>
</Object>
<Object>
<Key>a.txt</Key>
</Object>
Sample Response
The response returns the Error messages that describe the error.
HTTP/1.1 200 OK
x-amz-id-2: P3xqrhuhYxlrefdw3rEzmJh8z5KDtGzb+/FB7oiQaScI9Yaxd8olYXc7d1111ab+
x-amz-request-id: 264A17BF16E9E80A
Date: Wed, 30 Nov 2011 03:39:32 GMT
Content-Type: application/xml
Server: AmazonS3
Content-Length: 207
Related Actions
• Initiate Multipart Upload (p. 512)
• Upload Part (p. 528)
• Complete Multipart Upload (p. 506)
• Abort Multipart Upload (p. 504)
DELETE Object
Description
The DELETE operation removes the null version (if there is one) of an object and inserts a delete marker,
which becomes the current version of the object. If there isn't a null version, Amazon S3 does not remove
any objects.
Versioning
To remove a specific version, you must be the bucket owner and you must use the versionId
subresource. Using this subresource permanently deletes the version. If the object deleted is a delete
marker, Amazon S3 sets the response header, x-amz-delete-marker, to true.
If the object you want to delete is in a bucket where the bucket versioning configuration is MFA Delete
enabled, you must include the x-amz-mfa request header in the DELETE versionId request. Requests
that include x-amz-mfa must use HTTPS.
For more information about MFA Delete, go to Using MFA Delete. To see sample requests that use
versioning, see Sample Request (p. 366).
You can delete objects by explicitly calling the DELETE Object API or configure its lifecycle (see PUT
Bucket lifecycle (p. 290)) to enable Amazon S3 to remove them for you. If you want to block users or
accounts from removing or deleting objects from your bucket you must deny them s3:DeleteObject,
s3:DeleteObjectVersion and s3:PutLifeCycleConfiguration actions.
Requests
Syntax
DELETE /ObjectName HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Content-Length: length
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
x-amz-mfa The value is the concatenation of the authentication device's serial Conditional
number, a space, and the value displayed on your authentication
device.
Type: String
Default: None
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
Header Description
x-amz-delete- Specifies whether the versioned object that was permanently deleted was
marker (true) or was not (false) a delete marker. In a simple DELETE, this header
indicates whether (true) or not (false) a delete marker was created.
Type: Boolean
Default: false
x-amz-version- Returns the version ID of the delete marker created as a result of the DELETE
id operation. If you delete a specific object version, the value returned by this
header is the version ID of the object version deleted.
Type: String
Default: None
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request deletes the object, my-second-image.jpg.
Sample Response
HTTP/1.1 204 NoContent
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
Date: Wed, 12 Oct 2009 17:50:00 GMT
Content-Length: 0
Connection: close
Server: AmazonS3
DELETE /my-third-image.jpg?versionId=UIORUnfndfiufdisojhr398493jfdkjFJjkndnqUifhnw89493jJFJ
HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain
Content-Length: 0
Sample Response
HTTP/1.1 204 NoContent
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
x-amz-version-id: UIORUnfndfiufdisojhr398493jfdkjFJjkndnqUifhnw89493jJFJ
Date: Wed, 12 Oct 2009 17:50:00 GMT
Content-Length: 0
Connection: close
Server: AmazonS3
Sample Response
HTTP/1.1 204 NoContent
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
x-amz-version-id: UIORUnfndfiuf
Date: Wed, 12 Oct 2009 17:50:00 GMT
Content-Length: 0
Connection: close
Server: AmazonS3
Related Resources
• PUT Object (p. 434)
• DELETE Object (p. 364)
To use this operation, you must have permission to perform the s3:DeleteObjectTagging action.
To delete tags of a specific object version, add the versionId query parameter in the request. You will
need permission for the s3:DeleteObjectVersionTagging action.
Requests
Syntax
DELETE /ObjectKey?tagging HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Examples
Sample Request
The following DELETE request deletes the tag set from the specified object.
Sample Response
The following successful response shows Amazon S3 returning a 204 No Content response. The tag set
for the object has been removed.
Related Resources
• PUT Object tagging (p. 474)
• GET Object tagging (p. 389)
GET Object
Description
This implementation of the GET operation retrieves objects from Amazon S3. To use GET, you must have
READ access to the object. If you grant READ access to the anonymous user, you can return the object
without using an authorization header.
An Amazon S3 bucket has no directory hierarchy such as you would find in a typical computer file
system. You can, however, create a logical hierarchy by using object key names that imply a folder
structure. For example, instead of naming an object sample.jpg, you can name it photos/2006/
February/sample.jpg.
To get an object from such a logical hierarchy, specify the full key name for the object in the GET
operation. For a virtual hosted-style request example, if you have the object photos/2006/February/
sample.jpg, specify the resource as /photos/2006/February/sample.jpg. For a path-style
request example, if you have the object photos/2006/February/sample.jpg in the bucket named
examplebucket, specify the resource as /examplebucket/photos/2006/February/sample.jpg.
For more information about request types, see HTTP Host Header Bucket Specification in the Amazon
Simple Storage Service Developer Guide.
To distribute large files to many people, you can save bandwidth costs by using BitTorrent. For more
information, see Amazon S3 Torrent in the Amazon Simple Storage Service Developer Guide. For more
information about returning the ACL of an object, see GET Object ACL (p. 383).
If the object you are retrieving is stored in the GLACIER or DEEP_ARCHIVE storage classes, before you can
retrieve the object you must first restore a copy using the POST Object restore (p. 419) API. Otherwise,
this operation returns an InvalidObjectStateError error. For information about restoring archived
objects, see Restoring Archived Objects in the Amazon Simple Storage Service Developer Guide.
If you encrypt an object by using server-side encryption with customer-provided encryption keys (SSE-
C) when you store the object in Amazon S3, then when you GET the object, you must use the headers
documented in the section Specific Request Headers for Server-Side Encryption with Customer-Provided
Encryption Keys (p. 374). For more information about SSE-C, go to Server-Side Encryption (Using
Customer-Provided Encryption Keys) in the Amazon Simple Storage Service Developer Guide.
Assuming you have permission to read object tags (permission for the s3:GetObjectVersionTagging
action), the response also returns the x-amz-tagging-count header that provides the count of
number of tags associated with the object. You can use the "GET Object tagging" API (see GET Object
tagging (p. 389)) to retrieve the tag set associated with an object.
Permissions
You need the s3:GetObject permission for this operation. For more information, go to Specifying
Permissions in a Policy in the Amazon Simple Storage Service Developer Guide. If the object you request
does not exist, the error Amazon S3 returns depends on whether you also have the s3:ListBucket
permission.
• If you have the s3:ListBucket permission on the bucket, Amazon S3 will return an HTTP status code
404 ("no such key") error.
• if you don’t have the s3:ListBucket permission, Amazon S3 will return an HTTP status code 403
("access denied") error.
Versioning
By default, the GET operation returns the current version of an object. To return a different version, use
the versionId subresource.
Note
If the current version of the object is a delete marker, Amazon S3 behaves as if the object was
deleted and includes x-amz-delete-marker: true in the response.
For more information about versioning, see PUT Bucket versioning (p. 341) To see sample requests that
use versioning, see Sample Request Getting a Specified Version of an Object (p. 380) .
Requests
Syntax
GET /ObjectName HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Range:bytes=byte_range
Request Parameters
Type: Integer
Default: None
Type: String
Default: None
There are times when you want to override certain response header values in a GET response. For
example, you might override the Content-Disposition response header value in your GET request.
You can override values for a set of response headers using the query parameters listed in the following
table. These response header values are sent only on a successful request, that is, when status code 200
OK is returned. The set of headers you can override using these parameters is a subset of the headers
that Amazon S3 accepts when you create an object. The response headers that you can override for
the GET response are Content-Type, Content-Language, Expires, Cache-Control, Content-
Disposition, and Content-Encoding. To override these header values in the GET response, you use
the request parameters described in the following table.
Note
You must sign the request, either using an Authorization header or a presigned URL, when
using these parameters. They cannot be used with an unsigned (anonymous) request.
Type: String
Default: None
Default: None
Type: String
Default: None
Type: String
Default: None
Default: None
Default: None
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
Default: None
Constraints: None
If-Modified- Return the object only if it has been modified since the specified No
Since time, otherwise return a 304 (not modified).
Type: String
Default: None
Constraints: None
If-Unmodified- Return the object only if it has not been modified since the No
Since specified time, otherwise return a 412 (precondition failed).
Type: String
Default: None
Constraints: None
If-Match Return the object only if its entity tag (ETag) is the same as the No
one specified; otherwise, return a 412 (precondition failed).
Type: String
Default: None
Constraints: None
If-None-Match Return the object only if its entity tag (ETag) is different from the No
one specified; otherwise, return a 304 (not modified).
Type: String
Default: None
Constraints: None
Note
Encryption request headers, like x-amz-server-side-encryption, should not be sent for
GET requests if your object uses server-side encryption with AWS KMS–managed encryption
keys (SSE-KMS) or server-side encryption with Amazon S3–managed encryption keys (SSE-S3). If
your object does use these types of keys, you’ll get an HTTP 400 BadRequest error.
Note the following additional considerations about the preceding request headers:
• Consideration 1 – If both of the If-Match and If-Unmodified-Since headers are present in the
request as follows:
then, S3 returns 200 OK and the data requested. For more information about conditional requests, see
RFC 7232.
• Consideration 2 – If both of the If-None-Match and If-Modified-Since headers are present in
the request as follows:
then, S3 returns 304 Not Modified response code. For more information about conditional
requests, see RFC 7232.
x-amz-server- Specifies the algorithm to use to when decrypting the requested Yes
side-encryption object.
-customer-
algorithm Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
Header Description
x-amz-delete- Specifies whether the object retrieved was (true) or was not (false) a delete
marker marker. If false, this response header does not appear in the response.
Type: Boolean
Default: false
x-amz- Amazon S3 returns this header if an Expiration action is configured for the
expiration object as part of the bucket's lifecycle configuration. The header value includes
an "expiry-date" component and a URL-encoded "rule-id" component. Note that
for versioning-enabled buckets, this header applies only to current versions;
Amazon S3 does not provide a header to infer when a noncurrent version will
be eligible for permanent deletion. For more information, see PUT Bucket
lifecycle (p. 290).
Type: String
x-amz-meta-* Headers starting with this prefix are user-defined metadata. Each one is stored
and returned as a set of key-value pairs. Amazon S3 doesn't validate or interpret
user-defined metadata.
Type: String
x-amz- Amazon S3 can return this header if your request involves a bucket that is either
replication- a source or destination in a cross-region replication.
status
In cross-region replication you have a source bucket on which you configure
replication and destination bucket where Amazon S3 stores object replicas.
Header Description
When you request an object (GET Object) or object metadata (HEAD Object)
from these buckets, Amazon S3 will return the x-amz-replication-status
header in the response as follow:
• If requesting object from the source bucket — Amazon S3 will return the x-
amz-replication-status header if object in your request is eligible for
replication.
Type: String
x-amz-server- If the object is stored using server-side encryption either with an AWS KMS or an
side-encryption Amazon S3-managed encryption key, the response includes this header with the
value of the encryption algorithm used.
Type: String
Header Description
x-amz-storage- Provides storage class information of the object. Amazon S3 returns this header
class for all objects except for Standard storage class objects.
Type: String
Default: None
x-amz-restore Provides information about the object restoration operation and expiration time
of the restored object copy.
Type: String
Default: None
x-amz-tagging- Returns the count of the tags associated with the object. This header is returned
count only if the count is greater than zero.
Type: String
Default: None
x-amz-version- Returns the version ID of the retrieved object if it has a unique version ID.
id
Type: String
Default: None
x-amz-website When a bucket is configured as a website, you can set this metadata on the
-redirect- object so the website endpoint will evaluate the request for the object as a 301
location redirect to another object in the same bucket or an external URL.
Type: String
Default: None
x-amz-object- The Object Lock mode, if any, that's in effect for this object. This header is only
lock-mode returned if the requester has the s3:GetObjectRetention permission. For
more information about S3 Object Lock, see Object Lock in the Amazon Simple
Storage Service Developer Guide.
Type: String
x-amz-object- The date and time when the Object Lock retention period expires. This header is
lock-retain- only returned if the requester has the s3:GetObjectRetention permission.
until-date
Type: Timestamp
Format: 2020-01-05T00:00:00.000Z
Header Description
x-amz-object- Specifies whether a legal hold is in effect for this object. This header is only
lock-legal-hold returned if the requester has the s3:GetObjectLegalHold permission. This
header is not returned if the specified version of this object has never had a legal
hold applied. For more information about legal holds, see Object Lock in the
Amazon Simple Storage Service Developer Guide.
Type: String
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the object, my-image.jpg.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Mon, 3 Oct 2016 22:32:00 GMT
Last-Modified: Wed, 12 Oct 2009 17:50:00 GMT
ETag: "fba9dede5f27731c9771645a39863328"
Content-Length: 434234
If the object had tags associated with it, Amazon S3 returns the x-amz-tagging-count header with
tag count.
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Mon, 3 Oct 2016 22:32:00 GMT
Last-Modified: Wed, 12 Oct 2009 17:50:00 GMT
ETag: "fba9dede5f27731c9771645a39863328"
Content-Length: 434234
x-amz-tagging-count: 2
If the object had expiration set using lifecycle configuration, you get the following response with the x-
amz-expiration header.
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Wed, 12 Oct 2009 17:50:00 GMT
x-amz-expiration: expiry-date="Fri, 23 Dec 2012 00:00:00 GMT", rule-id="picture-deletion-
rule"
ETag: "fba9dede5f27731c9771645a39863328"
Content-Length: 434234
Content-Type: text/plain
<Error>
<Code>InvalidObjectState</Code>
<Message>The operation is not valid for the object's storage class</Message>
<RequestId>9FEFFF118E15B86F</RequestId>
<HostId>WVQ5kzhiT+oiUfDCOiOYv8W4Tk9eNcxWi/MK+hTS/av34Xy4rBU3zsavf0aaaaa</HostId>
</Error>
Notice that the delete marker returns a 404 Not Found error.
Host: bucket.s3.amazonaws.com
Date: Mon, 3 Oct 2016 22:32:00 GMT
Authorization: authorization string
GET /Junk3.txt?response-cache-control=No-cache&response-content-disposition=attachment%3B
%20filename%3Dtesting.txt&response-content-encoding=x-gzip&response-content-language=mi%2C
%20en&response-expires=Thu%2C%2001%20Dec%201994%2016:00:00%20GMT HTTP/1.1
x-amz-date: Sun, 19 Dec 2010 01:53:44 GMT
Accept: */*
Authorization: AWS AKIAIOSFODNN7EXAMPLE:aaStE6nKnw8ihhiIdReoXYlMamW=
HTTP/1.1 200 OK
x-amz-id-2: SIidWAK3hK+Il3/Qqiu1ZKEuegzLAAspwsgwnwygb9GgFseeFHL5CII8NXSrfWW2
x-amz-request-id: 881B1CBD9DF17WA1
Date: Sun, 19 Dec 2010 01:54:01 GMT
x-amz-meta-param1: value 1
x-amz-meta-param2: value 2
Cache-Control: No-cache
Content-Language: mi, en
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Content-Disposition: attachment; filename=testing.txt
Content-Encoding: x-gzip
Last-Modified: Fri, 17 Dec 2010 18:10:41 GMT
ETag: "0332bee1a7bf845f176c5c0d1ae7cf07"
Accept-Ranges: bytes
Content-Type: text/plain
Content-Length: 22
Server: AmazonS3
Note
Amazon S3 doesn't support retrieving multiple ranges of data per GET request.
Sample Response
In the following sample response, note that the header values are set to the values specified in the true
request.
Accept: */*
Authorization:authorization string
Date: Wed, 28 May 2014 19:24:44 +0000
x-amz-server-side-encryption-customer-key:g0lCfA3Dv40jZz5SQJ1ZukLRFqtI5WorC/8SEKEXAMPLE
x-amz-server-side-encryption-customer-key-MD5:ZjQrne1X/iTcskbY2m3example
x-amz-server-side-encryption-customer-algorithm:AES256
The following sample response shows some of the response headers Amazon S3 returns. Note that it
includes the encryption information in the response.
HTTP/1.1 200 OK
x-amz-id-2: ka5jRm8X3N12ZiY29Z989zg2tNSJPMcK+to7jNjxImXBbyChqc6tLAv+sau7Vjzh
x-amz-request-id: 195157E3E073D3F9
Date: Wed, 28 May 2014 19:24:45 GMT
Last-Modified: Wed, 28 May 2014 19:21:01 GMT
ETag: "c12022c9a3c6d3a28d29d90933a2b096"
x-amz-server-side-encryption-customer-algorithm: AES256
x-amz-server-side-encryption-customer-key-MD5: ZjQrne1X/iTcskbY2m3example
Related Resources
• GET Service (p. 65)
• GET Object ACL (p. 383)
Versioning
By default, GET returns ACL information about the current version of an object. To return ACL
information about a different version, use the versionId subresource.
To see sample requests that use Versioning, see Sample Request Getting the ACL of the Specific Version
of an Object (p. 385).
Requests
Syntax
GET /ObjectName?acl HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Range:bytes=byte_range
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Name Description
Type: Container
Ancestors: AccessControlPolicy
AccessControlPolicy Contains the elements that set the ACL permissions for an object per
Grantee.
Type: Container
Ancestors: None
Type: String
Ancestors: AccessControlPolicy.Owner
Type: Container
Ancestors: AccessControlPolicy.AccessControlList
Type: String
Ancestors: AccessControlPolicy.AccessControlList.Grant
Type: String
Ancestors: AccessControlPolicy.Owner or
AccessControlPolicy.AccessControlList.Grant
Owner Container for the bucket owner's display name and ID.
Type: Container
Ancestors: AccessControlPolicy
Type: String
Ancestors: AccessControlPolicy.AccessControlList.Grant
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns information, including the ACL, of the object, my-image.jpg.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-version-id: 4HL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nrjfkd
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
Content-Length: 124
Content-Type: text/plain
Connection: close
Server: AmazonS3
<AccessControlPolicy>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
<AccessControlPolicy>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mdtd@amazon.com</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mdtd@amazon.com</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Related Resources
• GET Object (p. 370)
• PUT Object (p. 434)
• DELETE Object (p. 364)
Request Syntax
GET /<object-key>?legal-hold&versionId=<version-id> HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
Date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization-string> (see Authenticating Requests (AWS Signature Version
4))
The version ID for the object version whose retention settings you want to retrieve.
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<LegalHold>
<Status>string</Status>
</LegalHold>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
For more information about the response elements that this operation returns, see
ObjectLockLegalHold (p. 545).
Related Resources
Locking Objects in the Amazon Simple Storage Service Developer Guide.
Request Syntax
GET /<object-key>?retention&versionId=<version-id> HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
Date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization-string> (see Authenticating Requests (AWS Signature Version
4))
The version ID for the object version whose retention settings you want to retrieve.
Request Body
The request does not have a request body.
Response Syntax
<Retention>
<Mode><value></Mode>
<RetainUntilDate><value></RetainUntilDate>
</Retention>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
For more information about the response elements this operation returns, see
ObjectLockRetention (p. 546).
Related Resources
Locking Objects in the Amazon Simple Storage Service Developer Guide.
To use this operation, you must have permission to perform the s3:GetObjectTagging action.
By default, the GET operation returns information about current version of an object. For a
versioned bucket, you can have multiple versions of an object in your bucket. To retrieve tags
of any other version, use the versionId query parameter. You also need permission for the
s3:GetObjectVersionTagging action.
By default, the bucket owner has this permission and can grant this permission to others.
For information about the Amazon S3 object tagging feature, see Object Tagging in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
GET /ObjectName?tagging HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
Name Description
Name Description
Type: Container
Ancestors: None
Type: Container
Ancestors: Tagging
Type: Container
Ancestors: TagSet
Type: String
Ancestors: Tag
Type: String
Ancestors: Tag
Examples
Sample Request
The following request returns the tag set of the specified object.
Sample Response
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2016 21:33:08 GMT
Connection: close
Server: AmazonS3
<?xml version="1.0" encoding="UTF-8"?>
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>tag1</Key>
<Value>val1</Value>
</Tag>
<Tag>
<Key>tag2</Key>
<Value>val2</Value>
</Tag>
</TagSet>
</Tagging>
Related Resources
• PUT Object tagging (p. 474)
Requests
Syntax
GET /ObjectName?torrent HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Getting Torrent Files in a Bucket
This example retrieves the Torrent file for the "Nelson" object in the "quotes" bucket.
Sample Response
HTTP/1.1 200 OK
x-amz-request-id: 7CD745EBB7AB5ED9
Date: Wed, 25 Nov 2009 12:00:00 GMT
Content-Disposition: attachment; filename=Nelson.torrent;
Content-Type: application/x-bittorrent
Content-Length: 537
Server: AmazonS3
Related Resources
• GET Object (p. 370)
HEAD Object
Description
The HEAD operation retrieves metadata from an object without returning the object itself. This operation
is useful if you are interested only in an object's metadata. To use HEAD, you must have READ access to
the object.
A HEAD request has the same options as a GET operation on an object. The response is identical to the
GET response except that there is no response body.
If you encrypt an object by using server-side encryption with customer-provided encryption keys (SSE-
C) when you store the object in Amazon S3, then when you retrieve the metadata from the object, you
must use the headers documented in the section Specific Request Headers for Server-Side Encryption
with Customer-Provided Encryption Keys (p. 397). For more information about SSE-C, go to Server-
Side Encryption (Using Customer-Provided Encryption Keys) in the Amazon Simple Storage Service
Developer Guide.
Permissions
You need the s3:GetObject permission for this operation. For more information, go to Specifying
Permissions in a Policy in the Amazon Simple Storage Service Developer Guide. If the object you request
does not exist, the error Amazon S3 returns depends on whether you also have the s3:ListBucket
permission.
• If you have the s3:ListBucket permission on the bucket, Amazon S3 will return a HTTP status code
404 ("no such key") error.
• If you don’t have the s3:ListBucket permission, Amazon S3 will return a HTTP status code 403
("access denied") error.
Versioning
By default, the HEAD operation retrieves metadata from the current version of an object. If the current
version is a delete marker, Amazon S3 behaves as if the object was deleted. To retrieve metadata from
a different version, use the versionId subresource. For more information, see Versions in the Amazon
Simple Storage Service Developer Guide.
To see sample requests that use versioning, see Sample Request Getting Metadata from a Specified
Version of an Object (p. 402).
Requests
Syntax
HEAD /ObjectName HTTP/1.1
Host: BucketName.s3.amazonaws.com
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Date: date
Request Parameters
Type: Integer
Default: None
Type: String
Default: None
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
Type: String
Default: None
Constraints: None
If-Modified- Return the object only if it has been modified since the specified No
Since time, otherwise return a 304 (not modified).
Type: String
Default: None
Constraints: None
If-Unmodified- Return the object only if it has not been modified since the No
Since specified time, otherwise return a 412 (precondition failed).
Type: String
Default: None
Constraints: None
If-Match Return the object only if its entity tag (ETag) is the same as the No
one specified; otherwise, return a 412 (precondition failed).
Type: String
Default: None
Constraints: None
If-None-Match Return the object only if its entity tag (ETag) is different from the No
one specified; otherwise, return a 304 (not modified).
Type: String
Default: None
Constraints: None
Note
Encryption request headers, like x-amz-server-side-encryption, should not be sent for
GET requests if your object uses server-side encryption with AWS KMS–managed encryption
keys (SSE-KMS) or server-side encryption with Amazon S3–managed encryption keys (SSE-S3). If
your object does use these types of keys, you’ll get an HTTP 400 BadRequest error.
Note the following additional considerations about the preceding request headers:
• Consideration 1 – If both of the If-Match and If-Unmodified-Since headers are present in the
request as follows:
then, Amazon S3 returns 200 OK and the data requested. For more information about conditional
requests, see RFC 7232.
• Consideration 2 – If both of the If-None-Match and If-Modified-Since headers are present in
the request as follows:
then, Amazon S3 returns the 304 Not Modified response code. For more information about
conditional requests, see RFC 7232.
x-amz-server- Specifies the algorithm to use to when decrypting the requested Yes
side-encryption object.
-customer-
algorithm Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
Type: String
x-amz-meta-* Headers starting with this prefix are user-defined metadata. Each one is
stored and returned as a set of key-value pairs. Amazon S3 doesn't validate
or interpret user-defined metadata.
Type: String
x-amz-missing-meta This header is set to the number of metadata entries that were 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, with SOAP, you can create metadata with values that are
not valid HTTP headers.
Type: String
x-amz-replication- Amazon S3 can return this header if your request involves a bucket that is
status either a source or destination in a cross-region replication.
Name Description
• If requesting object from the destination bucket — Amazon S3 returns
the x-amz-replication-status header with value REPLICA if object
in your request is a replica that Amazon S3 created.
Type: String
x-amz-restore If the object is an archived object (an object whose storage class is
GLACIER), the response includes this header if either the archive
restoration is in progress (see POST Object restore (p. 419)) or an archive
copy is already restored.
Type: String
Default: None
x-amz-server-side- If the object is stored using server-side encryption either with an AWS
encryption KMS or an Amazon S3-managed encryption key, the response includes this
header with the value of the encryption algorithm used.
Type: String
Type: String
Type: String
Name Description
x-amz-server- If SSE-C decryption was requested, the response includes this header to
side-encryption- provide roundtrip message integrity verification of the customer-provided
customer-key-MD5 encryption key.
Type: String
x-amz-storage-class Provides storage class information of the object. Amazon S3 returns this
header for all objects except for Standard storage class objects.
For more information, see Storage Classes in the Amazon Simple Storage
Service Developer Guide.
Type: String
Default: None
Type: String
x-amz-object-lock- The Object Lock mode, if any, that's in effect for this object. This header
mode is only returned if the requester has the s3:GetObjectRetention
permission. For more information about S3 Object Lock, see Object Lock in
the Amazon Simple Storage Service Developer Guide.
Type: String
x-amz-object-lock- The date and time when the Object Lock retention period expires. This
retain-until-date header is only returned if the requester has the s3:GetObjectRetention
permission.
Type: Timestamp
Format: 2020-01-05T00:00:00.000Z
x-amz-object-lock- Specifies whether a legal hold is in effect for this object. This header is only
legal-hold returned if the requester has the s3:GetObjectLegalHold permission.
This header is not returned if the specified version of this object has never
had a legal hold applied. For more information about legal holds, see
Object Lock in the Amazon Simple Storage Service Developer Guide.
Type: String
Response Elements
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request returns the metadata of an object.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ef8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC143432E5
x-amz-version-id: 3HL4kqtJlcpXroDTDmjVBH40Nrjfkd
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
ETag: "fba9dede5f27731c9771645a39863328"
Content-Length: 434234
Content-Type: text/plain
Connection: close
Server: AmazonS3
If the object is scheduled to expire according to a lifecycle configuration set on the bucket, the response
returns the x-amz-expiration tag with information about when Amazon S3 will delete the object.
For more information, see Transitioning Objects: General Considerations in the Amazon Simple Storage
Service Developer Guide.
HTTP/1.1 200 OK
x-amz-id-2: azQRZtQJ2m1P8R+TIsG9h0VuC/DmiSJmjXUMq7snk+LKSJeurtmfzSlGhR46GzSJ
x-amz-request-id: 0EFF61CCE3F24A26
Date: Mon, 17 Dec 2012 02:26:39 GMT
Last-Modified: Mon, 17 Dec 2012 02:14:10 GMT
x-amz-expiration: expiry-date="Fri, 21 Dec 2012 00:00:00 GMT", rule-id="Rule for
testfile.txt"
ETag: "54b0c58c7ce9f2a8b551351102ee0938"
Accept-Ranges: bytes
Content-Type: text/plain
Content-Length: 14
Server: AmazonS3
HTTP/1.1 200 OK
x-amz-id-2: FSVaTMjrmBp3Izs1NnwBZeu7M19iI8UbxMbi0A8AirHANJBo+hEftBuiESACOMJp
x-amz-request-id: E5CEFCB143EB505A
Date: Tue, 13 Nov 2012 00:28:38 GMT
Last-Modified: Mon, 15 Oct 2012 21:58:07 GMT
x-amz-restore: ongoing-request="false", expiry-date="Wed, 07 Nov 2012 00:00:00 GMT"
ETag: "1accb31fcf202eba0c0f41fa2f09b4d7"
Accept-Ranges: bytes
Content-Type: binary/octet-stream
Content-Length: 300
Server: AmazonS3
If the restoration is in progress, then the x-amz-restore header returns a message accordingly.
HTTP/1.1 200 OK
x-amz-id-2: b+V2mDiMHTdy1myoUBpctvmJl95H9U/OSUm/jRtHxjh0+pCk5SvByL4xu2TDv4GM
x-amz-request-id: E2E7B6AEE4E9BD2B
Date: Tue, 13 Nov 2012 00:43:32 GMT
Last-Modified: Sat, 20 Oct 2012 21:28:27 GMT
x-amz-restore: ongoing-request="true"
ETag: "1accb31fcf202eba0c0f41fa2f09b4d7"
Accept-Ranges: bytes
Content-Type: binary/octet-stream
Content-Length: 300
Server: AmazonS3
Related Resources
• GET Object (p. 370)
OPTIONS object
Description
A browser can send this preflight request to Amazon S3 to determine if it can send an actual request
with the specific origin, HTTP method, and headers.
Amazon S3 supports cross-origin resource sharing (CORS) by enabling you to add a cors subresource on
a bucket. When a browser sends this preflight request, Amazon S3 responds by evaluating the rules that
are defined in the cors configuration.
If cors is not enabled on the bucket, then Amazon S3 returns a 403 Forbidden response.
For more information about CORS, go to Enabling Cross-Origin Resource Sharing in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
OPTIONS /ObjectName HTTP/1.1
Host: BucketName.s3.amazonaws.com
Origin: Origin
Access-Control-Request-Method: HTTPMethod
Access-Control-Request-Headers: RequestHeader
Request Parameters
This operation does not introduce any specific request parameters, but it may contain any request
parameters that are required by the actual request.
Request Headers
Origin Identifies the origin of the cross-origin request to Amazon S3. Yes
For example, http://www.example.com.
Type: String
Default: None
Access-Control- Identifies what HTTP method will be used in the actual request. Yes
Request-Method
Type: String
Default: None
Default: None
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
Header Description
Access-Control-Allow- The origin you sent in your request. If the origin in your request is not
Origin allowed, Amazon S3 will not include this header in the response.
Type: String
Access-Control-Max-Age How long, in seconds, the results of the preflight request can be
cached.
Type: String
Access-Control-Allow- The HTTP method that was sent in the original request. If the
Methods method in the request is not allowed, Amazon S3 will not include this
header in the response.
Type: String
Access-Control-Allow- A comma-delimited list of HTTP headers that the browser can send
Headers in the actual request. If any of the requested headers is not allowed,
Amazon S3 will not include that header in the response, nor will the
response contain any of the headers with the Access-Control
prefix.
Type: String
Type: String
Response Elements
This implementation of the operation does not return response elements.
Examples
Example : Send a preflight OPTIONS request to a cors enabled
bucket
A browser can send this preflight request to Amazon S3 to determine if it can send the actual PUT
request from http://www.example.com origin to the Amazon S3 bucket named examplebucket.
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: 6SvaESv3VULYPLik5LLl7lSPPtSnBvDdGmnklX1HfUl7uS2m1DF6td6KWKNjYMXZ
x-amz-request-id: BDC4B83DF5096BBE
Date: Wed, 21 Aug 2012 23:09:55 GMT
Etag: "1f1a1af1f1111111111111c11aed1da1"
Access-Control-Allow-Origin: http://www.example.com
Access-Control-Allow-Methods: PUT
Access-Control-Expose-Headers: x-amz-request-id
Content-Length: 0
Server: AmazonS3
Related Resources
• GET Bucket cors (p. 157)
• DELETE Bucket cors (p. 108)
• PUT Bucket cors (p. 273)
POST Object
Description
The POST operation adds an object to a specified bucket using HTML forms. POST is an alternate form
of PUT that enables browser-based uploads as a way of putting objects in buckets. Parameters that are
passed to PUT via HTTP Headers are instead passed as form fields to POST in the multipart/form-data
encoded message body. You must have WRITE access on a bucket to add an object to it. Amazon S3
never stores partial objects: if you receive a successful response, you can be confident the entire object
was stored.
Amazon S3 is a distributed system. If Amazon S3 receives multiple write requests for the same object
simultaneously, all but the last object written is overwritten.
To ensure that data is not corrupted traversing the network, use the Content-MD5 form field. When you
use this form field, Amazon S3 checks the object against the provided MD5 value. If they do not match,
Amazon S3 returns an error. Additionally, you can calculate the MD5 value while posting an object to
Amazon S3 and compare the returned ETag to the calculated MD5 value. The ETag only reflects changes
to the contents of an object, not its metadata.
Note
To configure your application to send the Request Headers before sending the request body,
use the 100-continue HTTP status code. For POST operations, this helps you avoid sending the
message body if the message is rejected based on the headers (for example, authentication
failure or redirect). For more information on the 100-continue HTTP status code, go to Section
8.2.3 of http://www.ietf.org/rfc/rfc2616.txt.
You can optionally request server-side encryption where Amazon S3 encrypts your data as it writes it
to disks in its data centers and decrypts it for you when you access it. You have the option of providing
your own encryption key or you can use the AWS-managed encryption keys. For more information, go to
Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide.
Versioning
If you enable versioning for a bucket, POST automatically generates a unique version ID for the object
being added. Amazon S3 returns this ID in the response using the x-amz-version-id response header.
If you suspend versioning for a bucket, Amazon S3 always uses null as the version ID of the object
stored in a bucket.
For more information about returning the versioning state of a bucket, see GET Bucket (Versioning
Status) (p. 224).
Amazon S3 is a distributed system. If you enable versioning for a bucket and Amazon S3 receives
multiple write requests for the same object simultaneously, all of the objects are stored.
To see sample requests that use versioning, see Sample Request (p. 417).
Requests
Syntax
POST / HTTP/1.1
Host: destinationBucket.s3.amazonaws.com
User-Agent: browser_data
Accept: file_types
Accept-Language: Regions
Accept-Encoding: encoding
Accept-Charset: character_set
Keep-Alive: 300
Connection: keep-alive
Content-Type: multipart/form-data; boundary=9431149156168
Content-Length: length
--9431149156168
Content-Disposition: form-data; name="key"
acl
--9431149156168
Content-Disposition: form-data; name="tagging"
success_redirect
--9431149156168
Content-Disposition: form-data; name="Content-Type"
content_type
--9431149156168
Content-Disposition: form-data; name="x-amz-meta-uuid"
uuid
--9431149156168
Content-Disposition: form-data; name="x-amz-meta-tag"
metadata
--9431149156168
Content-Disposition: form-data; name="AWSAccessKeyId"
access-key-id
--9431149156168
Content-Disposition: form-data; name="Policy"
encoded_policy
--9431149156168
Content-Disposition: form-data; name="Signature"
signature=
--9431149156168
Content-Disposition: form-data; name="file"; filename="MyFilename.jpg"
Content-Type: image/jpeg
file_content
--9431149156168
Content-Disposition: form-data; name="submit"
Upload to Amazon S3
--9431149156168--
Request Parameters
This implementation of the operation does not use request parameters.
Form Fields
This operation can use the following form fields.
AWSAccessKeyId The AWS access key ID of the owner of the bucket who Conditional
grants an Anonymous user access for a request that
satisfies the set of constraints in the policy.
Type: String
Default: None
Type: String
Default: private
Default: None
Default: None
Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Note
The redirect field name is deprecated, and
support for the redirect field name is removed
in the future.
Type: String
Default: None
Note
Some versions of the Adobe Flash player
do not properly handle HTTP responses
with an empty body. To support uploads
through Adobe Flash, we recommend setting
success_action_status to 201.
<Tagging>
<TagSet>
<Tag>
<Key>Tag Name</Key>
<Value>Tag Value</Value>
</Tag>
...
</TagSet>
</Tagging>
Type: String
Default: None
x-amz-storage-class Storage class to use for storing the object. If you don't No
specify a class, Amazon S3 uses the default storage
class, STANDARD. Amazon S3 supports other storage
classes. For more information, see Storage Classes in
the Amazon Simple Storage Service Developer Guide.
Type: String
Default: STANDARD
Type: String
Default: None
Type: String
Default: None
x-amz-website-redirect-location: /
anotherPage.html
x-amz-website-redirect-location: http://
www.example.com/
Type: String
Default: None
For more information, see Protecting Data Using Server-Side Encryption in the Amazon Simple Storage
Service Developer Guide.
Depending on whether you want to use AWS-managed encryption keys or provide your own encryption
keys, the following form fields:
• Use AWS-managed encryption keys — If you want Amazon S3 to manage keys used to encrypt data,
specify the following form fields in the request.
Type: String
Type: String
Note
If you specify x-amz-server-side-encryption:aws:kms, but do not provide x-amz-
server-side- encryption-aws-kms-key-id, Amazon S3 uses the default AWS KMS key
to protect the data.
• Use customer-provided encryption keys — If you want to manage your own encryption keys, you must
provide all the following form fields in the request.
Note
If you use this feature, the ETag value that Amazon S3 returns in the response is not the MD5
of the object.
x-amz-server- Specifies the algorithm to use to when encrypting the object. Yes
side-encryption-
customer- Type: String
algorithm
Default: None
Type: String
Default: None
Type: String
Default: None
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
Type: String
Type: String
Ancestor: PostResponse
Type: String
Name Description
specifies the ID of the AWS KMS master encryption key
that was used for the object.
Type: String
Type: String
Type: String
Type: String
Response Elements
Name Description
Type: String
Ancestor: PostResponse
ETag The entity tag is an MD5 hash of the object that you can use to
do conditional GET operations using the If-Modified request
tag with the GET request operation. ETag reflects changes only
to the contents of an object, not its metadata.
Type: String
Ancestor: PostResponse
Type: String
Ancestor: PostResponse
Type: String
Ancestor: PostResponse
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
POST /Neo HTTP/1.1
Content-Length: 4
Host: quotes.s3.amazonaws.com
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: authorization string
Content-Type: text/plain
Expect: the 100-continue HTTP status code
ObjectContent
Related Resources
• PUT Object - Copy (p. 451)
• POST Object (p. 407)
• GET Object (p. 370)
To use this operation, you must have permissions to perform the s3:RestoreObject and
s3:GetObject actions. The bucket owner has this permission by default and can grant this permission
to others. For more information about permissions, see Permissions Related to Bucket Subresource
Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple
Storage Service Developer Guide.
• Define an output location for the select query's output. This must be an Amazon S3 bucket in the same
AWS Region as the bucket that contains the archive object that is being queried. The AWS account that
initiates the job must have permissions to write to the S3 bucket. You can specify the storage class
and encryption for the output objects stored in the bucket. For more information about output, see
Querying Archived Objects in the Amazon Simple Storage Service Developer Guide.
For more information about the S3 structure in the request body, see the following:
• PUT Object (p. 434)
• Managing Access with ACLs in the Amazon Simple Storage Service Developer Guide
• Protecting Data Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide
• Define the SQL expression for the SELECT type of restoration for your query in the request body's
SelectParameters structure. You can use expressions like the following examples.
• The following expression returns all records from the specified object.
• Assuming that you are not using any headers for data stored in the object, you can specify columns
with positional headers.
• If you have headers and you set the fileHeaderInfo in the CSV structure in the request body to
USE, you can specify headers in the query. (If you set the fileHeaderInfo field to IGNORE, the
first row is skipped for the query.) You cannot mix ordinal positions with header column names.
For more information about using SQL with Glacier Select restore, see SQL Reference for Amazon S3
Select and Glacier Select in the Amazon Simple Storage Service Developer Guide.
• To expedite your queries, specify the Expedited tier. For more information about tiers, see "Restoring
Archives," later in this topic.
• Specify details about the data serialization format of both the input object that is being queried and
the serialization of the CSV-encoded query results.
The following are additional important facts about the select feature:
• The output results are new Amazon S3 objects. Unlike archive retrievals, they are stored until explicitly
deleted—manually or through a lifecycle policy.
• You can issue more than one select request on the same Amazon S3 object. Amazon S3 doesn't
deduplicate requests, so avoid issuing duplicate requests.
• Amazon S3 accepts a select request even if the object has already been restored. A select request
doesn’t return error response 409.
Restoring Archives
Objects in the GLACIER and DEEP_ARCHIVE storage classes are archived. To access an archived object,
you must first initiate a restore request. This restores a temporary copy of the archived object. In a
restore request, you specify the number of days that you want the restored copy to exist. After the
specified period, Amazon S3 deletes the temporary copy but the object remains archived in the GLACIER
or DEEP_ARCHIVE storage class that object was restored from.
To restore a specific object version, you can provide a version ID. If you don't provide a version ID,
Amazon S3 restores the current version.
The time it takes restore jobs to finish depends on which storage class the object is being restored from
and which data access tier you specify.
When restoring an archived object (or using a select request), you can specify one of the following data
access tier options in the Tier element of the request body:
• Expedited - Expedited retrievals allow you to quickly access your data stored in the GLACIER storage
class when occasional urgent requests for a subset of archives are required. For all but the largest
archived objects (250 MB+), data accessed using Expedited retrievals are typically made available
within 1–5 minutes. Provisioned capacity ensures that retrieval capacity for Expedited retrievals is
available when you need it. Expedited retrievals and provisioned capacity are not available for the
DEEP_ARCHIVE storage class.
• Standard - Standard retrievals allow you to access any of your archived objects within several hours.
This is the default option for the GLACIER and DEEP_ARCHIVE retrieval requests that do not specify
the retrieval option. Standard retrievals typically complete within 3-5 hours from the GLACIER storage
class and typically complete within 12 hours from the DEEP_ARCHIVE storage class.
• Bulk - Bulk retrievals are Amazon S3 Glacier’s lowest-cost retrieval option, enabling you to retrieve
large amounts, even petabytes, of data inexpensively in a day. Bulk retrievals typically complete
within 5-12 hours from the GLACIER storage class and typically complete within 48 hours from the
DEEP_ARCHIVE storage class.
For more information about archive retrieval options and provisioned capacity for Expedited data
access, see Restoring Archived Objects in the Amazon Simple Storage Service Developer Guide.
You can use Amazon S3 restore speed upgrade to change the restore speed to a faster speed while it is
in progress. You upgrade the speed of an in-progress restoration by issuing another restore request to
the same object, setting a new Tier request element. When issuing a request to upgrade the restore
tier, you must choose a tier that is faster than the tier that the in-progress restore is using. You must not
change any other parameters, such as the Days request element. For more information, see Upgrading
the Speed of an In-Progress Restore in the Amazon Simple Storage Service Developer Guide.
To get the status of object restoration, you can send a HEAD request. Operations return the x-amz-
restore header, which provides information about the restoration status, in the response. You can
use Amazon S3 event notifications to notify you when a restore is initiated or completed. For more
information, see Configuring Amazon S3 Event Notifications in the Amazon Simple Storage Service
Developer Guide.
After restoring an archived object, you can update the restoration period by reissuing the request with a
new period. Amazon S3 updates the restoration period relative to the current time and charges only for
the request—there are no data transfer charges. You cannot update the restoration period when Amazon
S3 is actively processing your current restore request for the object.
If your bucket has a lifecycle configuration with a rule that includes an expiration action, the object
expiration overrides the life span that you specify in a restore request. For example, if you restore an
object copy for 10 days, but the object is scheduled to expire in 3 days, Amazon S3 deletes the object in
3 days. For more information about lifecycle configuration, see PUT Bucket lifecycle (p. 290) and Object
Lifecycle Management in Amazon Simple Storage Service Developer Guide.
Requests
Syntax
POST /ObjectName?restore&versionId=VersionID HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Content-MD5: MD5
request body
Note
The syntax shows some of the request headers. For a complete list, see "Request Headers," later
in this topic.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Content-MD5 The base64-encoded 128-bit MD5 digest of the data. You must use Yes
this header as a message integrity check to verify that the request
body was not corrupted in transit. For more information, see RFC
1864.
Type: String
Request Elements
The following is an XML example of a request body for restoring an archive.
<RestoreRequest>
<Days>2</Days>
<GlacierJobParameters>
<Tier>Bulk</Tier>
</GlacierJobParameters>
</RestoreRequest>
The following table explains the XML for archive restoration in the request body.
Type: Container
Days Lifetime of the restored (active) copy. The minimum number of Yes, if restoring
days that you can restore an object from Glacier is 1. After the an archive
object copy reaches the specified lifetime, Amazon S3 removes
it from the bucket. If you are restoring an archive, this element is
required.
Ancestors: RestoreRequest
Type: Container
Ancestors: RestoreRequest
Tier The data access tier to use when restoring the archive. No
Standard is the default.
Type: Enum
Ancestors: GlacierJobParameters
The following XML is the request body for a select query on an archived object:
<RestoreRequest>
<Type>SELECT</Type>
<Tier>Expedited</Tier>
<Description>Job description</Description>
<SelectParameters>
<Expression>Select * from Object</Expression>
<ExpressionType>SQL</ExpressionType>
<InputSerialization>
<CSV>
<FileHeaderInfo>IGNORE</FileHeaderInfo>
<RecordDelimiter>\n</RecordDelimiter>
<FieldDelimiter>,</FieldDelimiter>
<QuoteCharacter>"</QuoteCharacter>
<QuoteEscapeCharacter>"</QuoteEscapeCharacter>
<Comments>#</Comments>
</CSV>
</InputSerialization>
<OutputSerialization>
<CSV>
<QuoteFields>ASNEEDED</QuoteFields>
<RecordDelimiter>\n</RecordDelimiter>
<FieldDelimiter>,</FieldDelimiter>
<QuoteCharacter>"</QuoteCharacter>
<QuoteEscapeCharacter>"</QuoteEscapeCharacter>
</CSV>
</OutputSerialization>
</SelectParameters>
<OutputLocation>
<S3>
<BucketName>Name of bucket</BucketName>
<Prefix>Key prefix</Prefix>
<CannedACL>Canned ACL string</CannedACL>
<AccessControlList>
<Grantee>
<Type>Grantee Type</Type>
<ID>Grantee identifier</ID>
<URI>Grantee URI</URI>
<Permission>Granted permission</Permission>
<DisplayNmae>Display Name</DisplayName>
<EmailAddress>email</EmailAddress>
</Grantee>
</AccessControlList>
<Encryption>
<EncryptionType>Encryption type</EncryptionType>
<KMSKeyId>KMS Key ID</KMSKeyId>
<KMSContext>Base64-encoded JSON<KMSContext>
</Encryption>
<UserMetadata>
<MetadataEntry>
<Name>Key</Name>
<Value>Value</Value>
</MetadataEntry>
</UserMetadata>
<Tagging>
<TagSet>
<Tag>
<Key>Tag name</Key>
<Value>Tag value</Value>
</Tag>
</TagSet>
</Tagging>
<StorageClass>Storage class</StorageClass>
</S3>
</OutputLocation>
</RestoreRequest>
The following tables explain the XML for a SELECT type of restoration in the request body.
Type: Container
Tier The data access tier to use when restoring the archive. No
Standard is the default.
Type: Enum
Ancestors: RestoreRequest
Type: String
Ancestors: RestoreRequest
Ancestors: RestoreRequest
OutputLocation Describes the location that receives the results of the select Yes, if request
restore request. type is SELECT
Ancestors: RestoreRequest
Type: String
Ancestors: SelectParameters
Type: String
Ancestors: SelectParameters
Ancestors: SelectParameters
The CSV container element in the InputSerialization element contains the following
elements.
Type: String
Default: \n
Ancestors: CSV
Type: String
Default: ,
Ancestors: CSV
QuoteCharacter A single character used for escaping when the field delimiter is No
part of the value.
"a, b"
Type: String
Default: "
Ancestors: CSV
Default: "
Ancestors: CSV
FileHeaderInfo Describes the first line in the input data. It is one of the ENUM No
values.
Type: Enum
Ancestors: CSV
Type: String
Ancestors: CSV
The CSV container element (in the OutputSerialization elements) contains the following
elements.
Type: Enum
Default: AsNeeded
Ancestors: CSV
Default: \n
Ancestors: CSV
Type: String
Default: ,
Ancestors: CSV
QuoteCharacter A single character used for escaping when the field delimiter is No
part of the value. For example, if the value is a, b, Amazon S3
wraps this field value in quotation marks, as follows: " a , b
".
Type: String
Default: "
Ancestors: CSV
Type: String
Ancestors: CSV
The S3 container element (in the OutputLocation element) contains the following
elements.
Ancestors: S3
BucketName The name of the S3 bucket where the select restore results Yes
are stored. The bucket must be in the same AWS Region as the
bucket that contains the input archive object.
Type: String
Ancestors: S3
CannedACL The canned access control list (ACL) to apply to the select No
restore results.
Type: String
Ancestors: S3
Ancestors: S3
Prefix The prefix that is prepended to the select restore results. The Yes
maximum length for the prefix is 512 bytes.
Type: String
Ancestors: S3
StorageClass The class of storage used to store the select request results. No
Type: String
Ancestors: S3
Ancestors: S3
Ancestors: S3
The Grantee container element (in the AccessControlList element) contains the following
elements.
Type: String
Ancestors: Grantee
Type: String
Ancestors: Grantee
Ancestors: Grantee
Type: String
Ancestors: Grantee
Type: String
Ancestors: Grantee
Type: String
Ancestors: Grantee
The Encryption container element (in S3) contains the following elements.
Type: String
Ancestors: Encryption
KMSContext Optional. If the encryption type is aws:kms, you can use this No
value to specify the encryption context for the select restore
results.
Type: String
Ancestors: Encryption
KMSKeyId The AWS Key Management Service (AWS KMS) key ID to use for No
object encryption.
Type: String
Ancestors: Encryption
The TagSet container element (in the Tagging element) contains the following element.
Type: Container
The Tag container element (in the TagSet element) contains the following elements.
Type: String
Ancestors: Tag
Type: String
Ancestors: Tag
The MetadataEntry container element (in the UserMetadata element) contains the
following key-value pair elements to store with an object.
Type: String
Ancestors:
Type: String
Ancestors:
Responses
A successful operation returns either the 200 OK or 202 Accepted status code.
• If the object copy is not previously restored, then Amazon S3 returns 202 Accepted in the response.
• If the object copy is previously restored, Amazon S3 returns 200 OK in the response.
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
Examples
Restore an Object for Two Days Using the Expedited Retrieval
Option
The following restore request restores a copy of the photo1.jpg object from Glacier for a period of two
days using the expedited retrieval option.
<RestoreRequest>
<Days>2</Days>
<GlacierJobParameters>
<Tier>Expedited</Tier>
</GlacierJobParameters>
</RestoreRequest>
If the examplebucket does not have a restored copy of the object, Amazon S3 returns the following
202 Accepted response.
If a copy of the object is already restored, Amazon S3 returns a 200 OK response, and updates only the
restored copy's expiry time.
<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Type>SELECT</Type>
<Tier>Expedited</Tier>
<Description>this is a description</Description>
<SelectParameters>
<InputSerialization>
<CSV>
<FileHeaderInfo>IGNORE</FileHeaderInfo>
<Comments>#</Comments>
<QuoteEscapeCharacter>"</QuoteEscapeCharacter>
<RecordDelimiter>\n</RecordDelimiter>
<FieldDelimiter>,</FieldDelimiter>
<QuoteCharacter>"</QuoteCharacter>
</CSV>
</InputSerialization>
<ExpressionType>SQL</ExpressionType>
<Expression>select * from object</Expression>
<OutputSerialization>
<CSV>
<QuoteFields>ALWAYS</QuoteFields>
<QuoteEscapeCharacter>"</QuoteEscapeCharacter>
<RecordDelimiter>\n</RecordDelimiter>
<FieldDelimiter>\t</FieldDelimiter>
<QuoteCharacter>\'</QuoteCharacter>
</CSV>
</OutputSerialization>
</SelectParameters>
<OutputLocation>
<S3>
<BucketName>example-output-bucket</BucketName>
<Prefix>test-s3</Prefix>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AmazonCustomerByEmail">
<EmailAddress>jane-doe@example.com</EmailAddress>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
<UserMetadata>
<MetadataEntry>
<Name>test</Name>
<Value>test-value</Value>
</MetadataEntry>
<MetadataEntry>
<Name>other</Name>
<Value>something else</Value>
</MetadataEntry>
</UserMetadata>
<StorageClass>STANDARD</StorageClass>
</S3>
</OutputLocation>
</RestoreRequest>
x-amz-id-2: GFihv3y6+kE7KG11GEkQhU7/2/cHR3Yb2fCb2S04nxI423Dqwg2XiQ0B/UZlzYQvPiBlZNRcovw=
x-amz-request-id: 9F341CD3C4BA79E0
x-amz-restore-output-path: js-test-s3/qE8nk5M0XIj-LuZE2HXNw6empQm3znLkHlMWInRYPS-
Orl2W0uj6LyYm-neTvm1-btz3wbBxfMhPykd3jkl-lvZE7w42/
Date: Sat, 20 Oct 2012 23:54:05 GMT
Content-Length: 0
Server: AmazonS3
More Info
• GET Bucket lifecycle (p. 171)
• PUT Bucket lifecycle (p. 290)
• SQL Reference for Amazon S3 Select and Glacier Select in the Amazon Simple Storage Service
Developer Guide
PUT Object
Description
This implementation of the PUT operation adds an object to a bucket. You must have WRITE permissions
on a bucket to add an object to it.
Amazon S3 never adds partial objects; if you receive a success response, Amazon S3 added the entire
object to the bucket.
Amazon S3 is a distributed system. If it receives multiple write requests for the same object
simultaneously, it overwrites all but the last object written. Amazon S3 does not provide object locking;
if you need this, make sure to build it into your application layer or use versioning instead.
To ensure that data is not corrupted traversing the network, use the Content-MD5 header. When you
use this header, Amazon S3 checks the object against the provided MD5 value and, if they do not match,
returns an error. Additionally, you can calculate the MD5 while putting an object to Amazon S3 and
compare the returned ETag to the calculated MD5 value.
Note
To configure your application to send the request headers before sending the request body,
use the 100-continue HTTP status code. For PUT operations, this helps you avoid sending
the message body if the message is rejected based on the headers (for example, because
authentication fails or a redirect occurs). For more information on the 100-continue HTTP
status code, go to Section 8.2.3 of http://www.ietf.org/rfc/rfc2616.txt.
You can optionally request server-side encryption. With server-side encryption, Amazon S3 encrypts
your data as it writes it to disks in its data centers and decrypts the data when you access it. You have the
option to provide your own encryption key or use AWS-managed encryption keys. For more information,
see Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide.
Versioning
If you enable versioning for a bucket, Amazon S3 automatically generates a unique version ID for
the object being stored. Amazon S3 returns this ID in the response using the x-amz-version-id
response header. If versioning is suspended, Amazon S3 always uses null as the version ID for the
object stored. For more information about returning the versioning state of a bucket, see GET Bucket
versioning (p. 224).
If you enable versioning for a bucket, when Amazon S3 receives multiple write requests for the same
object simultaneously, it stores all of the objects.
To see sample requests that use versioning, see Sample Request (p. 446).
Access Permissions
When uploading an object, you can optionally specify the accounts or groups that should be granted
specific permissions on your object. There are two ways to grant the appropriate permissions using the
request headers:
• Specify a canned (predefined) ACL using the x-amz-acl request header. For more information, see
Canned ACL in the Amazon Simple Storage Service Developer Guide.
• Specify access permissions explicitly using the x-amz-grant-read, x-amz-grant-read-acp, and
x-amz-grant-write-acp, x-amz-grant-full-control headers. These headers map to the set
of permissions Amazon S3 supports in an ACL. For more information, go to Access Control List (ACL)
Overview in the Amazon Simple Storage Service Developer Guide.
Note
You can either use a canned ACL or specify access permissions explicitly. You cannot do both.
To change an object's ACLs from the default, the requester must have s3:PutObjectAcl included
in the list of permitted actions in their AWS Identity and Access Management (IAM) policy. For more
information about permissions, see Permissions for Object Operations and Managing Access Permissions
to Your Amazon S3 Resources in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /ObjectName HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Note
The syntax shows some of the request headers. For a complete list, see the Request Headers
section.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
Type: String
Default: None
Constraints: None
Type: String
Constraints: None
Type: String
Default: None
Constraints: None
Content-Length The size of the object, in bytes. For more information, Yes
go to http://www.w3.org/Protocols/rfc2616/rfc2616-
sec14.html#sec14.13.
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
Content-Type A standard MIME type describing the format of the contents. For No
more information, go to http://www.w3.org/Protocols/rfc2616/
rfc2616-sec14.html#sec14.17.
Type: String
Default: binary/octet-stream
Constraints: None
Type: String
Default: None
Constraints: None
Expires The date and time at which the object is no longer able to No
be cached. For more information, go to http://www.w3.org/
Protocols/rfc2616/rfc2616-sec14.html#sec14.21.
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
Type: Enum
Default: STANDARD
x-amz-tagging Specifies a set of one or more tags to associate with the object. No
These tags are stored in the tagging subresource that is
associated with the object.
Type: String
Default: None
x-amz-website-redirect-location: /
anotherPage.html
x-amz-website-redirect-location: http://
www.example.com/
Type: String
Default: None
x-amz-object- The Object Lock mode, if any, that should be applied to this No
lock-mode object. For more information about S3 Object Lock, see Object
Lock in the Amazon Simple Storage Service Developer Guide.
Type: String
Default: None
x-amz-object- The date and time when the Object Lock retention period will Required
lock-retain- expire. if x-amz-
until-date object-
Type: Timestamp lock-
mode is
Default: None specified
Format: 2020-01-05T00:00:00.000Z
Type: String
Default: None
To grant these permissions, you can use one of the following methods:
• Specify a canned ACL — Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each
canned ACL has a predefined set of grantees and permissions. For more information, go to Canned
ACL.
x-amz-acl The canned ACL to apply to the object. For more information, No
see Canned ACL in the Amazon Simple Storage Service Developer
Guide.
Type: String
Default: private
• Specify access permissions explicitly — To explicitly grant access permissions to specific AWS
accounts or a group, use the following headers. Each maps to specific permissions that Amazon S3
supports in an ACL. For more information, see Access Control List (ACL) Overview. In the header value,
you specify a list of grantees who get the specific permission.
x-amz-grant- Grants permission to read the object data and its metadata. No
read
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
Default: None
Constraints: None
x-amz-grant- Grants permission to write the ACL for the applicable object. No
write-acp
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
You specify each grantee as a type=value pair, where the type can be one of the following:
Important
Using email addresses to specify a grantee is only supported in the following AWS Regions:
• US East (N. Virginia)
• US West (N. California)
• US West (Oregon)
• Asia Pacific (Singapore)
• Asia Pacific (Sydney)
• Asia Pacific (Tokyo)
• EU (Ireland)
• South America (São Paulo)
For a list of all the Amazon S3 supported regions and endpoints, see Regions and Endpoints in
the AWS General Reference.
• id – if the specified value is the canonical user ID of an AWS account
• uri – if you are granting permission to a predefined group
For example, the following x-amz-grant-read header grants permission to read object data and its
metadata to the AWS accounts identified by their email addresses.
• Use AWS-managed encryption keys — If you want Amazon S3 to manage the keys used to encrypt
data, specify the following headers in the request.
Type: String
Type: String
Note
If you specify x-amz-server-side-encryption:aws:kms, but do not provide x-amz-
server-side- encryption-aws-kms-key-id, Amazon S3 uses the default AWS KMS key
to protect the data.
Important
All GET and PUT requests for an object protected by AWS KMS fail if you don't make them
with SSL or by using SigV4.
For more information on Server-Side Encryption with Amazon KMS-Managed Keys (SSE-KMS), see
Protecting Data Using Server-Side Encryption with AWS KMS-Managed Keys in the Amazon Simple
Storage Service Developer Guide.
• Use customer-provided encryption keys— If you want to manage your own encryption keys, provide all
the following headers in the request.
Note
If you use this feature, the ETag value that Amazon S3 returns in the response is not the MD5
of the object.
x-amz-server- Specifies the algorithm to use to when encrypting the object. Yes
side-encryption
-customer- Type: String
algorithm
Default: None
Type: String
Default: None
Type: String
Default: None
For more information on Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C), see
Protecting Data Using Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C) in the
Amazon Simple Storage Service Developer Guide.
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
x-amz- If the expiration is configured for the object (see PUT Bucket lifecycle (p. 290)),
expiration the response includes this header. It includes the expiry-date and rule-id
key-value pairs that provide information about object expiration. The value of the
rule-id is URL encoded.
Type: String
Type: String
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Upload an Object
Sample Request
The following request stores the my-image.jpg image in the myBucket bucket.
HTTP/1.1 200 OK
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
Date: Wed, 12 Oct 2009 17:50:00 GMT
ETag: "1b2cf535f27731c974343645a3985328"
Content-Length: 0
Connection: close
Server: AmazonS3
If an expiration rule that was created on the bucket using lifecycle configuration applies to the object,
you get a response with an x-amz-expiration header as shown in the following response. For more
information, see Transitioning Objects: General Considerations in the Amazon Simple Storage Service
Developer Guide.
HTTP/1.1 200 OK
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
Date: Wed, 12 Oct 2009 17:50:00 GMT
x-amz-expiration: expiry-date="Fri, 23 Dec 2012 00:00:00 GMT", rule-id="1"
ETag: "1b2cf535f27731c974343645a3985328"
Content-Length: 0
Connection: close
Server: AmazonS3
HTTP/1.1 200 OK
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
x-amz-version-id: 43jfkodU8493jnFJD9fjj3HHNVfdsQUIFDNsidf038jfdsjGFDSIRp
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
Date: Wed, 12 Oct 2009 17:50:00 GMT
ETag: "1b2cf535f27731c974343645a3985328"
Content-Length: 0
Connection: close
Server: AmazonS3
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: RUxG2sZJUfS+ezeAS2i0Xj6w/ST6xqF/8pFNHjTjTrECW56SCAUWGg+7QLVoj1GH
x-amz-request-id: 8D017A90827290BA
Date: Fri, 13 Apr 2012 05:40:25 GMT
ETag: "dd038b344cf9553547f8b395a814b274"
Content-Length: 0
Server: AmazonS3
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: Yd6PSJxJFQeTYJ/3dDO7miqJfVMXXW0S2Hijo3WFs4bz6oe2QCVXasxXLZdMfASd
x-amz-request-id: 80DF413BB3D28A25
Date: Fri, 13 Apr 2012 05:54:59 GMT
ETag: "dd038b344cf9553547f8b395a814b274"
Content-Length: 0
Server: AmazonS3
In the response, Amazon S3 returns the encryption algorithm and MD5 of the encryption key that you
specified when uploading the object. The ETag that is returned is not the MD5 of the object.
HTTP/1.1 200 OK
x-amz-id-2: 7qoYGN7uMuFuYS6m7a4lszH6in+hccE+4DXPmDZ7C9KqucjnZC1gI5mshai6fbMG
x-amz-request-id: 06437EDD40C407C7
Date: Wed, 28 May 2014 19:31:12 GMT
x-amz-server-side-encryption-customer-algorithm: AES256
x-amz-server-side-encryption-customer-key-MD5: ZjQrne1X/iTcskbY2example
ETag: "ae89237c20e759c5f479ece02c642f59"
After the object is created, Amazon S3 stores the specified object tags in the tagging subresource that
is associated with the object.
HTTP/1.1 200 OK
x-amz-id-2: 7qoYGN7uMuFuYS6m7a4lszH6in+hccE+4DXPmDZ7C9KqucjnZC1gI5mshai6fbMG
x-amz-request-id: 06437EDD40C407C7
Date: Thu, 22 Sep 2016 21:58:17 GMT
Related Resources
• PUT Object - Copy (p. 451)
• POST Object (p. 407)
• GET Object (p. 370)
Request Syntax
PUT /<object-key>?legal-hold&versionId=<version-id> HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
Date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization-string> (see Authenticating Requests (AWS Signature Version
4))
The version ID of the object version that you want to put a retention period on.
Request Body
For more information about the request elements that this operation uses, see
ObjectLockLegalHold (p. 545).
<LegalHold>
<Status>ON</Status>
</LegalHold>
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Related Resources
Locking Objects in the Amazon Simple Storage Service Developer Guide.
Request Syntax
PUT /<object-key>?retention&versionId=<version-id> HTTP/1.1
Host: <bucket-name>.s3.amazonaws.com
Date: <Thu, 15 Nov 2016 00:17:21 GMT>
Authorization: <authorization-string> (see Authenticating Requests (AWS Signature Version
4))
The version ID of the object version that you want to put a retention period on.
Request Body
For more information about the request elements that this operation uses, see
ObjectLockRetention (p. 546).
<Retention>
<Mode>GOVERNANCE</Mode>
<RetainUntilDate>2020-01-05T00:00:00.000Z</RetainUntilDate>
</Retention>
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
Related Resources
Locking Objects in the Amazon Simple Storage Service Developer Guide.
When copying an object, you can preserve most of the metadata (default) or specify new metadata.
However, the ACL is not preserved and is set to private for the user making the request.
Important
Amazon S3 Transfer Acceleration does not support cross-region copies. If you request a cross-
region copy using a Transfer Acceleration endpoint, you get a 400 Bad Request error. For
more information about transfer acceleration, see Transfer Acceleration in the Amazon Simple
Storage Service Developer Guide.
All copy requests must be authenticated and cannot contain a message body. Additionally, you
must have READ access to the source object and WRITE access to the destination bucket. For more
information, see REST Authentication. Both the Region that you want to copy the object from and the
Region that you want to copy the object to must be enabled for your account.
To copy an object only under certain conditions, such as whether the ETag matches or whether the
object was modified before or after a specified date, use the request headers x-amz-copy-source-if-
match, x-amz-copy-source-if-none-match, x-amz-copy-source-if-unmodified-since, or
x-amz-copy-source-if-modified-since.
Note
All headers with the x-amz- prefix, including x-amz-copy-source, must be signed.
You can use this operation to change the storage class of an object that is already stored in Amazon S3
using the x-amz-storage-class request header. For more information, see Storage Classes in the
Amazon Simple Storage Service Developer Guide.
The source object that you are copying can be encrypted or unencrypted. If the source object is
encrypted, it can be encrypted by server-side encryption using AWS-managed encryption keys or by
using a customer-provided encryption key. When copying an object, you can request that Amazon S3
encrypt the target object by using either the AWS-managed encryption keys or by using your own
encryption key. You can do this regardless of the form of server-side encryption that was used to encrypt
the source, or even if the source object was not encrypted. For more information about server-side
encryption, see Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide.
A copy request might return an error when Amazon S3 receives the copy request or while Amazon S3 is
copying the files. If the error occurs before the copy operation starts, you receive a standard Amazon
S3 error. If the error occurs during the copy operation, the error response is embedded in the 200 OK
response. This means that a 200 OK response can contain either a success or an error. Design your
application to parse the contents of the response and handle it appropriately.
If the copy is successful, you receive a response with information about the copied object.
Note
If the request is an HTTP 1.1 request, the response is chunk encoded. If it were not, it would not
contain the content-length, and you would need to read the entire body.
The copy request charge is based on the storage class and Region you specify for the destination object.
For pricing information, see Amazon S3 Pricing.
Versioning
By default, x-amz-copy-source identifies the current version of an object to copy. (If the current
version is a delete marker, Amazon S3 behaves as if the object was deleted.) To copy a different version,
use the versionId subresource.
If you enable versioning on the target bucket, Amazon S3 generates a unique version ID for the object
being copied. This version ID is different from the version ID of the source object. Amazon S3 returns the
version ID of the copied object in the x-amz-version-id response header in the response.
If you do not enable versioning or suspend it on the target bucket, the version ID that Amazon S3
generates is always null.
If the source object's storage class is GLACIER, then you must restore a copy of this object before you can
use it as a source object for the copy operation. For more information, see POST Object restore (p. 419).
To see sample requests that use versioning, see Sample Request: Copying a specified version of an
object (p. 464).
Access Permissions
When copying an object, you can optionally specify the accounts or groups that should be granted
specific permissions on the new object. There are two ways to grant the permissions using the request
headers:
• Specify a canned ACL with the x-amz-acl request header. For more information, see Canned ACL in
the Amazon Simple Storage Service Developer Guide.
• Specify access permissions explicitly with the x-amz-grant-read, x-amz-grant-read-acp, x-
amz-grant-write-acp, and x-amz-grant-full-control headers. These headers map to the set
of permissions that Amazon S3 supports in an ACL. For more information, go to Access Control List
(ACL) Overview in the Amazon Simple Storage Service Developer Guide.
Note
You can use either a canned ACL or specify access permissions explicitly. You cannot do both.
Requests
Syntax
PUT /destinationObject HTTP/1.1
Host: destinationBucket.s3.amazonaws.com
x-amz-copy-source: /source_bucket/sourceObject
x-amz-metadata-directive: metadata_directive
x-amz-copy-source-if-match: etag
x-amz-copy-source-if-none-match: etag
x-amz-copy-source-if-unmodified-since: time_stamp
x-amz-copy-source-if-modified-since: time_stamp
<request metadata>
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Date: date
Note
The syntax shows only some of the request headers. For a complete list, see the Request
Headers section.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
x-amz-copy-source The name of the source bucket and key name of Yes
the source object, separated by a slash (/).
Type: String
Default: None
Constraints:
Type: String
Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Type: Enum
Default: STANDARD
Type: String
Default: COPY
x-amz-website-redirect-location: /
anotherPage.html
x-amz-website-redirect-location:
http://www.example.com/
Type: String
Default: None
• To encrypt the target object using server-side encryption with an AWS-managed encryption key,
provide the following request headers, as appropriate.
Type: String
Type: String
Note
If you specify x-amz-server-side-encryption:aws:kms, but don't provide x-amz-
server-side- encryption-aws-kms-key-id, Amazon S3 uses the default AWS KMS key
to protect the data.
Important
All GET and PUT requests for an object protected by AWS KMS fail if you don't make them
with SSL or by using SigV4.
For more information on Server-Side Encryption with Amazon KMS-Managed Keys (SSE-KMS), see
Protecting Data Using Server-Side Encryption with AWS KMS-Managed Keys in the Amazon Simple
Storage Service Developer Guide.
• To encrypt the target object using server-side encryption with an encryption key that you provide, use
the following headers.
x-amz-server- Specifies the algorithm to use to when encrypting the object. Yes
side-encryption
-customer- Type: String
algorithm
API Version 2006-03-01
458
Amazon Simple Storage Service API Reference
Requests
Type: String
Default: None
Type: String
Default: None
• If the source object is encrypted using server-side encryption with customer-provided encryption keys,
you must use the following headers.
x-amz-copy- Specifies the algorithm to use when decrypting the source Yes
source-server- object.
side-encryption
-customer- Type: String
algorithm
Default: None
Type: String
Default: None
Type: String
Default: None
For more information on Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C), see
Protecting Data Using Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C) in the
Amazon Simple Storage Service Developer Guide.
• Specify a canned ACL — Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each
canned ACL has a predefined set of grantees and permissions. For more information, see Canned ACL.
Type: String
Default: private
Constraints: None
• Specify access permissions explicitly — To explicitly grant access permissions to specific AWS
accounts or groups, use the following headers. Each header maps to specific permissions that Amazon
S3 supports in an ACL. For more information, see Access Control List (ACL) Overview. In the header,
you specify a list of grantees who get the specific permission.
x-amz-grant- Gives the grantee permissions to read the object data and its No
read metadata.
Type: String
Default: None
Constraints: None
x-amz-grant- Not applicable. This header applies only when granting access No
write permissions on a bucket.
Type: String
Default: None
Constraints: None
Default: None
Constraints: None
x-amz-grant- Gives the grantee permissions to write the ACL for the applicable No
write-acp object.
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
You specify each grantee as a type=value pair, where the type is one of the following:
For example, the following x-amz-grant-read header grants the AWS accounts identified by email
addresses permissions to read object data and its metadata:
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
Type: String
Type: String
Type: String
Type: String
Name Description
Type: String
Type: String
Default: None
Type: String
Response Elements
Name Description
Type: Container
Ancestor: None
ETag Returns the ETag of the new object. The ETag reflects only changes
to the contents of an object, not its metadata. The source and
destination ETag is identical for a successfully copied object.
Type: String
Ancestor: CopyObjectResult
LastModified Returns the date that the object was last modified.
Type: String
Ancestor: CopyObjectResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This example copies my-image.jpg into the bucket bucket, with the key name my-second-
image.jpg.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-copy-source-version-id: 3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY
+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo
x-amz-version-id: QUpfdndhfd8438MNFDN93jdnJFkdmqnh893
Date: Wed, 28 Oct 2009 22:32:00 GMT
Connection: close
Server: AmazonS3
<CopyObjectResult>
<LastModified>2009-10-28T22:32:00</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
</CopyObjectResult>
x-amz-version-id returns the version ID of the object in the destination bucket. x-amz-copy-
source-version-id returns the version ID of the source object.
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-version-id: QUpfdndhfd8438MNFDN93jdnJFkdmqnh893
x-amz-copy-source-version-id: 09df8234529fjs0dfi0w52935029wefdj
Date: Wed, 28 Oct 2009 22:32:00 GMT
Connection: close
Server: AmazonS3
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-copy-source-version-id: 3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY
+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo
Date: Wed, 28 Oct 2009 22:32:00 GMT
Connection: close
Server: AmazonS3
Related Resources
• Copying Objects
• PUT Object (p. 434)
• GET Object (p. 370)
You can use one of the following two ways to set an object's permissions:
Depending on your application needs, you may choose to set the ACL on an object using either the
request body or the headers. For example, if you have an existing application that updates an object ACL
using the request body, then you can continue to use that approach.
Versioning
The ACL of an object is set at the object version level. By default, PUT sets the ACL of the current version
of an object. To set the ACL of a different version, use the versionId subresource.
To see sample requests that use versioning, see Sample Request: Setting the ACL of a specified object
version (p. 472).
Requests
Syntax
The following request shows the syntax for sending the ACL in the request body. If you want to use
headers to specify the permissions for the object, you cannot send the ACL in the request body. Instead,
see the Request Headers section for a list of headers you can use.
<AccessControlPolicy>
<Owner>
<ID>ID</ID>
<DisplayName>EmailAddress</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>ID</ID>
<DisplayName>EmailAddress</DisplayName>
</Grantee>
<Permission>Permission</Permission>
</Grant>
...
</AccessControlList>
</AccessControlPolicy>
Note
The syntax shows some of the request headers. For a complete list see the Request Headers
section.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
You can use the following request headers in addition to the Common Request Headers (p. 2).
Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each canned ACL has a predefined
a set of grantees and permissions. For more information, see Canned ACL. To grant access permissions by
specifying canned ACLs, you use the following header and specify the canned ACL name as its value. If
you use this header, you cannot use other access control-specific headers in your request.
x-amz-acl Sets the ACL of the object using the specified canned ACL. For No
more information, go to Canned ACL in the Amazon Simple Storage
Service Developer Guide.
Type: String
Default: private
If you need to grant individualized access permissions on an object, you can use the following x-amz-
grant-permission headers. When using these headers you specify explicit access permissions and
grantees (AWS accounts or Amazon S3 groups) who will receive the permission. If you use these ACL
specific headers, you cannot use x-amz-acl header to set a canned ACL.
Note
Each of the following request headers maps to specific permissions Amazon S3 supports in an
ACL. For more information, go to Access Control List (ACL) Overview.
x-amz-grant- Allows the specified grantee to list the objects in the bucket. No
read
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
Default: None
Constraints: None
x-amz-grant- Allows the specified grantee to write the ACL for the applicable No
write-acp bucket.
Type: String
Default: None
Constraints: None
x-amz-grant- Allows the specified grantee the READ, WRITE, READ_ACP, and No
full-control WRITE_ACP permissions on the bucket.
Type: String
Default: None
Constraints: None
For each of these headers, the value is a comma-separated list of one or more grantees. You specify each
grantee as a type=value pair, where the type can be one of the following:
For example, the following x-amz-grant-read header grants list objects permission to the two AWS
accounts identified by their email addresses.
Request Elements
If you decide to use the request body to specify an ACL, you must use the following elements.
Note
If you use the request body, you cannot use the request headers to set an ACL.
Type: Container
Ancestors: AccessControlPolicy
AccessControlPolicy Contains the elements that set the ACL permissions for an No
object per grantee
Type: Container
Ancestors: None
Type: String
Ancestors: AccessControlPolicy.Owner
Type: Container
Ancestors: AccessControlPolicy.AccessControlList
Type: String
Ancestors: AccessControlPolicy.AccessControlList.Grant
Type: String
Ancestors: AccessControlPolicy.Owner or
AccessControlPolicy.AccessControlList.Grant
Owner Container for the bucket owner's display name and ID Yes
Type: Container
Ancestors: AccessControlPolicy
Type: String
Ancestors:
AccessControlPolicy.AccessControlList.Grant
Grantee Values
You can specify the person (grantee) to whom you're assigning access rights (using request elements) in
the following ways:
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser"><ID><replaceable>ID</replaceable></
ID><DisplayName><replaceable>GranteesEmail</replaceable></DisplayName>
</Grantee>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AmazonCustomerByEmail"><EmailAddress><replaceable>Grantees@email.com</
replaceable></EmailAddress>lt;/Grantee>
The grantee is resolved to the CanonicalUser and, in a response to a GET Object acl request,
appears as the CanonicalUser.
• By URI:
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="Group"><URI><replaceable>http://acs.amazonaws.com/groups/global/
AuthenticatedUsers</replaceable></URI></Grantee>
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
Default: None
Response Elements
This operation does not return response elements.
Special Errors
This operation does not return special errors. For general information about Amazon S3 errors and a list
of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request grants access permission to an existing object. The request specifies the ACL in the
body. In addition to granting full control to the object owner, the XML specifies full control to an AWS
account identified by its canonical user ID.
<AccessControlPolicy>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>CustomersName@amazon.com</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeeExampleCanonicalUserID</ID>
<DisplayName>CustomerName@amazon.com</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Sample Response
The following shows a sample response when versioning on the bucket is enabled.
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51T9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-version-id: 3/L4kqtJlcpXrof3vjVBH40Nr8X8gdRQBpUMLUo
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
Content-Length: 0
Connection: close
Server: AmazonS3
PUT /my-image.jpg?acl&versionId=3HL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nrjfkd
HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: authorization string
Content-Length: 124
<AccessControlPolicy>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>mtd@amazon.com</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51u8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-version-id: 3/L4kqtJlcpXro3vjVBH40Nr8X8gdRQBpUMLUo
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
Content-Length: 0
Connection: close
Server: AmazonS3
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: w5YegkbG6ZDsje4WK56RWPxNQHIQ0CjrjyRVFZhEJI9E3kbabXnBO9w5G7Dmxsgk
x-amz-request-id: C13B2827BD8455B1
Date: Sun, 29 Apr 2012 23:24:12 GMT
Content-Length: 0
Server: AmazonS3
Related Resources
• PUT Object - Copy (p. 451)
• POST Object (p. 407)
• GET Object (p. 370)
A tag is a key-value pair. You can associate tags with an object by sending a PUT request against the
tagging subresource that is associated with the object. You can retrieve tags by sending a GET request.
For more information, see GET Object tagging (p. 389).
For tagging-related restrictions related to characters and encodings, see Tag Restrictions in the AWS
Billing and Cost Management User Guide. Note that Amazon S3 limits the maximum number of tags to 10
tags per object.
To use this operation, you must have permission to perform the s3:PutObjectTagging action. By
default, the bucket owner has this permission and can grant this permission to others.
To put tags of any other version, use the versionId query parameter. You also need permission for
the s3:PutObjectVersionTagging action.
For information about the Amazon S3 object tagging feature, see Object Tagging in the Amazon Simple
Storage Service Developer Guide.
Requests
Syntax
The following request shows the syntax for sending tagging information in the request body.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Content-MD5 is a required header for this operation.
Request Elements
Name Description Required
Ancestors: None
Type: Container
Ancestors: Tagging
Type: Container
Ancestors: TagSet
Ancestors: Tag
Ancestors: Tag
Responses
Response Headers
The operation returns response headers that are common to most responses. For more information, see
Common Response Headers (p. 4).
Response Elements
This operation does not return response elements.
Special Errors
• InvalidTagError - The tag provided was not a valid tag. This error can occur if the tag did not pass input
validation. For more information, see Object Tagging in the Amazon Simple Storage Service Developer
Guide.
• MalformedXMLError - The XML provided does not match the schema.
• OperationAbortedError - A conflicting conditional operation is currently in progress against this
resource. Please try again.
• InternalError - The service was unable to apply the provided tag to the object.
Examples
Sample Request: Add tag set to an object
The following request adds a tag set to the existing object object-key in the examplebucket bucket.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Fri, 23 Sep 2016 00:20:19 GMT
Related Resources
• GET Object tagging (p. 389)
For more information about Amazon S3 Select, see Selecting Content from Objects in the Amazon
Simple Storage Service Developer Guide.
For more information about using SQL with Amazon S3 Select, see SQL Reference for Amazon S3 Select
and Glacier Select in the Amazon Simple Storage Service Developer Guide.
Permissions
You must have s3:GetObject permission for this operation. Amazon S3 Select does not support
anonymous access. For more information about permissions, see Specifying Permissions in a Policy in the
Amazon Simple Storage Service Developer Guide.
• CSV, JSON, and Parquet – Objects must be in CSV, JSON, or Parquet format.
• UTF-8 – UTF-8 is the only encoding type Amazon S3 Select supports.
• GZIP or BZIP2 – CSV and JSON files can be compressed using GZIP or BZIP2. GZIP and BZIP2 are the
only compression formats that Amazon S3 Select supports for CSV and JSON files. Amazon S3 Select
supports columnar compression for Parquet using GZIP or Snappy. Amazon S3 Select does not support
whole-object compression for Parquet objects.
• Server-side encryption – Amazon S3 Select supports querying objects that are protected with server-
side encryption.
For objects that are encrypted with customer-provided encryption keys (SSE-C), you must use HTTPS,
and you must use the headers that are documented in the Specific Request Headers for Server-Side
Encryption with Customer-Provided Encryption Keys (p. 374) section in the Amazon S3 GET Object
REST API. For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided
Encryption Keys) in the Amazon Simple Storage Service Developer Guide.
For objects that are encrypted with Amazon S3 managed encryption keys (SSE-S3) and AWS KMS
managed encryption keys (SSE-KMS), server-side encryption is handled transparently, so you don't
need to specify anything. For more information about server-side encryption, including SSE-S3 and
SSE-KMS, see Protecting Data Using Server-Side Encryption in the Amazon Simple Storage Service
Developer Guide.
Requests
Syntax
POST /ObjectName?select&select-type=2 HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (See Authenticating Requests (AWS Signature Version
4))
Note
The syntax shows some of the request headers. For a complete list, see the "Request Headers"
section of this topic.
Query parameters select and select-type=2 are both required for all requests. select-
type=2 is present in order to enable extensions for future capabilities.
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Body
The following XML shows the request body for an object in CSV format with results in CSV format:
The following XML shows the request body for an object in JSON format with results in JSON format:
The following XML shows the request body for an object in Parquet format with results in CSV format:
Note
In the XML:
• The InputSerialization element describes the format of the data in the object that is
being queried. It must specify CSV, JSON, or Parquet.
• The OutputSerialization element describes the format of the data that you want
Amazon S3 to return in response to the query. It must specify either CSV or JSON. Amazon S3
Select doesn't support outputting data in Parquet format.
• The format of the InputSerialization doesn't need to match the format
of the OutputSerialization. So, for example, you can specify JSON in the
InputSerialization and CSV in the OutputSerialization.
The following tables explain each of the XML elements in the request body.
Type: String
Ancestor: SelectRequest
Type: String
Ancestor: SelectRequest
Type: Container
Ancestor: SelectRequest
Type: Container
Ancestor: SelectRequest
Type: Container
Ancestor: SelectRequest
Type: String
Ancestor: InputSerialization
CSV | JSON | Specifies the format and certain properties of the Amazon S3 Exactly one
Parquet object that is being queried. of CSV, JSON,
or Parquet is
Type: Container required.
Ancestor: InputSerialization
Type: String
Default: \n
Ancestor: CSV
Type: String
Default: ,
Ancestor: CSV
QuoteCharacter The value to use for escaping when the field delimiter is part of No
the value.
"a, b"
Type: String
Default: "
Type: String
Default: "
Ancestor: CSV
FileHeaderInfo Describes the first line in the input data. It is one of the ENUM No
values.
Type: Enum
Ancestor: CSV
Type: String
Default: #
Ancestor: CSV
Type: Boolean
Default: FALSE
Ancestor: CSV
Type The type of JSON content. LINES means that each line in the Yes
input data contains a single JSON object. DOCUMENT means that
a single JSON object can span multiple lines in the input. Using
DOCUMENT might result in slower performance in some cases.
Type: Enum
Ancestor: JSON
CSV | JSON Specifies the format and certain properties of the data that is Exactly one of
returned in response. CSV or JSON is
required.
Type: Container
Ancestor: OutputSerialization
Type: String
Default: ASNEEDED
Ancestor: CSV
Type: String
Default: \n
Type: String
Default: ,
Ancestor: CSV
QuoteCharacter The value to use for escaping when the field delimiter is part No
of the value. For example, if the value is a, b, then Amazon S3
wraps this field value in quotation marks as follows: " a , b
".
Type: String
Default: "
Ancestor: CSV
Type: String
Default: "
Ancestor: CSV
Type: String
Default: \n
Ancestor: JSON
Type: Boolean
Default: FALSE
Ancestor: RequestProgress
Responses
A successful operation returns 200 OK status code.
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Body
Because the response size is unknown, Amazon S3 streams the response as a series of messages and
includes a Transfer-Encoding header with chunked as its value in the response. The following
example shows the response format at the top level:
<Message 1>
<Message 2>
<Message 3>
......
<Message n>
Each message consists of two sections: the prelude and the data. The prelude section consists of 1) the
total byte-length of the message, and 2) the combined byte-length of all the headers. The data section
consists of 1) the headers, and 2) a payload.
Each section ends with a 4-byte big-endian integer checksum (CRC). Amazon S3 Select uses CRC32
(often referred to as GZIP CRC32) to calculate both CRCs. For more information about CRC32, see GZIP
file format specification version 4.3.
Total message overhead including the prelude and both checksums is 16 bytes.
Note
All integer values within messages are in network byte order, or big-endian order.
The following diagram shows the components that make up a message and a header. Note that there are
multiple headers per message.
Note
For Amazon S3 Select, the header value type is always 7 (type=String). For this type, the header
value consists of two components, a 2-byte big-endian integer length, and a UTF-8 string that
is of that byte-length. The following diagram shows the components that make up Amazon S3
Select headers.
• First four bytes: Total byte-length: Big-endian integer byte-length of the entire message (including
the 4-byte total length field itself).
• Second four bytes: Headers byte-length: Big-endian integer byte-length of the headers portion of
the message (excluding the headers length field itself).
• Prelude CRC: 4-byte big-endian integer checksum (CRC) for the prelude portion of the message
(excluding the CRC itself). The prelude has a separate CRC from the message CRC (see below),
to ensure that corrupted byte-length information can be detected immediately, without causing
pathological buffering behavior.
• Headers: A set of metadata annotating the message, such as the message type, payload format, and
so on. Messages can have multiple headers, so this portion of the message can have different byte-
lengths depending on the message type. Headers are key-value pairs, where both the key and value
are UTF-8 strings. Headers can appear in any order within the headers portion of the message, and any
given header type can only appear once.
For Amazon S3 Select, following is a list of header names and the set of valid values depending on the
message type.
• MessageType Header:
• HeaderName => ":message-type"
• Valid HeaderValues => "error", "event"
• EventType Header:
• HeaderName => ":event-type"
• Valid HeaderValues => "Records", "Cont", "Progress", "Stats", "End"
• ErrorCode Header:
• HeaderName => ":error-code"
• Valid HeaderValues => Error Code from the table in the Special Errors (p. 494) section.
• ErrorMessage Header:
• HeaderName => ":error-message"
• Valid HeaderValues => Error message returned by the service, to help diagnose request-level
errors.
• Payload: Can be anything.
• Message CRC: 4-byte big-endian integer checksum (CRC) from the start of the message to the start of
the checksum (that is, everything in the message excluding the message CRC itself).
Each header contains the following components. There can be multiple headers per message.
• Records message: Can contain a single record, partial records, or multiple records. Depending on the
size of the result, a response can contain one or more of these messages.
• Continuation message: Amazon S3 periodically sends this message to keep the TCP connection open.
These messages appear in responses at random. The client must detect the message type and process
accordingly.
• Progress message: Amazon S3 periodically sends this message, if requested. It contains information
about the progress of a query that has started but has not yet completed.
• Stats message: Amazon S3 sends this message at the end of the request. It contains statistics about
the query.
• End message: Indicates that the request is complete, and no more messages will be sent. You should
not assume that the request is complete until the client receives an End message.
• RequestLevelError message: Amazon S3 sends this message if the request failed for any reason. It
contains the error code and error message for the failure. If Amazon S3 sends a RequestLevelError
message, it doesn't send an End message.
The following sections explain the structure of each message type in more detail.
For sample code and unit tests that use this protocol, see AWS C Event Stream on the GitHub website.
Records Message
Header specification
Payload specification
Records message payloads can contain a single record, partial records, or multiple records.
Continuation Message
Header specification
Payload specification
Progress Message
Header specification
Payload specification
Progress message payload is an XML document containing information about the progress of a request.
• BytesScanned => Number of bytes that have been processed before being uncompressed (if the file is
compressed).
• BytesProcessed => Number of bytes that have been processed after being uncompressed (if the file is
compressed).
• BytesReturned => Current number of bytes of records payload data returned by Amazon S3.
Example:
Stats Message
Header specification
Stats messages contain three headers, as follows:
Payload specification
Stats message payload is an XML document containing information about a request's stats when
processing is complete.
• BytesScanned => Number of bytes that have been processed before being uncompressed (if the file is
compressed).
• BytesProcessed => Number of bytes that have been processed after being uncompressed (if the file is
compressed).
• BytesReturned => Total number of bytes of records payload data returned by Amazon S3.
Example:
<Stats>
<BytesScanned>512</BytesScanned>
<BytesProcessed>1024</BytesProcessed>
<BytesReturned>1024</BytesReturned>
</Stats>
End Message
Header specification
Payload specification
For a list of possible error codes and error messages, see the table in the Special Errors (p. 494) section.
Payload specification
Request-level error messages have no payload.
Special Errors
The following table contains special errors that SELECT Object Content might return.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
ParseExpectedDatePart Did not find the expected date part 400 Client
in the SQL expression.
ParseExpectedTypeName Did not find the expected type name 400 Client
in the SQL expression.
Examples
Example 1: CSV Object
The following select request retrieves all records from an object with data stored in CSV format. The
OutputSerialization element directs Amazon S3 to return results in CSV.
• Assuming that you are not using column headers, you can identify columns using positional headers:
• If you have column headers and you set the FileHeaderInfo to Use, you can identify columns by
name in the expression:
HTTP/1.1 200 OK
x-amz-id-2: GFihv3y6+kE7KG11GEkQhU7/2/cHR3Yb2fCb2S04nxI423Dqwg2XiQ0B/UZlzYQvPiBlZNRcovw=
x-amz-request-id: 9F341CD3C4BA79E0
Date: Tue, 17 Oct 2017 23:54:05 GMT
A series of messages
Notes
The SELECT Object Content operation does not support the following GET Object functionality.
For more information, see GET Object (p. 370).
Related Resources
• GET Object (p. 370)
• GET Bucket lifecycle (p. 171)
• PUT Bucket lifecycle (p. 290)
For information on permissions required to use the multipart upload API, go to Multipart Upload API and
Permissions in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
DELETE /ObjectName?uploadId=UploadId HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: Date
Authorization: authorization string
Request Parameters
This operation does not use request parameters.
Request Headers
This operation uses only Request Headers common to most requests. For more information, see Common
Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
This operation uses only response headers that are common to most responses. For more information,
see Common Response Headers (p. 4).
Response Elements
This operation does not use response elements.
Special Errors
NoSuchUpload The specified multipart upload does not exist. 404 Not Found Client
The upload ID might be invalid, or the multipart
upload might have been aborted or completed.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following request aborts a multipart upload identified by its upload ID.
DELETE /example-object?uploadId=VXBsb2FkIElEIGZvciBlbHZpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZ
HTTP/1.1
Host: example-bucket.s3.amazonaws.com
Date: Mon, 1 Nov 2010 20:34:56 GMT
Authorization: authorization string
Sample Response
HTTP/1.1 204 OK
x-amz-id-2: Weag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 996c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
Content-Length: 0
Connection: keep-alive
Server: AmazonS3
Related Actions
• Initiate Multipart Upload (p. 512)
• Upload Part (p. 528)
• Complete Multipart Upload (p. 506)
• List Parts (p. 522)
• List Multipart Uploads (p. 243)
You first initiate the multipart upload and then upload all parts using the Upload Parts operation
(see Upload Part (p. 528)). After successfully uploading all relevant parts of an upload, you call this
operation to complete the upload. Upon receiving this request, Amazon S3 concatenates all the parts in
ascending order by part number to create a new object. In the Complete Multipart Upload request, you
must provide the parts list. You must ensure the parts list is complete, this operation concatenates the
parts you provide in the list. For each part in the list, you must provide the part number and the ETag
header value, returned after that part was uploaded.
Processing of a Complete Multipart Upload request could take several minutes to complete. After
Amazon S3 begins processing the request, it sends an HTTP response header that specifies a 200 OK
response. While processing is in progress, Amazon S3 periodically sends whitespace characters to keep
the connection from timing out. Because a request could fail after the initial 200 OK response has been
sent, it is important that you check the response body to determine whether the request succeeded.
Note that if Complete Multipart Upload fails, applications should be prepared to retry the failed
requests. For more information, go to Amazon S3 Error Best Practices section of the Amazon Simple
Storage Service Developer Guide.
For more information on multipart uploads, go to Uploading Objects Using Multipart Upload in the
Amazon Simple Storage Service Developer Guide.
For information on permissions required to use the multipart upload API, go to Multipart Upload API and
Permissions in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
POST /ObjectName?uploadId=UploadId HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: Date
Content-Length: Size
Authorization: authorization string
<CompleteMultipartUpload>
<Part>
<PartNumber>PartNumber</PartNumber>
<ETag>ETag</ETag>
</Part>
...
</CompleteMultipartUpload>
Request Parameters
This operation does not use request parameters.
Request Headers
This operation uses only Request Headers common to most requests. For more information, see Common
Request Headers (p. 2)
Request Elements
Ancestor: None
Type: Container
Ancestor: CompleteMultipartUpload
Type: Container
Ancestor: Part
Type: Integer
ETag Entity tag returned when the part was uploaded. Yes
Ancestor: Part
Type: String
Responses
Response Headers
The operation uses the following response header, in addition to the response headers common to most
requests. For more information, see Common Response Headers (p. 4).
Header Description
x-amz- Amazon S3 returns this header if an Expiration action is configured for the
expiration object as part of the bucket's lifecycle configuration. The header value includes
an "expiry-date" component and a URL-encoded "rule-id" component. Note that
for versioning-enabled buckets, this header applies only to current versions;
Amazon S3 does not provide a header to infer when a noncurrent version will
be eligible for permanent deletion. For more information, see PUT Bucket
lifecycle (p. 290).
Type: String
x-amz-server- If you specified server-side encryption either with an AWS KMS or Amazon S3-
side-encryption managed encryption key in your initiate multipart upload request, the response
includes this header. It confirms the encryption algorithm that Amazon S3 used
to encrypt the object.
Header Description
Type: String
x-amz-version- Version ID of the newly created object, in case the bucket has versioning turned
id on.
Type: String
Response Elements
Name Description
Type: Container
Ancestors: None
Type: URI
Ancestors: CompleteMultipartUploadResult
Bucket The name of the bucket that contains the newly created
object.
Type: String
Ancestors: CompleteMultipartUploadResult
Type: String
Ancestors: CompleteMultipartUploadResult
ETag Entity tag that identifies the newly created object's data.
Objects with different object data will have different entity
tags. The entity tag is an opaque string. The entity tag
may or may not be an MD5 digest of the object data. If the
entity tag is not an MD5 digest of the object data, it will
Name Description
contain one or more nonhexadecimal characters and/or will
consist of less than 32 or more than 32 hexadecimal digits.
Type: String
Ancestors: CompleteMultipartUploadResult
Special Errors
EntityTooSmall Your proposed upload is smaller than the minimum 400 Bad Request
allowed object size. Each part must be at least 5 MB in
size, except the last part.
InvalidPart One or more of the specified parts could not be found. 400 Bad Request
The part might not have been uploaded, or the specified
entity tag might not have matched the part's entity tag.
InvalidPartOrder The list of parts was not in ascending order. The parts list 400 Bad Request
must be specified in order by part number.
NoSuchUpload The specified multipart upload does not exist. The upload 404 Not Found
ID might be invalid, or the multipart upload might have
been aborted or completed.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following Complete Multipart Upload request specifies three parts in the
CompleteMultipartUpload element.
POST /example-object?uploadId=AAAsb2FkIElEIGZvciBlbHZpbmcncyWeeS1tb3ZpZS5tMnRzIRRwbG9hZA
HTTP/1.1
Host: example-bucket.s3.amazonaws.com
Date: Mon, 1 Nov 2010 20:34:56 GMT
Content-Length: 391
Authorization: authorization string
<CompleteMultipartUpload>
<Part>
<PartNumber>1</PartNumber>
<ETag>"a54357aff0632cce46d942af68356b38"</ETag>
</Part>
<Part>
<PartNumber>2</PartNumber>
<ETag>"0c78aef83f66abc1fa1e8477f296d394"</ETag>
</Part>
<Part>
<PartNumber>3</PartNumber>
<ETag>"acbd18db4cc2f85cedef654fccc4a4d8"</ETag>
</Part>
</CompleteMultipartUpload>
Sample Response
The following response indicates that an object was successfully assembled.
HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
Connection: close
Server: AmazonS3
HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
Connection: close
Server: AmazonS3
<Error>
<Code>InternalError</Code>
Related Actions
• Initiate Multipart Upload (p. 512)
• Upload Part (p. 528)
• Abort Multipart Upload (p. 504)
• List Parts (p. 522)
• List Multipart Uploads (p. 243)
For more information about multipart uploads, see Multipart Upload Overview in the Amazon Simple
Storage Service Developer Guide.
If you have configured a lifecycle rule to abort incomplete multipart uploads, the upload must complete
within the number of days specified in the bucket lifecycle configuration. Otherwise, the incomplete
multipart upload becomes eligible for an abort operation and Amazon S3 aborts the multipart upload.
For more information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Policy in the
Amazon Simple Storage Service Developer Guide.
For information about the permissions required to use the multipart upload API, see Multipart Upload
API and Permissions in the Amazon Simple Storage Service Developer Guide.
For request signing, multipart upload is just a series of regular requests. You initiate a multipart upload,
send one or more requests to upload parts, and then complete the multipart upload process. You sign
each request individually. There is nothing special about signing multipart upload requests. For more
information about signing, see Authenticating Requests (AWS Signature Version 4) (p. 14).
Note
After you initiate a multipart upload and upload one or more parts, to stop being charged for
storing the uploaded parts, you must either complete or abort the multipart upload. Amazon S3
frees up the space used to store the parts and stop charging you for storing them only after you
either complete or abort a multipart upload.
You can optionally request server-side encryption. For server-side encryption, Amazon S3 encrypts your
data as it writes it to disks in its data centers and decrypts it when you access it. You can provide your
own encryption key, or use AWS Key Management Service (AWS KMS) encryption keys or Amazon S3-
managed encryption keys. If you choose to provide your own encryption key, the request headers you
provide in Upload Part (p. 528) and Upload Part - Copy (p. 534) requests must match the headers
you used in the request to initiate the upload by using Initiate Multipart Upload (p. 512). For more
information, see Protecting Data Using Server-Side Encryption in the Amazon Simple Storage Service
Developer Guide.
Requests
Syntax
POST /ObjectName?uploads HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
4))
Request Parameters
This operation does not use request parameters.
Request Headers
Type: String
Default: None
Type: String
Default: None
Content-Encoding Specifies the content encodings that have been applied to the No
object and which decoding mechanisms must be applied to
obtain the media-type referenced by the Content-Type header
field. For more information, see http://www.w3.org/Protocols/
rfc2616/rfc2616-sec14.html#sec14.11.
Type: String
Default: None
Content-Type A standard MIME type that describes the format of the object No
data. For more information, see http://www.w3.org/Protocols/
rfc2616/rfc2616-sec14.html#sec14.17.
Type: String
Default: binary/octet-stream
Expires The date and time at which the object should no longer be No
cached. For more information, see http://www.w3.org/Protocols/
rfc2616/rfc2616-sec14.html#sec14.21.
Type: String
Default: None
x-amz-meta- Headers starting with this prefix are user-defined metadata. Each No
one is stored and returned as a set of key-value pairs. Amazon
S3 doesn't validate or interpret user-defined metadata. For more
information, see PUT Object (p. 434).
Type: String
Default: None
x-amz-storage- The type of storage to use for the object that is created after a No
class successful multipart upload. If you don't specify a class, Amazon
S3 uses the default storage class, Standard. Amazon S3 supports
Type: Enum
Default: STANDARD
x-amz-tagging Specifies a set of one or more tags you want associated with No
the object. These tags are stored in the tagging subresource
associated with the object.
Type: String
Default: None
x-amz-website-redirect-location: /
anotherPage.html
x-amz-website-redirect-location: http://
www.example.com/
Type: String
Default: None
• Specify canned ACL – Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each
canned ACL has a predefined set of grantees and permissions. For more information, see Canned ACL.
Type: String
Default: private
Constraints: None
• Specify access permissions explicitly – If you want to explicitly grant access permissions to
specific AWS accounts or groups, use the following headers. Each of these headers maps to specific
permissions that Amazon S3 supports in an access control list (ACL). For more information, see
Access Control List (ACL) Overview. In the header, you specify a list of grantees who get the specific
permission.
x-amz-grant-read Allows the grantee to read the object data and its No
metadata.
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
Default: None
x-amz-grant-write- Allows the grantee to write the ACL for the applicable No
acp object.
Type: String
Default: None
Constraints: None
Type: String
Default: None
Constraints: None
You specify each grantee as a type=value pair, where the type can be one of the following:
For example, the following x-amz-grant-read header grants read object data and its metadata
permissions to the AWS accounts identified by their email addresses:
• Use encryption keys managed by AWS KMS or Amazon S3 – If you want AWS to manage the keys used
to encrypt data, specify the following headers in the request.
Type: String
Type: String
Note
If you specify x-amz-server-side-encryption:aws:kms, but do not provide x-amz-
server-side- encryption-aws-kms-key-id, Amazon S3 uses the default AWS KMS key
to protect the data.
For more information on Server-Side Encryption with Amazon KMS-Managed Keys (SSE-KMS), see
Protecting Data Using Server-Side Encryption with AWS KMS-Managed Keys in the Amazon Simple
Storage Service Developer Guide.
• Use customer-provided encryption keys – If you want to manage your own encryption keys, provide all
the following headers in the request.
x-amz-server- Specifies the algorithm to use to when encrypting the object. Yes
side-encryption
-customer- Type: String
algorithm
Default: None
Type: String
Default: None
Type: String
Default: None
For more information on Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C), see
Protecting Data Using Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C) in the
Amazon Simple Storage Service Developer Guide.
Request Elements
This operation does not use request elements.
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
x-amz-abort- If the bucket has a lifecycle rule configured with an action to abort incomplete
date multipart uploads and the prefix in the lifecycle rule matches the object name
in the request, the response includes this header. The header indicates when the
initiated multipart upload becomes eligible for an abort operation. For more
information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle
Policy in the Amazon Simple Storage Service Developer Guide.
The response also includes the x-amz-abort-rule-id header that provides the
ID of the lifecycle configuration rule that defines this action.
Type: String
x-amz-abort- This header is returned along with the x-amz-abort-date header. It identifies
rule-id the applicable lifecycle configuration rule that defines the action to abort
incomplete multipart uploads.
Type: String
x-amz- If you specified server-side encryption either with an AWS KMS key or an Amazon
server-side- S3-managed encryption key in your initiate multipart upload request, the
encryption response includes this header. It confirms the encryption algorithm that Amazon
S3 used to encrypt the part that you uploaded.
Name Description
Type: String
Response Elements
Name Description
Type: Container
Ancestors: None
Type: String
Ancestors: InitiateMultipartUploadResult
Key Object key for which the multipart upload was initiated.
Type: String
Ancestors: InitiateMultipartUploadResult
Type: String
Ancestors: InitiateMultipartUploadResult
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
This operation initiates a multipart upload for the example-object object.
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
Content-Length: 197
Connection: keep-alive
Server: AmazonS3
In the response, Amazon S3 returns an UploadId. In addition, Amazon S3 returns the encryption
algorithm and the MD5 digest of the encryption key that you provided in the request.
HTTP/1.1 200 OK
x-amz-id-2: 36HRCaIGp57F1FvWvVRrvd3hNn9WoBGfEaCVHTCt8QWf00qxdHazQUgfoXAbhFWD
x-amz-request-id: 50FA1D691B62CA43
Date: Wed, 28 May 2014 19:34:58 GMT
x-amz-server-side-encryption-customer-algorithm: AES256
x-amz-server-side-encryption-customer-key-MD5: ZjQrne1X/iTcskbY2m3tFg==
Transfer-Encoding: chunked
<UploadId>EXAMPLEJZ6e0YupT2h66iePQCc9IEbYbDUy4RTpMeoSMLPRp8Z5o1u8feSRonpvnWsKKG35tI2LB9VDPiCgTy.Gq2VxQ
</UploadId>
</InitiateMultipartUploadResult>
Related Actions
• Upload Part (p. 528)
• Complete Multipart Upload (p. 506)
• Abort Multipart Upload (p. 504)
• List Parts (p. 522)
• List Multipart Uploads (p. 243)
List Parts
Description
This operation lists the parts that have been uploaded for a specific multipart upload.
This operation must include the upload ID, which you obtain by sending the initiate multipart upload
request (see Initiate Multipart Upload (p. 512)). This request returns a maximum of 1,000 uploaded
parts. The default number of parts returned is 1,000 parts. You can restrict the number of parts
returned by specifying the max-parts request parameter. If your multipart upload consists of
more than 1,000 parts, the response returns an IsTruncated field with the value of true, and a
NextPartNumberMarker element. In subsequent List Parts requests you can include the part-
number-marker query string parameter and set its value to the NextPartNumberMarker field value
from the previous response.
For more information on multipart uploads, see Uploading Objects Using Multipart Upload in the
Amazon Simple Storage Service Developer Guide.
For information on permissions required to use the multipart upload API, see Multipart Upload API and
Permissions in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
GET /ObjectName?uploadId=UploadId HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: Date
Authorization: authorization string
Request Parameters
This implementation of GET uses the parameters in the following table to return a subset of the objects
in a bucket.
An object key can contain any Unicode character; however, XML 1.0
parser cannot parse some characters, such as characters with an ASCII
value from 0 to 10. For characters that are not supported in XML 1.0,
you can add this parameter to request that Amazon S3 encode the
keys in the response.
Type: String
Default: None
uploadId Upload ID identifying the multipart upload whose parts are being Yes
listed.
Type: String
max-parts Sets the maximum number of parts to return in the response body. No
Type: String
Default: 1,000
part-number- Specifies the part after which listing should begin. Only parts with No
marker higher part numbers will be listed.
Type: String
Default: None
Request Headers
This operation uses only Request Headers common to most requests. For more information, see Common
Request Headers (p. 2).
Request Elements
This operation does not use request elements.
Responses
Response Headers
This operation uses only response headers that are common to most responses. For more information,
see Common Response Headers (p. 4).
Response Elements
Name Description
x-amz-abort-date If the bucket has a lifecycle rule configured with an action to abort
incomplete multipart uploads and the prefix in the lifecycle rule
matches the object name in the request, then the response includes
this header indicating when the initiated multipart upload will become
eligible for abort operation. For more information, see Aborting
Incomplete Multipart Uploads Using a Bucket Lifecycle Policy in the
Amazon Simple Storage Service Developer Guide.
Type: String
Type: String
Name Description
Type: Container
Bucket Name of the bucket to which the multipart upload was initiated.
Type: String
Ancestor: ListPartsResult
Encoding-Type Encoding type used by Amazon S3 to encode object key names in the
XML response.
Type: String
Ancestor: ListBucketResult
Key Object key for which the multipart upload was initiated.
Type: String
Ancestor: ListPartsResult
UploadId Upload ID identifying the multipart upload whose parts are being
listed.
Type: String
Ancestor: ListPartsResult
Initiator Container element that identifies who initiated the multipart upload.
If the initiator is an AWS account, this element provides the same
information as the Owner element. If the initiator is an IAM User, then
this element provides the user ARN and display name.
Type: Container
Ancestor: ListPartsResult
Type: String
Ancestor: Initiator
Name Description
Type: String
Ancestor: Initiator
Owner Container element that identifies the object owner, after the object is
created. If multipart upload is initiated by an IAM user, this element
provides the parent account ID and display name.
Type: Container
Ancestor: ListPartsResult
Type: String
Ancestor: ListPartsResult
Type: Integer
Ancestor: ListPartsResult
NextPartNumberMarker When a list is truncated, this element specifies the last part in the list,
as well as the value to use for the part-number-marker request
parameter in a subsequent request.
Type: Integer
Ancestor: ListPartsResult
Type: Integer
Ancestor: ListPartsResult
IsTruncated Indicates whether the returned list of parts is truncated. A true value
indicates that the list was truncated. A list can be truncated if the
number of parts exceeds the limit returned in the MaxParts element.
Type: Boolean
Ancestor: ListPartsResult
Type: String
Ancestor: ListPartsResult
Name Description
Type: Integer
Ancestor: Part
Type: Date
Ancestor: Part
Type: String
Ancestor: Part
Type: Integer
Ancestor: Part
Examples
Sample Request
Assume you have uploaded parts with sequential part numbers starting with 1. The following List Parts
request specifies max-parts and part-number-marker query parameters. The request lists the first
two parts that follow part number 1, that is, you will get parts 2 and 3 in the response. If more parts
exist , the result is a truncated result and therefore the response will return an IsTruncated element
with the value true. The response will also return the NextPartNumberMarker element with the value
3, which should be used for the value of the part-number-marker request query string parameter in
the next List Parts request.
GET /example-object?
uploadId=XXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZA&max-parts=2&part-
number-marker=1 HTTP/1.1
Host: example-bucket.s3.amazonaws.com
Date: Mon, 1 Nov 2010 20:34:56 GMT
Authorization: authorization string
Sample Response
The following is a sample response.
HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
Content-Length: 985
Connection: keep-alive
Server: AmazonS3
Related Actions
• Initiate Multipart Upload (p. 512)
• Upload Part (p. 528)
• Complete Multipart Upload (p. 506)
• Abort Multipart Upload (p. 504)
• List Multipart Uploads (p. 243)
Upload Part
Description
This operation uploads a part in a multipart upload.
Note
In this operation, you provide part data in your request. However, you have an option to specify
your existing Amazon S3 object as a data source for the part you are uploading. To upload a part
from an existing object, you use the Upload Part (Copy) operation. For more information, see
Upload Part - Copy (p. 534).
You must initiate a multipart upload (see Initiate Multipart Upload (p. 512)) before you can upload any
part. In response to your initiate request, Amazon S3 returns an upload ID, a unique identifier, that you
must include in your upload part request.
Part numbers can be any number from 1 to 10,000, inclusive. A part number uniquely identifies a part
and also defines its position within the object being created. If you upload a new part using the same
part number that was used with a previous part, the previously uploaded part is overwritten. Each part
must be at least 5 MB in size, except the last part. There is no size limit on the last part of your multipart
upload.
To ensure that data is not corrupted when traversing the network, specify the Content-MD5 header in
the upload part request. Amazon S3 checks the part data against the provided MD5 value. If they do not
match, Amazon S3 returns an error.
Note
After you initiate multipart upload and upload one or more parts, you must either complete or
abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only
after you either complete or abort the multipart upload, Amazon S3 frees up the parts storage
and stops charging you for it.
For more information on multipart uploads, go to Multipart Upload Overview in the Amazon Simple
Storage Service Developer Guide .
For information on the permissions required to use the multipart upload API, go to Multipart Upload API
and Permissions in the Amazon Simple Storage Service Developer Guide.
You can optionally request server-side encryption where Amazon S3 encrypts your data as it writes it to
disks in its data centers and decrypts it for you when you access it. You have the option of providing your
own encryption key, or you can use the AWS-managed encryption keys. If you choose to provide your
own encryption key, the request headers you provide in the request must match the headers you used in
the request to initiate the upload by using Initiate Multipart Upload (p. 512). For more information, go to
Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /ObjectName?partNumber=PartNumber&uploadId=UploadId HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Content-Length: Size
Authorization: authorization string
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
Content-Length The size of the part, in bytes. For more information, go to http:// Yes
www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13.
Type: Integer
Default: None
Content-MD5 The base64-encoded 128-bit MD5 digest of the part data. This No
header can be used as a message integrity check to verify that the
part data is the same data that was originally sent. Although it is
optional, we recommend using the Content-MD5 mechanism as an
end-to-end integrity check. For more information, see RFC 1864.
Type: String
Default: None
Expect When your application uses 100-continue, it does not send the No
request body until it receives an acknowledgment. If the message
is rejected based on the headers, the body of the message is not
sent. For more information, go to RFC 2616.
Type: String
Default: None
If you requested server-side encryption using a customer-provided encryption key in your initiate
multipart upload request, you must provide identical encryption information in each part upload using
the following headers.
x-amz-server- Specifies the algorithm to use to when encrypting the object. Yes
side-encryption
Type: String
Default: None
Type: String
Default: None
Request Elements
This operation does not use request elements.
Responses
Response Headers
This implementation of the operation can include the following response headers in addition to the
response headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
x-amz- If you specified server-side encryption either with an AWS KMS or Amazon S3-
server-side- managed encryption key in your initiate multipart upload request, the response
encryption includes this header. It confirms the encryption algorithm that Amazon S3 used to
encrypt the object.
Name Description
Type: String
x-amz- If SSE-C encryption was requested, the response includes this header to provide
server-side roundtrip message integrity verification of the customer-provided encryption key.
-encryption-
customer-key- Type: String
MD5
x-amz- Provides storage class information of the object. Amazon S3 returns this header
storage-class for all objects except for Standard storage class objects.
Type: String
Default: None
Response Elements
This operation does not use response elements.
Special Errors
NoSuchUpload The specified multipart upload does not exist. 404 Not Client
The upload ID might be invalid, or the multipart Found
upload might have been aborted or completed.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Sample Request
The following PUT request uploads a part (part number 1) in a multipart upload. The request includes
the upload ID that you get in response to your Initiate Multipart Upload request.
PUT /my-movie.m2ts?
partNumber=1&uploadId=VCVsb2FkIElEIGZvciBlbZZpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZR HTTP/1.1
Host: example-bucket.s3.amazonaws.com
Date: Mon, 1 Nov 2010 20:34:56 GMT
Content-Length: 10485760
Content-MD5: pUNXr/BjKK5G2UKvaRRrOA==
Authorization: authorization string
Sample Response
The response includes the ETag header. You need to retain this value for use when you send the
Complete Multipart Upload request.
HTTP/1.1 200 OK
x-amz-id-2: Vvag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 1 Nov 2010 20:34:56 GMT
ETag: "b54357faf0632cce46e942fa68356b38"
Content-Length: 0
Connection: keep-alive
Server: AmazonS3
PUT /example-object?
partNumber=1&uploadId=EXAMPLEJZ6e0YupT2h66iePQCc9IEbYbDUy4RTpMeoSMLPRp8Z5o1u8feSRonpvnWsKKG35tI2LB9VDPi
HTTP/1.1
Host: example-bucket.s3.amazonaws.com
Authorization: authorization string
Date: Wed, 28 May 2014 19:40:11 +0000
x-amz-server-side-encryption-customer-key: g0lCfA3Dv40jZz5SQJ1ZukLRFqtI5WorC/8SEEXAMPLE
x-amz-server-side-encryption-customer-key-MD5: ZjQrne1X/iTcskbY2example
x-amz-server-side-encryption-customer-algorithm: AES256
In the response, Amazon S3 returns encryption-specific headers providing the encryption algorithm used
and MD5 digest of the encryption key you provided in the request.
Related Actions
• Initiate Multipart Upload (p. 512)
The minimum allowable part size for a multipart upload is 5 MB. For more information about multipart
upload limits, go to Quick Facts in the Amazon Simple Storage Service Developer Guide.
Note
Instead of using an existing object as part data, you might use the Upload Part operation and
provide data in your request. For more information, see Upload Part (p. 528).
You must initiate a multipart upload before you can upload any part. In response to your initiate request.
Amazon S3 returns a unique identifier, the upload ID, that you must include in your upload part request.
For more information on using the upload part - copy operation, see the following topics:
• For conceptual information on multipart uploads, go to Uploading Objects Using Multipart Upload in
the Amazon Simple Storage Service Developer Guide.
• For information on permissions required to use the multipart upload API, go to Multipart Upload API
and Permissions in the Amazon Simple Storage Service Developer Guide.
• For information about copying objects using a single atomic operation vs. the multipart upload, go to
Operations on Objects in the Amazon Simple Storage Service Developer Guide.
• For information about using server-side encryption with customer-provided encryption keys with the
upload part - copy operation, see PUT Object - Copy (p. 451) and Upload Part (p. 528).
Requests
Syntax
PUT /ObjectName?partNumber=PartNumber&uploadId=UploadId HTTP/1.1
Host: BucketName.s3.amazonaws.com
x-amz-copy-source: /source_bucket/sourceObject
x-amz-copy-source-range:bytes=first-last
x-amz-copy-source-if-match: etag
x-amz-copy-source-if-none-match: etag
x-amz-copy-source-if-unmodified-since: time_stamp
x-amz-copy-source-if-modified-since: time_stamp
Date: date
Authorization: authorization string
Request Parameters
This operation does not use request parameters.
Request Headers
This implementation of the operation can use the following request headers in addition to the request
headers common to all operations. Request headers are limited to 8 KB in size. For more information, see
Common Request Headers (p. 2).
x-amz-copy-source The name of the source bucket and the source object key Yes
name separated by a slash ('/').
Type: String
Default: None
x-amz-copy-source- The range of bytes to copy from the source object. The No
range range value must use the form bytes=first-last,
where the first and last are the zero-based byte offsets to
copy. For example, bytes=0-9 indicates that you want to
copy the first ten bytes of the source.
Type: Integer
Default: None
The following conditional headers are based on the object that the x-amz-copy-source header
specifies.
Type: String
Default: None
Type: String
Default: None
Type: String
Type: String
Default: None
Note the following additional considerations about the preceding request headers:
• Consideration 2 – If both of the x-amz-copy-source-if-none-match and x-amz-copy-source-
if-modified-since headers are present in the request as follows:
x-amz-server- Specifies the algorithm to use to when encrypting the object. Yes
side-encryption
-customer- Type: String
algorithm
Default: None
Type: String
Default: None
Type: String
Default: None
If the source object is encrypted using server-side encryption with a customer-provided encryption key,
you must use the following headers providing encryption information so that Amazon S3 can decrypt
the object for copying.
x-amz-copy- Specifies algorithm to use when decrypting the source object. Yes
source-server-
side-encryption Type: String
-customer-
algorithm Default: None
Type: String
Default: None
Type: String
Default: None
Request Elements
This operation does not use request elements.
Versioning
If your bucket has versioning enabled, you could have multiple versions of the same object. By default,
x-amz-copy-source identifies the current version of the object to copy. If the current version is a
delete marker and you don't specify a versionId in the x-amz-copy-source, Amazon S3 returns a 404
error, because the object does not exist. If you specify versionId in the x-amz-copy-source and the
versionId is a delete marker, Amazon S3 returns an HTTP 400 error, because you are not allowed to
specify a delete marker as a version for the x-amz-copy-source.
You can optionally specify a specific version of the source object to copy by adding the versionId
subresource as shown in the following example:
x-amz-copy-source: /bucket/object?versionId=version id
Responses
Response Headers
This implementation of the operation can include the following headers in addition to the response
headers common to all responses. For more information, see Common Response Headers (p. 4).
Name Description
x-amz-copy-source- The version of the source object that was copied, if you have
version-id enabled versioning on the source bucket.
Type: String
Name Description
upload request, the response includes this header. It confirms the
encryption algorithm that Amazon S3 used to encrypt the object.
Type: String
Type: String
Type: String
Type: String
Response Elements
Name Description
Type: Container
Ancestor: None
Type: String
Ancestor: CopyPartResult
Type: String
Ancestor: CopyPartResult
Important
Part boundaries are factored into ETag calculations, so if the part boundary on the source is
different than on the destination, then the ETag data will not match between the two. However,
data integrity checks are performed with each copy to ensure that the data written to the
destination matches the data at the source.
Special Errors
NoSuchUpload The specified multipart upload does not exist. The upload 404 Not Found
ID might be invalid, or the multipart upload might have
been aborted or completed.
InvalidRequest The specified copy source is not supported as a byte- 400 Bad Request
range copy source.
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
As the following examples illustrate, when a request succeeds, Amazon S3 returns <CopyPartResult>
in the body. If you included versionId in the request, Amazon S3 returns the version ID in the x-amz-
copy-source-version-id response header.
Sample Request
The following PUT request uploads a part (part number 2) in a multipart upload. The request specifies a
byte range from an existing object as the source of this upload. The request includes the upload ID that
you get in response to your Initiate Multipart Upload request.
PUT /newobject?
partNumber=2&uploadId=VCVsb2FkIElEIGZvciBlbZZpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZR HTTP/1.1
Host: target-bucket.s3.amazonaws.com
Date: Mon, 11 Apr 2011 20:34:56 GMT
x-amz-copy-source: /source-bucket/sourceobject
x-amz-copy-source-range:bytes=500-6291456
Authorization: authorization string
Sample Response
The response includes the ETag value. You need to retain this value to use when you send the Complete
Multipart Upload request.
HTTP/1.1 200 OK
x-amz-id-2: Vvag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date: Mon, 11 Apr 2011 20:34:56 GMT
Server: AmazonS3
<CopyPartResult>
<LastModified>2011-04-11T20:34:56.000Z</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
</CopyPartResult>
Sample Request
The following PUT request uploads a part (part number 2) in a multipart upload. The request does not
specify the optional byte range header, but requests the entire source object copy as part 2. The request
includes the upload ID that you got in response to your Initiate Multipart Upload request.
PUT /newobject?
partNumber=2&uploadId=VCVsb2FkIElEIGZvciBlbZZpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZR HTTP/1.1
Host: target-bucket.s3.amazonaws.com
Date: Mon, 11 Apr 2011 20:34:56 GMT
x-amz-copy-source: /source-bucket/sourceobject
Authorization: authorization string
Sample Response
The response structure is similar to the one specified in the preceding example.
Sample Request
The following PUT request uploads a part (part number 2) in a multipart upload. The request specifies
a specific version of the source object to copy by adding the versionId subresource. The byte range
requests 6 MB of data, starting with byte 500, as the part to be uploaded.
PUT /newobject?
partNumber=2&uploadId=VCVsb2FkIElEIGZvciBlbZZpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZR HTTP/1.1
Host: target-bucket.s3.amazonaws.com
Date: Mon, 11 Apr 2011 20:34:56 GMT
x-amz-copy-source: /source-bucket/sourceobject?versionId=3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY
+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo
x-amz-copy-source-range:bytes=500-6291456
Authorization: authorization string
Sample Response
The response includes the ETag value. You need to retain this value to use when you send the Complete
Multipart Upload request.
HTTP/1.1 200 OK
x-amz-id-2: Vvag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
x-amz-copy-source-version-id: 3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY
+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo
Date: Mon, 11 Apr 2011 20:34:56 GMT
Server: AmazonS3
<CopyPartResult>
<LastModified>2011-04-11T20:34:56.000Z</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
</CopyPartResult>
Related Actions
• Initiate Multipart Upload (p. 512)
• Upload Part (p. 528)
• Complete Multipart Upload (p. 506)
• Abort Multipart Upload (p. 504)
• List Parts (p. 522)
• List Multipart Uploads (p. 243)
Data Types
DefaultRetention
Service: Amazon Simple Storage Service
The container element for specifying the default Object Lock retention settings for new objects placed in
the specified bucket.
Contents
Mode
The default Object Lock retention mode you want to apply to new objects placed in the specified
bucket.
Type: String
Required: Yes
Days
The number of days that you want to specify for the default retention period.
Type: Integer
Required: No
Years
The number of years that you want to specify for the default retention period.
Type: Integer
Required: No
Note
Either Days or Years must be specified, but not both.
ObjectLockConfiguration
Service: Amazon Simple Storage Service
Contents
ObjectLockEnabled
Type: String
Required: Yes
Rule
Required: No
ObjectLockLegalHold
Service: Amazon Simple Storage Service
Contents
Status
Type: String
Required: Yes
ObjectLockRetention
Service: Amazon Simple Storage Service
Contents
Mode
Type: String
Required: Yes
RetainUntilDate
Type: Timestamp
Format: 2020-01-05T00:00:00.000Z
Required: Yes
ObjectLockRule
Service: Amazon Simple Storage Service
Contents
DefaultRetention
The default retention period that you want to apply to new objects placed in the specified bucket.
Required: No
Amazon S3 Resources
Following is a table that lists related resources that you'll find useful as you work with this service.
Resource Description
Amazon Simple Storage Service The getting started guide provides a quick tutorial of the
Getting Started Guide service based on a simple use case.
Amazon Simple Storage Service The developer guide describes how to accomplish tasks using
Developer Guide Amazon S3 operations.
Amazon S3 Technical FAQ The FAQ covers the top 20 questions developers have asked
about this product.
Amazon S3 Release Notes The Release Notes give a high-level overview of the current
release. They specifically note any new features, corrections,
and known issues.
Tools for Amazon Web Services A central starting point to find documentation, code
samples, release notes, and other information to help you
build innovative applications with AWS SDKs and tools.
AWS Management Console The console allows you to perform most of the functions of
Amazon S3 without programming.
AWS Support Center The home page for AWS Technical Support, including access
to our Developer Forums, Technical FAQs, Service Status
page, and Premium Support.
AWS Premium Support The primary web page for information about AWS Premium
Support, a one-on-one, fast-response support channel to
help you build and run applications on AWS Infrastructure
Services.
Amazon S3 product information The primary web page for information about Amazon S3.
Document History
The following table describes the important changes to the documentation since the last release of the
Amazon Simple Storage Service API Reference.
New archive storage Amazon S3 now offers a new archive storage class, March 27,
class DEEP_ARCHIVE, for storing rarely accessed objects. For 2019
more information, see Storage Classes in the Amazon Simple
Storage Service Developer Guide.
Support for Parquet- Amazon S3 now supports the Apache Parquet (Parquet) December
formatted Amazon S3 format in addition to the Apache optimized row columnar 04, 2018
inventory files (ORC) and comma-separated values (CSV) file formats for
inventory output files. For more information, see Amazon
S3 Inventory in the Amazon Simple Storage Service Developer
Guide.
PUT directly to the The Amazon S3 PUT and related operations now support November
GLACIER storage class specifying GLACIER as the storage class when creating 26, 2018
objects. Previously, you had to transition to the GLACIER
storage class from another Amazon S3 storage class. For more
information about the GLACIER storage class, see Storage
Classes in the Amazon Simple Storage Service Developer Guide.
Object Lock Amazon S3 now supports locking objects using a Write Once November
Read Many (WORM) model. You can lock objects for a definite 26, 2018
period of time using a retention period or indefinitely using
a legal hold. For more information about Amazon S3 Object
Lock, see Locking Objects in the Amazon Simple Storage
Service Developer Guide.
New storage class Amazon S3 now offers a new storage class named November
INTELLIGENT_TIERING that is for storing data that has 26, 2018
changing or unknown access patterns. For more information,
see Storage Classes in the Amazon Simple Storage Service
Developer Guide.
Block Public Access Amazon S3 now includes the ability to block public access to November
buckets and objects on a per-bucket or account-wide basis. 15, 2018
For more information, see Using Amazon S3 Block Public
Access in the Amazon Simple Storage Service Developer Guide.
Filtering enhancements In a CRR rule configuration, you can specify an object filter September
in cross-region to choose a subset of objects to apply the rule to. Previously, 19, 2018
replication (CRR) rules you could filter only on an object key prefix. In this release,
you can filter on an object key prefix, one or more object tags,
or both. For more information, see Replication Configuration
Overview in the Amazon Simple Storage Service Developer
Guide.
New storage class Amazon S3 now offers a new storage class, ONEZONE_IA April 4,
(IA, for infrequent access) for storing objects. For more 2018
information, see Storage Classes in the Amazon Simple
Storage Service Developer Guide.
Amazon S3 Select Amazon S3 Select is now generally available. This feature April 4,
retrieves object content based on an SQL expression. For 2018
more information, see Selecting Content from Objects in the
Amazon Simple Storage Service Developer Guide.
Asia Pacific (Osaka- Amazon S3 is now available in the Asia Pacific (Osaka-Local) February
Local) Region Region. For more information about Amazon S3 Regions and 12, 2018
endpoints, see Regions and Endpoints in the AWS General
Reference.
Important
You can use the Asia Pacific (Osaka-Local) Region
only in conjunction with the Asia Pacific (Tokyo)
Region. To request access to Asia Pacific (Osaka-
Local) Region, contact your sales representative.
EU (Paris) Region Amazon S3 is now available in the EU (Paris) Region. For more December
information about Amazon S3 regions and endpoints, see 18, 2017
Regions and Endpoints in the AWS General Reference.
China (Ningxia) Region Amazon S3 is now available in the China (Ningxia) Region. For December
more information about Amazon S3 regions and endpoints, 11, 2017
see Regions and Endpoints in the AWS General Reference.
Querying archives with Amazon S3 now supports querying Glacier data archives with November
SQL SQL. For more information, see Querying Archived Objects in 29, 2017
the Amazon Simple Storage Service Developer Guide.
SELECT Object Content Amazon S3 now supports the SELECT Object Content November
(Preview) functionality as part of a Preview program. This feature 29, 2017
retrieves object content based on an SQL expression.
Support for ORC- Amazon S3 now supports the Apache optimized row November
formatted Amazon S3 columnar (ORC) format in addition to comma-separated 17, 2017
inventory files values (CSV) file format for inventory output files. For more
information, see Amazon S3 Inventory in the Amazon Simple
Storage Service Developer Guide.
Default encryption for Amazon S3 default encryption provides a way to set the November
S3 buckets default encryption behavior for an S3 bucket. You can 06, 2017
set default encryption on a bucket so that all objects are
encrypted when they are stored in the bucket. The objects are
encrypted using server-side encryption with either Amazon
S3-managed keys (SSE-S3) or AWS KMS-managed keys
(SSE-KMS). For more information, see Amazon S3 Default
Encryption for S3 Buckets in the Amazon Simple Storage
Service Developer Guide.
Cross-region replication Cross-region replication (CRR) now supports the following: November
(CRR) enhancements 06, 2017
• In a cross-account scenario, you can add a CRR
configuration to change replica ownership to the AWS
account that owns the destination bucket. For more
information, see CRR: Change Replica Owner in the Amazon
Simple Storage Service Developer Guide.
• By default, Amazon S3 does not replicate objects in your
source bucket that are created using server-side encryption
using AWS KMS-managed keys. In your CRR configuration,
you can now direct Amazon S3 to replicate these objects.
For more information, see CRR: Replicating Objects Created
with SEE Using AWS KMS-Managed Encryption Keys in the
Amazon Simple Storage Service Developer Guide.
EU (London) Region Amazon S3 is now available in the EU (London) Region. For December
more information about Amazon S3 regions and endpoints, 13, 2016
see Regions and Endpoints in the AWS General Reference.
Canada (Central) Region Amazon S3 is now available in the Canada (Central) Region. December
For more information about Amazon S3 regions and 8, 2016
endpoints, see Regions and Endpoints in the AWS General
Reference.
Object tagging support Amazon S3 now supports object tagging. The following new November
API operations support object tagging: 29, 2016
CloudWatch request Amazon S3 now supports CloudWatch metrics for requests November
metrics for buckets made on buckets. The following new API operations support 29, 2016
configuring request metrics:
Amazon S3 Analytics – The new Amazon S3 analytics – storage class analysis feature November
Storage Class Analysis observes data access patterns to help you determine when 29, 2016
to transition less frequently accessed STANDARD storage to
the STANDARD_IA (IA, for infrequent access) storage class.
After storage class analysis observes the infrequent access
patterns of a filtered set of data over a period of time, you
can use the analysis results to help you improve your lifecycle
policies. This feature also includes a detailed daily analysis of
your storage usage at the specified bucket, prefix, or tag level
that you can export to a S3 bucket.
Added Glacier retrieval Amazon S3 now supports Expedited and Bulk data retrievals November
options to POST Object in addition to Standard retrievals when restoring objects 21, 2016
restore (p. 419) archived to Glacier. For more information, see Restoring
Archived Objects in the Amazon Simple Storage Service
Developer Guide.
US East (Ohio) Region Amazon S3 is now available in the US East (Ohio) Region. For October 17,
more information about Amazon S3 regions and endpoints, 2016
see Regions and Endpoints in the AWS General Reference.
Asia Pacific (Mumbai) Amazon S3 is now available in the Asia Pacific (Mumbai) June 27,
region region. For more information about Amazon S3 regions and 2016
endpoints, see Regions and Endpoints in the AWS General
Reference.
GET Bucket (List The GET Bucket (List Objects) API has been revised. We May 4,
Objects) API revised recommend that you use the new version, GET Bucket (List 2016
Objects) version 2. For more information, see GET Bucket (List
Objects) Version 2 (p. 127).
Amazon S3 Transfer Amazon S3 Transfer Acceleration enables fast, easy, and April 19,
Acceleration secure transfers of files over long distances between 2016
your client and an S3 bucket. Transfer Acceleration takes
advantage of Amazon CloudFront’s globally distributed edge
locations.
Lifecycle support to Lifecycle configuration expiration action now allows you to March 16,
remove expired object direct Amazon S3 to remove expired object delete markers 2016
delete marker in versioned bucket. For more information, see Elements
to Describe Lifecycle Actions in the Amazon Simple Storage
Service Developer Guide.
Bucket lifecycle Bucket lifecycle configuration now supports the March 16,
configuration now AbortIncompleteMultipartUpload action that you can 2016
supports the action use to direct Amazon S3 to abort multipart uploads that
to abort incomplete don't complete within a specified number of days after being
multipart uploads initiated. When a multipart upload becomes eligible for an
abort operation, Amazon S3 deletes any uploaded parts and
aborts the multipart upload.
Amazon S3 Signature Amazon S3 Signature Version 4 now supports unsigned January 15,
Version 4 now supports payloads when authenticating requests using the 2016
unsigned payloads Authorization header. Because you don't sign the payload,
it does not provide the same security that comes with payload
signing, but it provides similar performance characteristics
as signature version 2. For more information, see Signature
Calculations for the Authorization Header: Transferring
Payload in a Single Chunk (AWS Signature Version 4) (p. 18).
Asia Pacific (Seoul) Amazon S3 is now available in the Asia Pacific (Seoul) January 6,
region region. For more information about Amazon S3 regions and 2016
endpoints, see Regions and Endpoints in the AWS General
Reference.
Renamed the US Changed the region name string from US Standard to US East December
Standard region (N. Virginia). This is only a region name update, there is no 11, 2015
change in the functionality.
New storage class Amazon S3 now offers a new storage class, STANDARD_IA (IA, September
for infrequent access) for storing objects. This storage class 16, 2015
is optimized for long-lived and less frequently accessed data.
For more information, see Storage Classes in the Amazon
Simple Storage Service Developer Guide.
Event notifications Amazon S3 event notifications have been updated to add July 28,
notifications when objects are deleted and to add filtering on 2015
object names with prefix and suffix matching. For the relevant
API operations, see PUT Bucket notification (p. 315), and
GET Bucket notification (p. 190). For more information, see
Configuring Amazon S3 Event Notifications in the Amazon
Simple Storage Service Developer Guide.
Cross-region replication Amazon S3 now supports cross-region replication. Cross- March 24,
region replication is the automatic, asynchronous copying 2015
of objects across buckets in different AWS regions. For the
relevant API operations, see PUT Bucket replication (p. 327),
GET Bucket replication (p. 212) and DELETE Bucket
replication (p. 121). For more information, see Enabling Cross-
Region Replication in the Amazon Simple Storage Service
Developer Guide.
Event notifications Amazon S3 now supports new event types and November
destinations in a bucket notification configuration. 13, 2014
Prior to this release, Amazon S3 supported only the
s3:ReducedRedundancyLostObject event type and an
Amazon SNS topic as the destination. For more information
about the new event types, go to Setting Up Notification of
Bucket Events in the Amazon Simple Storage Service Developer
Guide. For the relevant API operations, see PUT Bucket
notification (p. 315) and GET Bucket notification (p. 190).
Server-side encryption Amazon S3 now supports server-side encryption using AWS November
with AWS Key Key Management Service (KMS). With server-side encryption 12, 2014
Management Service with KMS, you manage the envelope key through KMS, and
(KMS) Amazon S3 calls KMS to access the envelope key within the
permissions you set.
EU (Frankfurt) region Amazon S3 is now available in the EU (Frankfurt) region. October 23,
2014
Server-side encryption Amazon S3 now supports server-side encryption using June 12,
with customer-provided customer-provided encryption keys (SSE-C). Server-side 2014
encryption keys encryption enables you to request Amazon S3 to encrypt your
data at rest. When using SSE-C, Amazon S3 encrypts your
objects with the custom encryption keys that you provide.
Since Amazon S3 performs the encryption for you, you get
the benefits of using your own encryption keys without the
cost of writing or executing your own encryption code.
Lifecycle support for Prior to this release lifecycle configuration was supported May 20,
versioning only on nonversioned buckets. Now you can configure 2014
lifecycle on both the nonversioned and versioning-enabled
buckets.
The related API operations, see PUT Bucket lifecycle (p. 290),
GET Bucket lifecycle (p. 171), and DELETE Bucket
lifecycle (p. 114).
Amazon S3 now Amazon S3 now supports Signature Version 4 (SigV4) in January 30,
supports Signature all regions, the latest specification for how to sign and 2014
Version 4 authenticate AWS requests.
Amazon S3 list The following Amazon S3 list actions now support November
actions now support encoding-type optional request parameter. 1, 2013
encoding-type
request parameter GET Bucket (List Objects) Version 1 (p. 137)
SOAP Support Over SOAP support over HTTP is deprecated, but it is still available September
HTTP Deprecated over HTTPS. New Amazon S3 features will not be supported 19, 2013
for SOAP. We recommend that you use either the REST API or
the AWS SDKs.
Root domain support Amazon S3 now supports hosting static websites at the root December
for website hosting domain. Visitors to your website can access your site from 27, 2012
their browser without specifying "www" in the web address
(e.g., "example.com"). Many customers already host static
websites on Amazon S3 that are accessible from a "www"
subdomain (e.g., "www.example.com"). Previously, to support
root domain access, you needed to run your own web server
to proxy root domain requests from browsers to your website
on Amazon S3. Running a web server to proxy requests
introduces additional costs, operational burden, and another
potential point of failure. Now, you can take advantage of the
high availability and durability of Amazon S3 for both "www"
and root domain addresses.
Support for Archiving Amazon S3 now supports a storage option that enables November
Data to Amazon Glacier you to utilize Amazon Glacier's low-cost storage service 13, 2012
for data archival. To archive objects, you define archival
rules identifying objects and a timeline when you want
Amazon S3 to archive these objects to Glacier. You can easily
set the rules on a bucket using the Amazon S3 console or
programmatically using the Amazon S3 API or AWS SDKs.
After you archive objects, you must first restore a copy before
you can access the data. Amazon S3 offers a new API for you
to initiate a restore. For more information, see POST Object
restore (p. 419).
Support for Website For a bucket that is configured as a website, Amazon S3 now October 4,
Page Redirects supports redirecting a request for an object to another object 2012
in the same bucket or to an external URL. You can configure
redirect by adding the x-amz-website-redirect-
location metadata to the object.
The object upload API operations PUT Object (p. 434), Initiate
Multipart Upload (p. 512), and POST Object (p. 407) allow
you to configure the x-amz-website-redirect-location
object metadata.
Cross-Origin Resource Amazon S3 now supports Cross-Origin Resource Sharing August 31,
Sharing (CORS) support (CORS). CORS defines a way in which client web applications 2012
that are loaded in one domain can interact with or access
resources in a different domain. With CORS support in
Amazon S3, you can build rich client-side web applications
on top of Amazon S3 and selectively allow cross-domain
access to your Amazon S3 resources. For more information,
see Enabling Cross-Origin Resource Sharing in the Amazon
Simple Storage Service Developer Guide.
Cost Allocation Tagging Amazon S3 now supports cost allocation tagging, which August 21,
support allows you to label S3 buckets so you can more easily 2012
track their cost against projects or other criteria. For more
information, see Cost Allocation Tagging in the Amazon
Simple Storage Service Developer Guide.
Object Expiration You can use Object Expiration to schedule automatic December
support removal of data after a configured time period. You set 27, 2011
object expiration by adding lifecycle configuration to a
bucket. For more information, see Transitioning Objects:
General Considerations in the Amazon Simple Storage Service
Developer Guide.
New Region supported Amazon S3 now supports the South America (São Paulo) December
region. For more information, see Buckets and Regions in the 14, 2011
Amazon Simple Storage Service Developer Guide.
Multi-Object Delete Amazon S3 now supports Multi-Object Delete API that December
enables you to delete multiple objects in a single request. 7, 2011
With this feature, you can remove large numbers of objects
from Amazon S3 more quickly than using multiple individual
DELETE requests.
For more information about the API see, see Delete Multiple
Objects (p. 354).
New region supported Amazon S3 now supports the US West (Oregon) region. For November
more information, see Buckets and Regions in the Amazon 8, 2011
Simple Storage Service Developer Guide.
Server-side encryption Amazon S3 now supports server-side encryption. It enables October 17,
support you to request Amazon S3 to encrypt your data at rest, that 2011
is, encrypt your object data when Amazon S3 writes your data
to disks in its data centers. To request server-side encryption,
you must add the x-amz-server-side-encryption
header to your request. To learn more about data encryption,
go to Using Data Encryption in the Amazon Simple Storage
Service Developer Guide.
Multipart Upload API Prior to this release, Amazon S3 API supported copying June 21,
extended to enable objects (see PUT Object - Copy (p. 451)) of up to 5 GB in 2011
copying objects up to 5 size. To enable copying objects larger than 5 GB, Amazon
TB S3 extends the multipart upload API with a new operation,
Upload Part (Copy). You can use this multipart upload
operation to copy objects up to 5 TB in size. For conceptual
information about multipart upload, go to Uploading Objects
Using Multipart Upload in the Amazon Simple Storage Service
Developer Guide. To learn more about the new API, see Upload
Part - Copy (p. 534).
SOAP API calls over To increase security, SOAP API calls over HTTP are disabled. June 6,
HTTP disabled Authenticated and anonymous SOAP requests must be sent to 2011
Amazon S3 using SSL.
Support for hosting Amazon S3 introduces enhanced support for hosting static February
static websites in websites. This includes support for index documents and 17, 2011
Amazon S3 custom error documents. When using these features, requests
to the root of your bucket or a subfolder (e.g., http://
mywebsite.com/subfolder) returns your index document
instead of the list of objects in your bucket. If an error is
encountered, Amazon S3 returns your custom error message
instead of an Amazon S3 error message. For API information
to configure your bucket as a website, see the following
sections:
Response Header API The GET Object REST API now allows you to change the January 14,
Support response headers of the REST GET Object request for 2011
each request. That is, you can alter object metadata in
the response, without altering the object itself. For more
information, see GET Object (p. 370).
Large Object Support Amazon S3 has increased the maximum size of an object December
you can store in an S3 bucket from 5 GB to 5 TB. If you are 9, 2010
using the REST API you can upload objects of up to 5 GB
size in a single PUT operation. For larger objects, you must
use the Multipart Upload REST API to upload objects in
parts. For conceptual information, go to Uploading Objects
Using Multipart Upload in the Amazon Simple Storage Service
Developer Guide. For multipart upload API information, see
Initiate Multipart Upload (p. 512), Upload Part (p. 528),
Complete Multipart Upload (p. 506), List Parts (p. 522), and
List Multipart Uploads (p. 243)
Multipart upload Multipart upload enables faster, more flexible uploads into November
Amazon S3. It allows you to upload a single object as a set of 10, 2010
parts. For conceptual information, go to Uploading Objects
Using Multipart Upload in the Amazon Simple Storage Service
Developer Guide. For multipart upload API information, see
Initiate Multipart Upload (p. 512), Upload Part (p. 528),
Complete Multipart Upload (p. 506), List Parts (p. 522), and
List Multipart Uploads (p. 243)
Notifications The Amazon S3 notifications feature enables you to configure July 14,
a bucket so that Amazon S3 publishes a message to an 2010
Amazon Simple Notification Service (SNS) topic when
Amazon S3 detects a key event on a bucket. For more
information, see GET Bucket notification (p. 190) and PUT
Bucket notification (p. 190).
Bucket policies Bucket policies is an access management system you use to July 6, 2010
set access permissions on buckets, objects, and sets of objects.
This functionality supplements and in many cases replaces
access control lists.
Reduced Redundancy Amazon S3 now enables you to reduce your storage costs by May 12,
storing objects in Amazon S3 with reduced redundancy. For 2010
more information, see PUT Object (p. 434).
New region supported Amazon S3 now supports the Asia Pacific (Singapore) region April 28,
and therefore new location constraints. For more information, 2010
see GET Bucket location (p. 178) and PUT Bucket (p. 252).
Object Versioning This release introduces object Versioning. All objects now February 8,
have a key and a version. If you enable versioning for a 2010
bucket, Amazon S3 gives all objects added to a bucket
a unique version ID. This feature enables you to recover
from unintended overwrites and deletions. For more
information, see GET Object (p. 370), DELETE Object (p. 364),
PUT Object (p. 434), PUT Object Copy (p. 451), or POST
Object (p. 407). The SOAP API does not support versioned
objects.
New region supported Amazon S3 now supports the US-West (Northern December
California) region. The new endpoint is s3-us- 2, 2009
west-1.amazonaws.com. For more information, see How
to Select a Region for Your Buckets in the Amazon Simple
Storage Service Developer Guide.
C# Library Support AWS now provides Amazon S3 C# libraries, sample code, November
tutorials, and other resources for software developers who 11, 2009
prefer to build applications using language-specific API
operations instead of REST or SOAP. These libraries provide
basic functions (not included in the REST or SOAP APIs), such
as request authentication, request retries, and error handling
so that it's easier to get started.
Technical documents The API reference has been split out of the Amazon S3 September
reorganized Developer Guide. Now, on the documentation landing page, 16, 2009
Amazon Simple Storage Service Documentation, you can
select the document you want to view. When viewing the
documents online, the links in one document will take you,
when appropriate, to one of the other guides.
Appendix
Topics
• Appendix: SOAP API (p. 565)
• Appendix: Lifecycle Configuration APIs (Deprecated) (p. 592)
This section describes the SOAP API with respect to service, bucket, and object operations. Note that
SOAP requests, both authenticated and anonymous, must be sent to Amazon S3 using SSL. Amazon S3
returns an error when you send a SOAP request over HTTP.
Topics
• Operations on the Service (SOAP API) (p. 565)
• Operations on Buckets (SOAP API) (p. 566)
• Operations on Objects (SOAP API) (p. 575)
• SOAP Error Responses (p. 590)
This section describes operations you can perform on the Amazon S3 service.
Topics
• ListAllMyBuckets (SOAP API) (p. 565)
The ListAllMyBuckets operation returns a list of all buckets owned by the sender of the request.
Example
Sample Request
<ListAllMyBuckets xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</ListAllMyBuckets>
Sample Response
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Owner>
<ID>bcaf1ffd86f41161ca5fb16fd081034f</ID>
<DisplayName>webfile</DisplayName>
</Owner>
<Buckets>
<Bucket>
<Name>quotes;/Name>
<CreationDate>2006-02-03T16:45:09.000Z</CreationDate>
</Bucket>
<Bucket>
<Name>samples</Name>
<CreationDate>2006-02-03T16:41:58.000Z</CreationDate>
</Bucket>
</Buckets>
</ListAllMyBucketsResult>
Response Body
• Owner:
This provides information that Amazon S3 uses to represent your identity for purposes of
authentication and access control. ID is a unique and permanent identifier for the developer who
made the request. DisplayName is a human-readable name representing the developer who made
the request. It is not unique, and might change over time.We recommend that you match your
DisplayName to your Forum name.
• Name:
The name of a bucket. Note that if one of your buckets was recently deleted, the name of the deleted
bucket might still be present in this list for a period of time.
• CreationDate:
Access Control
You must authenticate with a valid AWS Access Key ID. Anonymous requests are never allowed to list
buckets, and you can only list buckets for which you are the owner.
Topics
The CreateBucket operation creates a bucket. Not every string is an acceptable bucket name. For
information on bucket naming restrictions, see Working with Amazon S3 Buckets .
Note
To determine whether a bucket name exists, use ListBucket and set MaxKeys to 0. A
NoSuchBucket response indicates that the bucket is available, an AccessDenied response
indicates that someone else owns the bucket, and a Success response indicates that you own the
bucket or have permission to access it.
Sample Request
<CreateBucket xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</CreateBucket>
Sample Response
<CreateBucketResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<CreateBucketResponse>
<Bucket>quotes</Bucket>
</CreateBucketResponse>
</CreateBucketResponse>
Elements
• Bucket: The name of the bucket you are trying to create.
• AccessControlList: The access control list for the new bucket. This element is optional. If not
provided, the bucket is created with an access policy that give the requester FULL_CONTROL access.
Access Control
You must authenticate with a valid AWS Access Key ID. Anonymous requests are never allowed to create
buckets.
Related Resources
• ListBucket (SOAP API) (p. 568)
The DeleteBucket operation deletes a bucket. All objects in the bucket must be deleted before the
bucket itself can be deleted.
Example
This example deletes the "quotes" bucket.
Sample Request
<DeleteBucket xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<AWSAccessKeyId> AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</DeleteBucket>
Sample Response
<DeleteBucketResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<DeleteBucketResponse>
<Code>204</Code>
<Description>No Content</Description>
</DeleteBucketResponse>
</DeleteBucketResponse>
Elements
• Bucket: The name of the bucket you want to delete.
Access Control
Only the owner of a bucket is allowed to delete it, regardless the access control policy on the bucket.
The ListBucket operation returns information about some of the items in the bucket.
For a general introduction to the list operation, see the Listing Object Keys.
Requests
This example lists up to 1000 keys in the "quotes" bucket that have the prefix "notes."
Syntax
<ListBucket xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Prefix>notes/</Prefix>
<Delimiter>/</Delimiter>
<MaxKeys>1000</MaxKeys>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</ListBucket>
Parameters
prefix Limits the response to keys which begin with the indicated prefix. No
You can use prefixes to separate a bucket into different sets of keys
in a way similar to how a file system uses folders.
Type: String
Default: None
marker Indicates where in the bucket to begin listing. The list will only No
include keys that occur lexicographically after marker. This is
convenient for pagination: To get the next page of results use the
last key of the current page as the marker.
Type: String
Default: None
max-keys The maximum number of keys you'd like to see in the response No
body. The server might return fewer than this many keys, but will
not return more.
Type: String
Default: None
delimiter Causes keys that contain the same string between the prefix and No
the first occurrence of the delimiter to be rolled up into a single
result element in the CommonPrefixes collection. These rolled-up
keys are not returned elsewhere in the response.
Type: String
Default: None
Success Response
This response assumes the bucket contains the following keys:
notes/todos.txt
notes/2005-05-23/customer_mtg_notes.txt
notes/2005-05-23/phone_notes.txt
notes/2005-05-28/sales_notes.txt
Syntax
As you can see, many of the fields in the response echo the request parameters. IsTruncated,
Contents, and CommonPrefixes are the only response elements that can contain new information.
Response Elements
Name Description
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
Delimiter Causes keys that contain the same string between the prefix and the first
occurrence of the delimiter to be rolled up into a single result element in the
CommonPrefixes collection. These rolled-up keys are not returned elsewhere in
the response.
Name Description
Type: String
Ancestor: ListBucketResult
IsTruncated Specifies whether (true) or not (false) all of the results were returned. All of the
results may not be returned if the number of results exceeds that specified by
MaxKeys.
Type: String
Ancestor: boolean
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
Type: String
Ancestor: ListBucketResult
Response Body
For information about the list response, see Listing Keys Response.
Access Control
To list the keys of a bucket you need to have been granted READ access on the bucket.
The GetBucketAccessControlPolicy operation fetches the access control policy for a bucket.
Example
This example retrieves the access control policy for the "quotes" bucket.
Sample Request
<GetBucketAccessControlPolicy xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</GetBucketAccessControlPolicy>
Sample Response
<AccessControlPolicy>
<Owner>
<ID>a9a7b886d6fd2441bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xsi:type="CanonicalUser">
<ID>a9a7b886d6f41bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
<Grant>
<Grantee xsi:type="Group">
<URI>http://acs.amazonaws.com/groups/global/AllUsers<URI>
</Grantee>
<Permission>READ</Permission>
</Grant>
</AccessControlList>
<AccessControlPolicy>
Response Body
The response contains the access control policy for the bucket. For an explanation of this response, see
SOAP Access Policy .
Access Control
You must have READ_ACP rights to the bucket in order to retrieve the access control policy for a bucket.
The SetBucketAccessControlPolicy operation sets the Access Control Policy for an existing bucket.
If successful, the previous Access Control Policy for the bucket is entirely replaced with the specified
Access Control Policy.
Example
Give the specified user (usually the owner) FULL_CONTROL access to the "quotes" bucket.
Sample Request
<SetBucketAccessControlPolicy xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<AccessControlList>
<Grant>
<Grantee xsi:type="CanonicalUser">
<ID>a9a7b8863000e241bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</SetBucketAccessControlPolicy >
Sample Response
<GetBucketAccessControlPolicyResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<GetBucketAccessControlPolicyResponse>
<Code>200</Code>
<Description>OK</Description>
</GetBucketAccessControlPolicyResponse>
</GetBucketAccessControlPolicyResponse>
Access Control
You must have WRITE_ACP rights to the bucket in order to set the access control policy for a bucket.
Example
Sample Request
Sample Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" >
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<GetBucketLoggingStatusResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<GetBucketLoggingStatusResponse>
<LoggingEnabled>
<TargetBucket>mylogs</TargetBucket>
<TargetPrefix>mybucket-access_log-</TargetPrefix>
</LoggingEnabled>
</GetBucketLoggingStatusResponse>
</GetBucketLoggingStatusResponse>
</soapenv:Body>
</soapenv:Envelope>
Access Control
Only the owner of a bucket is permitted to invoke this operation.
The SetBucketLoggingStatus operation updates the logging status for an existing bucket.
Example
This sample request enables server access logging for the 'mybucket' bucket, and configures the logs to
be delivered to 'mylogs' under prefix 'access_log-'
Sample Request
Sample Response
Access Control
Only the owner of a bucket is permitted to invoke this operation.
Topics
• PutObjectInline (SOAP API) (p. 575)
• PutObject (SOAP API) (p. 577)
• CopyObject (SOAP API) (p. 579)
• GetObject (SOAP API) (p. 583)
• GetObjectExtended (SOAP API) (p. 587)
• DeleteObject (SOAP API) (p. 588)
• GetObjectAccessControlPolicy (SOAP API) (p. 589)
• SetObjectAccessControlPolicy (SOAP API) (p. 590)
The PutObjectInline operation adds an object to a bucket. The data for the object is provided in the
body of the SOAP message.
If an object already exists in a bucket, the new object will overwrite it because Amazon S3 stores the last
write request. However, Amazon S3 is a distributed system. If Amazon S3 receives multiple write requests
for the same object nearly simultaneously, all of the objects might be stored, even though only one wins
in the end. Amazon S3 does not provide object locking; if you need this, make sure to build it into your
application layer.
To ensure an object is not corrupted over the network, you can calculate the MD5 of an object, PUT it to
Amazon S3, and compare the returned Etag to the calculated MD5 value.
PutObjectInline is not suitable for use with large objects. The system limits this operation to working
with objects 1MB or smaller. PutObjectInline will fail with the InlineDataTooLargeError status code
if the Data parameter encodes an object larger than 1MB. To upload large objects, consider using the
non-inline PutObject API, or the REST API instead.
Example
This example writes some text and metadata into the "Nelson" object in the "quotes" bucket, give a user
(usually the owner) FULL_CONTROL access to the object, and make the object readable by anonymous
parties.
Sample Request
<PutObjectInline xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>family</Name>
<Value>Muntz</Value>
</Metadata>
<Data>aGEtaGE=</Data>
<ContentLength>5</ContentLength>
<AccessControlList>
<Grant>
<Grantee xsi:type="CanonicalUser">
<ID>a9a7b886d6fde241bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
<Grant>
<Grantee xsi:type="Group">
<URI>http://acs.amazonaws.com/groups/global/AllUsers</URI>
</Grantee>
<Permission>READ</Permission>
</Grant>
</AccessControlList>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</PutObjectInline>
Sample Response
<PutObjectInlineResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<PutObjectInlineResponse>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<LastModified>2006-01-01T12:00:00.000Z</lastModified>
</PutObjectInlineResponse>
</PutObjectInlineResponse>
Elements
• Bucket: The bucket in which to add the object.
• Key: The key to assign to the object.
• Metadata: You can provide name-value metadata pairs in the metadata element. These will be stored
with the object.
Responses
• ETag: The entity tag is an MD5 hash of the object that you can use to do conditional fetches of the
object using GetObjectExtended. The ETag only reflects changes to the contents of an object, not
its metadata.
• LastModified: The Amazon S3 timestamp for the saved object.
Access Control
You must have WRITE access to the bucket in order to put objects into the bucket.
Related Resources
• PutObject (SOAP API) (p. 577)
• CopyObject (SOAP API) (p. 579)
The PutObject operation adds an object to a bucket. The data for the object is attached as a DIME
attachment.
To ensure an object is not corrupted over the network, you can calculate the MD5 of an object, PUT it to
Amazon S3, and compare the returned Etag to the calculated MD5 value.
If an object already exists in a bucket, the new object will overwrite it because Amazon S3 stores the last
write request. However, Amazon S3 is a distributed system. If Amazon S3 receives multiple write requests
for the same object nearly simultaneously, all of the objects might be stored, even though only one wins
in the end. Amazon S3 does not provide object locking; if you need this, make sure to build it into your
application layer.
Example
This example puts some data and metadata in the "Nelson" object of the "quotes" bucket, give a user
(usually the owner) FULL_CONTROL access to the object, and make the object readable by anonymous
parties. In this sample, the actual attachment is not shown.
Sample Request
<PutObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>family</Name>
<Value>Muntz</Value>
</Metadata>
<ContentLength>5</ContentLength>
<AccessControlList>
<Grant>
<Grantee xsi:type="CanonicalUser">
<ID>a9a7b886d6241bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
<Grant>
<Grantee xsi:type="Group">
<URI>http://acs.amazonaws.com/groups/global/AllUsers<URI>
</Grantee>
<Permission>READ</Permission>
</Grant>
</AccessControlList>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2007-05-11T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</PutObject>
Sample Response
<PutObjectResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<PutObjectResponse>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<LastModified>2006-03-01T12:00:00.183Z</LastModified>
</PutObjectResponse>
</PutObjectResponse>
Elements
• Bucket: The bucket in which to add the object.
• Key: The key to assign to the object.
• Metadata: You can provide name-value metadata pairs in the metadata element. These will be stored
with the object.
• ContentLength: The length of the data in bytes.
• AccessControlList: An Access Control List for the resource. This element is optional. If omitted,
the requester is given FULL_CONTROL access to the object. If the object already exists, the preexisting
Access Control Policy is replaced.
Responses
• ETag: The entity tag is an MD5 hash of the object that you can use to do conditional fetches of the
object using GetObjectExtended. The ETag only reflects changes to the contents of an object, not
its metadata.
• LastModified: The Amazon S3 timestamp for the saved object.
Access Control
To put objects into a bucket, you must have WRITE access to the bucket.
Related Resources
• CopyObject (SOAP API) (p. 579)
Description
The CopyObject operation creates a copy of an object when you specify the key and bucket of a source
object and the key and bucket of a target destination.
When copying an object, you can preserve all metadata (default) or specify new metadata. However, the
ACL is not preserved and is set to private for the user making the request. To override the default ACL
setting, specify a new ACL when generating a copy request. For more information, see Using ACLs.
All copy requests must be authenticated. Additionally, you must have read access to the source object
and write access to the destination bucket. For more information, see Using Auth Access.
To only copy an object under certain conditions, such as whether the Etag matches or
whether the object was modified before or after a specified date, use the request parameters
CopySourceIfUnmodifiedSince, CopyIfUnmodifiedSince, CopySourceIfMatch, or
CopySourceIfNoneMatch.
Note
You might need to configure the SOAP stack socket timeout for copying large objects.
Request Syntax
<CopyObject xmlns="http://bucket_name.s3.amazonaws.com/2006-03-01">
<SourceBucket>source_bucket</SourceBucket>
<SourceObject>source_object</SourceObject>
<DestinationBucket>destination_bucket</DestinationBucket>
<DestinationObject>destination_object</DestinationObject>
<MetadataDirective>{REPLACE | COPY}</MetadataDirective>
<Metadata>
<Name>metadata_name</Name>
<Value>metadata_value</Value>
</Metadata>
...
<AccessControlList>
<Grant>
<Grantee xsi:type="user_type">
<ID>user_id</ID>
<DisplayName>display_name</DisplayName>
</Grantee>
<Permission>permission</Permission>
</Grant>
...
</AccessControlList>
<CopySourceIfMatch>etag</CopySourceIfMatch>
<CopySourceIfNoneMatch>etag</CopySourceIfNoneMatch>
<CopySourceIfModifiedSince>date_time</CopySourceIfModifiedSince>
<CopySourceIfUnmodifiedSince>date_time</CopySourceIfUnmodifiedSince>
<AWSAccessKeyId>AWSAccessKeyId</AWSAccessKeyId>
<Timestamp>TimeStamp</Timestamp>
<Signature>Signature</Signature>
</CopyObject>
Request Parameters
Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Type: String
Default: None
Type: String
Default: COPY
Default: None
Constraints: None.
Type: String
Default: None
Constraints: None
Type: String
Default: None
Type: String
Default: None
Constraints: None.
Type: dateTime
Default: None
Type: dateTime
Default: None
Response Syntax
<CopyObjectResponse xmlns="http://bucket_name.s3.amazonaws.com/2006-03-01">
<CopyObjectResponse>
<ETag>"etag"</ETag>
<LastModified>timestamp</LastModified>
</CopyObjectResponse>
</CopyObjectResponse>
Response Elements
Following is a list of response elements.
Note
The SOAP API does not return extra whitespace. Extra whitespace is only returned by the REST
API.
Name Description
Etag Returns the etag of the new object. The ETag only
reflects changes to the contents of an object, not its
metadata.
Type: String
Ancestor: CopyObjectResult
Type: String
Ancestor: CopyObjectResult
For information about general response elements, see Using REST Error Response Headers.
Special Errors
There are no special errors for this operation. For information about general Amazon S3 errors, see List
of Error Codes (p. 7).
Examples
This example copies the flotsam object from the pacific bucket to the jetsam object of the
atlantic bucket, preserving its metadata.
Sample Request
<CopyObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<SourceBucket>pacific</SourceBucket>
<SourceObject>flotsam</SourceObject>
<DestinationBucket>atlantic</DestinationBucket>
<DestinationObject>jetsam</DestinationObject>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2008-02-18T13:54:10.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbq7RrtSFmw=</Signature>
</CopyObject>
Sample Response
<CopyObjectResponse xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<CopyObjectResponse>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<LastModified>2008-02-18T13:54:10.183Z</LastModified>
</CopyObjectResponse>
</CopyObjectResponse>
This example copies the "tweedledee" object from the wonderland bucket to the "tweedledum" object of
the wonderland bucket, replacing its metadata.
Sample Request
<CopyObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<SourceBucket>wonderland</SourceBucket>
<SourceObject>tweedledee</SourceObject>
<DestinationBucket>wonderland</DestinationBucket>
<DestinationObject>tweedledum</DestinationObject>
<MetadataDirective >REPLACE</MetadataDirective >
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>relationship</Name>
<Value>twins</Value>
</Metadata>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2008-02-18T13:54:10.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbq7RrtSFmw=</Signature>
</CopyObject>
Sample Response
<CopyObjectResponse xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<CopyObjectResponse>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<LastModified>2008-02-18T13:54:10.183Z</LastModified>
</CopyObjectResponse>
</CopyObjectResponse>
Related Resources
• PutObject (SOAP API) (p. 577)
• PutObjectInline (SOAP API) (p. 575)
The GetObject operation returns the current version of an object. If you try to GetObject an object
that has a delete marker as its current version, S3 returns a 404 error. You cannot use the SOAP API
to retrieve a specified version of an object. To do that, use the REST API. For more information, see
Versioning. For more options, use the GetObjectExtended (SOAP API) (p. 587) operation.
Example
This example gets the "Nelson" object from the "quotes" bucket.
Sample Request
<GetObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<GetMetadata>true</GetMetadata>
<GetData>true</GetData>
<InlineData>true</InlineData>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</GetObject>
Sample Response
<GetObjectResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<GetObjectResponse>
<Status>
<Code>200</Code>
<Description>OK</Description>
</Status>
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>family</Name>
<Value>Muntz</Value>
</Metadata>
<Data>aGEtaGE=</Data>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
</GetObjectResponse>
</GetObjectResponse>
Elements
• Bucket: The bucket from which to retrieve the object.
• Key: The key that identifies the object.
• GetMetadata: The metadata is returned with the object if this is true.
• GetData: The object data is returned if this is true.
• InlineData: If this is true, then the data is returned, base 64-encoded, as part of the SOAP body of
the response. If false, then the data is returned as a SOAP attachment. The InlineData option is not
suitable for use with large objects. The system limits this operation to working with 1MB of data or
less. A GetObject request with the InlineData flag set will fail with the InlineDataTooLargeError
status code if the resulting Data parameter would have encoded more than 1MB. To download large
objects, consider calling GetObject without setting the InlineData flag, or use the REST API instead.
Returned Elements
• Metadata: The name-value paired metadata stored with the object.
• Data: If InlineData was true in the request, this contains the base 64 encoded object data.
• LastModified: The time that the object was stored in Amazon S3.
• ETag: The object's entity tag. This is a hash of the object that can be used to do conditional gets. The
ETag only reflects changes to the contents of an object, not its metadata.
Access Control
You can read an object only if you have been granted READ access to the object.
• For large object downloads, you might want to break them into smaller chunks. For more information,
see Range GETs (p. 585)
• For GET operations that fail, you can design your application to download the remainder instead of the
entire file. For more information, see REST GET Error Recovery (p. 587)
Range GETs
For some clients, you might want to break large downloads into smaller downloads. To break a GET into
smaller units, use Range.
Before you can break a GET into smaller units, you must determine its size. For example, the following
request gets the size of the bigfile object.
<ListBucket xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>bigbucket</Bucket>
<Prefix>bigfile</Prefix>
<MaxKeys>1</MaxKeys>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</ListBucket>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Name>quotes</Name>
<Prefix>N</Prefix>
<MaxKeys>1</MaxKeys>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>bigfile</Key>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<Size>2023276</Size>
<StorageClass>STANDARD</StorageClass>
<Owner>
<ID>bcaf1ffd86f41161ca5fb16fd081034f</ID>
<DisplayName>bigfile</DisplayName>
</Owner>
</Contents>
</ListBucketResult>
Following is a request that downloads the first megabyte from the bigfile object.
<GetObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>bigbucket</Bucket>
<Key>bigfile</Key>
<GetMetadata>true</GetMetadata>
<GetData>true</GetData>
<InlineData>true</InlineData>
<ByteRangeStart>0</ByteRangeStart>
<ByteRangeEnd>1048576</ByteRangeEnd>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</GetObject>
Amazon S3 returns the first megabyte of the file and the Etag of the file.
<GetObjectResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<GetObjectResponse>
<Status>
<Code>200</Code>
<Description>OK</Description>
</Status>
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>family</Name>
<Value>Muntz</Value>
</Metadata>
<Data>--first megabyte of bigfile--</Data>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
</GetObjectResponse>
</GetObjectResponse>
To ensure the file did not change since the previous portion was downloaded, specify the IfMatch
element. Although the IfMatch element is not required, it is recommended for content that is likely to
change.
The following is a request that gets the remainder of the file, using the IfMatch request header.
<GetObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>bigbucket</Bucket>
<Key>bigfile</Key>
<GetMetadata>true</GetMetadata>
<GetData>true</GetData>
<InlineData>true</InlineData>
<ByteRangeStart>10485761</ByteRangeStart>
<ByteRangeEnd>2023276</ByteRangeEnd>
<IfMatch>"828ef3fdfa96f00ad9f27c383fc9ac7f"</IfMatch>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</GetObject>
Amazon S3 returns the following response and the remainder of the file.
<GetObjectResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<GetObjectResponse>
<Status>
<Code>200</Code>
<Description>OK</Description>
</Status>
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>family</Name>
<Value>>Muntz</Value>
</Metadata>
<Data>--remainder of bigfile--</Data>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
</GetObjectResponse>
</GetObjectResponse>
Versioned GetObject
The following request returns the specified version of the object in the bucket.
<GetObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<GetMetadata>true</GetMetadata>
<GetData>true</GetData>
<InlineData>true</InlineData>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</GetObject>
Sample Response
<GetObjectResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<GetObjectResponse>
<Status>
<Code>200</Code>
<Description>OK</Description>
</Status>
<Metadata>
<Name>Content-Type</Name>
<Value>text/plain</Value>
</Metadata>
<Metadata>
<Name>family</Name>
<Value>Muntz</Value>
</Metadata>
<Data>aGEtaGE=</Data>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
</GetObjectResponse>
</GetObjectResponse>
Related Resources
Operations on Objects (SOAP API) (p. 575)
GetObjectExtended is exactly like GetObject (SOAP API) (p. 583), except that it supports the
following additional elements that can be used to accomplish much of the same functionality provided
by HTTP GET headers (go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
• ByteRangeStart, ByteRangeEnd: These elements specify that only a portion of the object data
should be retrieved. They follow the behavior of the HTTP byte ranges (go to http://www.w3.org/
Protocols/rfc2616/rfc2616-sec14.html#sec14.35).
• IfModifiedSince: Return the object only if the object's timestamp is later than the specified
timestamp. (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25)
• IfUnmodifiedSince: Return the object only if the object's timestamp is earlier than or equal to the
specified timestamp. (go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28)
• IfMatch: Return the object only if its ETag matches the supplied tag(s). (go to http://www.w3.org/
Protocols/rfc2616/rfc2616-sec14.html#sec14.24)
• IfNoneMatch: Return the object only if its ETag does not match the supplied tag(s). (go to http://
www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26)
• ReturnCompleteObjectOnConditionFailure:ReturnCompleteObjectOnConditionFailure: If
true, then if the request includes a range element and one or both of IfUnmodifiedSince/IfMatch
elements, and the condition fails, return the entire object rather than a fault. This enables the If-Range
functionality (go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.27).
The DeleteObject operation removes the specified object from Amazon S3. Once deleted, there is no
method to restore or undelete an object.
Note
If you delete an object that does not exist, Amazon S3 will return a success (not an error
message).
Example
This example deletes the "Nelson" object from the "quotes" bucket.
Sample Request
<DeleteObject xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<AWSAccessKeyId> AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</DeleteObject>
Sample Response
<DeleteObjectResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<DeleteObjectResponse>
<Code>200</Code>
<Description>OK</Description>
</DeleteObjectResponse>
</DeleteObjectResponse>
Elements
• Bucket: The bucket that holds the object.
Access Control
You can delete an object only if you have WRITE access to the bucket, regardless of who owns the object
or what rights are granted to it.
The GetObjectAccessControlPolicy operation fetches the access control policy for an object.
Example
This example retrieves the access control policy for the "Nelson" object from the "quotes" bucket.
Sample Request
<GetObjectAccessControlPolicy xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</GetObjectAccessControlPolicy>
Sample Response
<AccessControlPolicy>
<Owner>
<ID>a9a7b886d6fd24a541bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xsi:type="CanonicalUser">
<ID>a9a7b841bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
<Grant>
<Grantee xsi:type="Group">
<URI>http://acs.amazonaws.com/groups/global/AllUsers<URI>
</Grantee>
<Permission>READ</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Response Body
The response contains the access control policy for the bucket. For an explanation of this response, SOAP
Access Policy .
Access Control
You must have READ_ACP rights to the object in order to retrieve the access control policy for an object.
The SetObjectAccessControlPolicy operation sets the access control policy for an existing object.
If successful, the previous access control policy for the object is entirely replaced with the specified
access control policy.
Example
This example gives the specified user (usually the owner) FULL_CONTROL access to the "Nelson" object
from the "quotes" bucket.
Sample Request
<SetObjectAccessControlPolicy xmlns="http://doc.s3.amazonaws.com/2006-03-01">
<Bucket>quotes</Bucket>
<Key>Nelson</Key>
<AccessControlList>
<Grant>
<Grantee xsi:type="CanonicalUser">
<ID>a9a7b886d6fd24a52fe8ca5bef65f89a64e0193f23000e241bf9b1c61be666e9</ID>
<DisplayName>chriscustomer</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
<AWSAccessKeyId>AKIAIOSFODNN7EXAMPLE</AWSAccessKeyId>
<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>
<Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature>
</SetObjectAccessControlPolicy>
Sample Response
<SetObjectAccessControlPolicyResponse xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<SetObjectAccessControlPolicyResponse>
<Code>200</Code>
<Description>OK</Description>
</SetObjectAccessControlPolicyResponse>
</SetObjectAccessControlPolicyResponse>
Access Control
You must have WRITE_ACP rights to the object in order to set the access control policy for a bucket.
In SOAP, an error result is returned to the client as a SOAP fault, with the HTTP response code 500. If
you do not receive a SOAP fault, then your request was successful. The Amazon S3 SOAP fault code is
comprised of a standard SOAP 1.1 fault code (either "Server" or "Client") concatenated with the Amazon
S3-specific error code. For example: "Server.InternalError" or "Client.NoSuchBucket". The SOAP fault
string element contains a generic, human readable error message in English. Finally, the SOAP fault
detail element contains miscellaneous information relevant to the error.
For example, if you attempt to delete the object "Fred", which does not exist, the body of the SOAP
response contains a "NoSuchKey" SOAP fault.
<soapenv:Body>
<soapenv:Fault>
<Faultcode>soapenv:Client.NoSuchKey</Faultcode>
<Faultstring>The specified key does not exist.</Faultstring>
<Detail>
<Key>Fred</Key>
</Detail>
</soapenv:Fault>
</soapenv:Body>
Name Description
Type: Container
Ancestor: Body.Fault
Type: Container
Ancestor: Body
Faultcode The fault code is a string that uniquely identifies an error condition. It is meant to be
read and understood by programs that detect and handle errors by type. For more
information, see List of Error Codes (p. 7).
Type: String
Ancestor: Body.Fault
Faultstring The fault string contains a generic description of the error condition in English. It is
intended for a human audience. Simple programs display the message directly to
the end user if they encounter an error condition they don't know how or don't care
to handle. Sophisticated programs with more exhaustive error handling and proper
internationalization are more likely to ignore the fault string.
Type: String
Ancestor: Body.Fault
Type: String
Ancestor: Body.Fault
Topics
• PUT Bucket lifecycle (Deprecated) (p. 593)
• GET Bucket lifecycle (Deprecated) (p. 603)
Creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration. For
information about lifecycle configuration, see Object Lifecycle Management in the Amazon Simple
Storage Service Developer Guide.
Permissions
By default, all Amazon S3 resources, including buckets, objects, and related subresources (for
example, lifecycle configuration and website configuration) are private. Only the resource owner,
the AWS account that created the resource, can access it. The resource owner can optionally grant
access permissions to others by writing an access policy. For this operation, users must get the
s3:PutLifecycleConfiguration permission.
You can also explicitly deny permissions. Explicit denial also supersedes any other permissions. If you
want to prevent users or accounts from removing or deleting objects from your bucket, you must deny
them permissions for the following actions:
• s3:DeleteObject
• s3:DeleteObjectVersion
• s3:PutLifecycleConfiguration
For more information about permissions, see Managing Access Permissions to Your Amazon S3 Resources
in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /?lifecycle HTTP/1.1
Host: bucketname.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string
Content-MD5: MD5
For details about authorization strings, see Authenticating Requests (AWS Signature Version 4) (p. 14).
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
Type: String
Default: None
Request Body
In the request, you specify the lifecycle configuration in the request body. The lifecycle configuration
is specified as XML. The following is an example of a basic lifecycle configuration. It specifies one rule.
The Prefix in the rule identifies objects to which the rule applies. The rule also specifies two actions
(Transitionand Expiration). Each action specifies a timeline when Amazon S3 should perform the
action. The Status indicates whether the rule is enabled or disabled.
<LifecycleConfiguration>
<Rule>
<ID>sample-rule</ID>
<Prefix>key-prefix</Prefix>
<Status>rule-status</Status>
<Transition>
<Date>value</Date>
<StorageClass>storage class</StorageClass>
</Transition>
<Expiration>
<Days>value</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
If the state of your bucket is versioning-enabled or versioning-suspended, you can have many
versions of the same object: one current version and zero or more noncurrent versions. The
following lifecycle configuration specifies the actions (NoncurrentVersionTransition,
NoncurrentVersionExpiration) that are specific to noncurrent object versions.
<LifecycleConfiguration>
<Rule>
<ID>sample-rule</ID>
<Prefix>key-prefix</Prefix>
<Status>rule-status</Status>
<NoncurrentVersionTransition>
<NoncurrentDays>value</NoncurrentDays>
<StorageClass>storage class</StorageClass>
</NoncurrentVersionTransition>
<NoncurrentVersionExpiration>
<NoncurrentDays>value</NoncurrentDays>
</NoncurrentVersionExpiration>
</Rule>
</LifecycleConfiguration>
You can use the multipart upload API to upload large objects in parts. For more information about
multipart uploads, see Multipart Upload Overview in the Amazon Simple Storage Service Developer Guide.
With lifecycle configuration, you can tell Amazon S3 to abort incomplete multipart uploads, which are
identified by the key name prefix specified in the rule, if they don't complete within a specified number
of days. When Amazon S3 aborts a multipart upload, it deletes all parts associated with the upload. This
ensures that you don't have incomplete multipart uploads that have left parts stored in Amazon S3, so
you don't have to pay storage costs for them. The following is an example lifecycle configuration that
specifies a rule with the AbortIncompleteMultipartUpload action. This action tells Amazon S3 to
abort incomplete multipart uploads seven days after initiation.
<LifecycleConfiguration>
<Rule>
<ID>sample-rule</ID>
<Prefix>SomeKeyPrefix/</Prefix>
<Status>rule-status</Status>
<AbortIncompleteMultipartUpload>
<DaysAfterInitiation>7</DaysAfterInitiation>
</AbortIncompleteMultipartUpload>
</Rule>
</LifecycleConfiguration>
The following table describes the XML elements in the lifecycle configuration.
Type: Container
Ancestor: Rule
Type: String
Ancestor: AbortIncompleteMultipartUpload
Type: Container
Ancestor: Rule
Type: String
Ancestor: Rule
LifecycleConfiguration Container for lifecycle rules. You can add as many Yes
as 1000 rules.
Type: Container
Children: Rule
Ancestor: None
Type: String
Ancestor: Expiration
Ancestor: NoncurrentVersionExpiration or
NoncurrentVersionTransition
Type: Container
Children: NoncurrentDays
Ancestor: Rule
Type: Container
Ancestor: Rule
Type: String
Ancestor: Rule
Type: Container
Ancestor:LifecycleConfiguration
Type: String
Ancestor: Rule
Type: Container
Ancestor: Rule
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about
Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Add Lifecycle Configuration to a Bucket That Is Not Versioning-
enabled
The following lifecycle configuration specifies two rules, each with one action.
• The Transition action tells Amazon S3 to transition objects with the "documents/" prefix to the
GLACIER storage class 30 days after creation.
• The Expiration action tells Amazon S3 to delete objects with the "logs/" prefix 365 days after creation.
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Prefix>documents/</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>id2</ID>
<Prefix>logs/</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
The following is a sample PUT /?lifecycle request that adds the preceding lifecycle configuration to
the examplebucket bucket.
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Prefix>documents/</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>id2</ID>
<Prefix>logs/</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: r+qR7+nhXtJDDIJ0JJYcd+1j5nM/rUFiiiZ/fNbDOsd3JUE8NWMLNHXmvPfwMpdc
x-amz-request-id: 9E26D08072A8EF9E
Date: Wed, 14 May 2014 02:11:22 GMT
Content-Length: 0
Server: AmazonS3
<LifeCycleConfiguration>
<Rule>
<ID>DeleteAfterBecomingNonCurrent</ID>
<Prefix>logs/</Prefix>
<Status>Enabled</Status>
<NoncurrentVersionExpiration>
<NoncurrentDays>100</NoncurrentDays>
</NoncurrentVersionExpiration>
</Rule>
<Rule>
<ID>TransitionAfterBecomingNonCurrent</ID>
<Prefix>documents/</Prefix>
<Status>Enabled</Status>
<NoncurrentVersionTransition>
<NoncurrentDays>30</NoncurrentDays>
<StorageClass>GLACIER</StorageClass>
</NoncurrentVersionTransition>
</Rule>
</LifeCycleConfiguration>
The following is a sample PUT /?lifecycle request that adds the preceding lifecycle configuration to
the examplebucket bucket.
<LifeCycleConfiguration>
<Rule>
<ID>DeleteAfterBecomingNonCurrent</ID>
<Prefix>logs/</Prefix>
<Status>Enabled</Status>
<NoncurrentVersionExpiration>
<NoncurrentDays>1</NoncurrentDays>
</NoncurrentVersionExpiration>
</Rule>
<Rule>
<ID>TransitionSoonAfterBecomingNonCurrent</ID>
<Prefix>documents/</Prefix>
<Status>Enabled</Status>
<NoncurrentVersionTransition>
<NoncurrentDays>0</NoncurrentDays>
<StorageClass>GLACIER</StorageClass>
</NoncurrentVersionTransition>
</Rule>
</LifeCycleConfiguration>
HTTP/1.1 200 OK
x-amz-id-2: aXQ+KbIrmMmoO//3bMdDTw/CnjArwje+J49Hf+j44yRb/VmbIkgIO5A+PT98Cp/6k07hf+LD2mY=
x-amz-request-id: 02D7EC4C10381EB1
Date: Wed, 14 May 2014 02:21:50 GMT
Content-Length: 0
Server: AmazonS3
Additional Examples
For more examples of transitioning objects to storage classes such as STANDARD_IA or ONEZONE_IA, see
Examples of Lifecycle Configuration.
Related Resources
• GET Bucket lifecycle (p. 171)
• POST Object restore (p. 419)
• By default, a resource owner—in this case, a bucket owner, which is the AWS account that created the
bucket—can perform any of the operations. A resource owner can also grant others permission to
perform the operation. For more information, see the following topics in the Amazon Simple Storage
Service Developer Guide:
• Specifying Permissions in a Policy
• Managing Access Permissions to Your Amazon S3 Resources
Returns the lifecycle configuration information set on the bucket. For information about lifecycle
configuration, go to Object Lifecycle Management in the Amazon Simple Storage Service Developer Guide.
To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration
action. The bucket owner has this permission by default. The bucket owner can grant this permission to
others. For more information about permissions, see Managing Access Permissions to Your Amazon S3
Resources in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For
more information, see Common Request Headers (p. 2).
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses.
For more information, see Common Response Headers (p. 4).
Response Elements
This implementation of GET returns the following response elements.
Type: Container
Ancestor: Rule
Type: String
Ancestor: AbortIncompleteMultipartUpload
Type: Container
Ancestor: Rule
Type: String
Ancestor: Rule
LifecycleConfiguration Container for lifecycle rules. You can add as many Yes
as 1000 rules.
Type: Container
Children: Rule
Ancestor: None
Type: String
Ancestor: Expiration
Ancestor: NoncurrentVersionExpiration or
NoncurrentVersionTransition
Type: Container
Children: NoncurrentDays
Ancestor: Rule
Type: Container
Ancestor: Rule
Type: String
Ancestor: Rule
Type: Container
Ancestor: LifecycleConfiguration
Type: String
Ancestor: Rule
Type: String
Type: Container
Ancestor: Rule
Special Errors
For general information about Amazon S3 errors and a list of error codes, see Error Responses (p. 6).
Examples
Example 1: Retrieve a Lifecycle Subresource
This example is a GET request to retrieve the lifecycle subresource from the specified bucket, and an
example response with the returned lifecycle configuration.
Sample Request
Sample Response
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4RyTmXa3rPi4hklTXouTf0hccUjo0iCPjz6FnfIutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991C342C575321
Date: Thu, 15 Nov 2012 00:17:23 GMT
Server: AmazonS3
Content-Length: 358
Related Resources
• PUT Bucket lifecycle (p. 290)
• DELETE Bucket lifecycle (p. 114)
Glossary
100-continue A method that enables a client to see if a server can accept a request before
actually sending it. For large PUTs, this can save both time and bandwidth
charges.
bucket A container for objects stored in Amazon S3. Every object is contained within
a bucket. For example, if the object named photos/puppy.jpg is stored
in the johnsmith bucket, then it is addressable using the URL http://
johnsmith.s3.amazonaws.com/photos/puppy.jpg
canned access policy A standard access control policy that you can apply to a bucket or object. Valid
Values: private | public-read | public-read-write | aws-exec-
read | authenticated-read | bucket-owner-read | bucket-owner-
full-control
canonicalization The process of converting data into a standard format that will be recognized by a
service such as Amazon S3.
consistency model The method through which Amazon S3 achieves high availability, which involves
replicating data across multiple servers within Amazon's data centers. After a
"success" is returned, your data is safely stored. However, information about the
changes might not immediately replicate across Amazon S3.
key The unique identifier for an object within a bucket. Every object in a bucket has
exactly one key. Since a bucket and key together uniquely identify each object,
Amazon S3 can be thought of as a basic data map between "bucket + key" and
the object itself. Every object in Amazon S3 can be uniquely addressed through
the combination of the web service endpoint, bucket name, and key, as in http://
doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl, where "doc" is the name of
the bucket, and "2006-03-01/AmazonS3.wsdl" is the key.
metadata The metadata is a set of name-value pairs that describe the object. These include
default metadata such as the date last modified and standard HTTP metadata
such as Content-Type. The developer can also specify custom metadata at the
time the Object is stored.
object The fundamental entities stored in Amazon S3. Objects consist of object data and
metadata. The data portion is opaque to Amazon S3.
part The fundamental entities stored in Amazon S3. Objects consist of object data and
metadata. The data portion is opaque to Amazon S3.
service endpoint The host and port with which you are trying to communicate
within the destination URL. For virtual hosted-style requests, this
is mybucket.s3.amazonaws.com. For path-style requests, this is
s3.amazonaws.com
API Reference
This section contains the API Reference documentation.
Data Types
The following data types are supported by Amazon Simple Storage Service:
AbortIncompleteMultipartUpload
Service: Amazon Simple Storage Service
Specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before
permanently removing all parts of the upload. For more information, see Aborting Incomplete Multipart
Uploads Using a Bucket Lifecycle Policy in the Amazon Simple Storage Service Developer Guide.
Contents
DaysAfterInitiation
Specifies the number of days after which Amazon S3 aborts an incomplete multipart upload.
Type: Integer
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AccelerateConfiguration
Service: Amazon Simple Storage Service
Configures the transfer acceleration state for an Amazon S3 bucket. For more information, see Amazon
S3 Transfer Acceleration in the Amazon Simple Storage Service Developer Guide.
Contents
Status
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AccessControlPolicy
Service: Amazon Simple Storage Service
Contains the elements that set the ACL permissions for an object per grantee.
Contents
Grants
A list of grants.
Required: No
Owner
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AccessControlTranslation
Service: Amazon Simple Storage Service
Contents
Owner
Specifies the replica ownership. For default and valid values, see PUT bucket replication in the
Amazon Simple Storage Service API Reference.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AnalyticsAndOperator
Service: Amazon Simple Storage Service
A conjunction (logical AND) of predicates, which is used in evaluating a metrics filter. The operator must
have at least two predicates in any combination, and an object must match all of the predicates for the
filter to apply.
Contents
Prefix
The prefix to use when evaluating an AND predicate: The prefix that an object must have to be
included in the metrics results.
Type: String
Required: No
Tags
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AnalyticsConfiguration
Service: Amazon Simple Storage Service
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.
For more information, see GET Bucket analytics in the Amazon Simple Storage Service API Reference.
Contents
Filter
The filter used to describe a set of objects for analyses. A filter must have exactly one prefix, one tag,
or one conjunction (AnalyticsAndOperator). If no filter is provided, all objects will be considered in
any analysis.
Required: No
Id
Type: String
Required: Yes
StorageClassAnalysis
Contains data related to access patterns to be collected and made available to analyze the tradeoffs
between different storage classes.
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AnalyticsExportDestination
Service: Amazon Simple Storage Service
Contents
S3BucketDestination
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AnalyticsFilter
Service: Amazon Simple Storage Service
Contents
And
A conjunction (logical AND) of predicates, which is used in evaluating an analytics filter. The operator
must have at least two predicates.
Required: No
Prefix
Type: String
Required: No
Tag
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AnalyticsS3BucketDestination
Service: Amazon Simple Storage Service
Contents
Bucket
The Amazon Resource Name (ARN) of the bucket to which data is exported.
Type: String
Required: Yes
BucketAccountId
The account ID that owns the destination bucket. If no account ID is provided, the owner will not be
validated prior to exporting data.
Type: String
Required: No
Format
Specifies the file format used when exporting data to Amazon S3.
Type: String
Required: Yes
Prefix
The prefix to use when exporting data. The prefix is prepended to all results.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Bucket
Service: Amazon Simple Storage Service
Contents
CreationDate
Type: Timestamp
Required: No
Name
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
BucketLifecycleConfiguration
Service: Amazon Simple Storage Service
Specifies the lifecycle configuration for objects in an Amazon S3 bucket. For more information, see
Object Lifecycle Management in the Amazon Simple Storage Service Developer Guide.
Contents
Rules
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
BucketLoggingStatus
Service: Amazon Simple Storage Service
Contents
LoggingEnabled
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CloudFunctionConfiguration
Service: Amazon Simple Storage Service
Contents
CloudFunction
Type: String
Required: No
Event
Type: String
Required: No
Events
Required: No
Id
An optional unique identifier for configurations in a notification configuration. If you don't provide
one, Amazon S3 will assign an ID.
Type: String
Required: No
InvocationRole
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CommonPrefix
Service: Amazon Simple Storage Service
Contents
Prefix
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CompletedMultipartUpload
Service: Amazon Simple Storage Service
Contents
Parts
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CompletedPart
Service: Amazon Simple Storage Service
Contents
ETag
Type: String
Required: No
PartNumber
Part number that identifies the part. This is a positive integer between 1 and 10,000.
Type: Integer
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Condition
Service: Amazon Simple Storage Service
Contents
HttpErrorCodeReturnedEquals
The HTTP error code when the redirect is applied. In the event of an error, if the error code equals
this value, then the specified redirect is applied. Required when parent element Condition is
specified and sibling KeyPrefixEquals is not specified. If both are specified, then both must be
true for the redirect to be applied.
Type: String
Required: No
KeyPrefixEquals
The object key name prefix when the redirect is applied. For example, to redirect requests
for ExamplePage.html, the key prefix will be ExamplePage.html. To redirect request
for all pages with the prefix docs/, the key prefix will be /docs, which identifies all objects
in the docs/ folder. Required when the parent element Condition is specified and sibling
HttpErrorCodeReturnedEquals is not specified. If both conditions are specified, both must be
true for the redirect to be applied.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ContinuationEvent
Service: Amazon Simple Storage Service
Contents
The members of this structure are context-dependent.
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CopyObjectResult
Service: Amazon Simple Storage Service
Contents
ETag
Type: String
Required: No
LastModified
Type: Timestamp
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CopyPartResult
Service: Amazon Simple Storage Service
Contents
ETag
Type: String
Required: No
LastModified
Type: Timestamp
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CORSConfiguration
Service: Amazon Simple Storage Service
Describes the cross-origin access configuration for objects in an Amazon S3 bucket. For more
information, see Enabling Cross-Origin Resource Sharing in the Amazon Simple Storage Service Developer
Guide.
Contents
CORSRules
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CORSRule
Service: Amazon Simple Storage Service
Contents
AllowedHeaders
Headers that are specified in the Access-Control-Request-Headers header. These headers are
allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, Amazon S3
returns any requested headers that are allowed.
Required: No
AllowedMethods
An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, and
DELETE.
Required: Yes
AllowedOrigins
One or more origins you want customers to be able to access the bucket from.
Required: Yes
ExposeHeaders
One or more headers in the response that you want customers to be able to access from their
applications (for example, from a JavaScript XMLHttpRequest object).
Required: No
MaxAgeSeconds
The time in seconds that your browser is to cache the preflight response for the specified resource.
Type: Integer
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CreateBucketConfiguration
Service: Amazon Simple Storage Service
Contents
LocationConstraint
Specifies the region where the bucket will be created. If you don't specify a region, the bucket is
created in US East (N. Virginia) Region (us-east-1).
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CSVInput
Service: Amazon Simple Storage Service
Contents
AllowQuotedRecordDelimiter
Specifies that CSV field values may contain quoted record delimiters and such records should be
allowed. Default value is FALSE. Setting this value to TRUE may lower performance.
Type: Boolean
Required: No
Comments
The single character used to indicate a row should be ignored when present at the start of a row.
Type: String
Required: No
FieldDelimiter
Type: String
Required: No
FileHeaderInfo
Describes the first line of input. Valid values: None, Ignore, Use.
Type: String
Required: No
QuoteCharacter
Value used for escaping where the field delimiter is part of the value.
Type: String
Required: No
QuoteEscapeCharacter
The single character used for escaping the quote character inside an already escaped value.
Type: String
Required: No
RecordDelimiter
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
CSVOutput
Service: Amazon Simple Storage Service
Contents
FieldDelimiter
Type: String
Required: No
QuoteCharacter
The value used for escaping where the field delimiter is part of the value.
Type: String
Required: No
QuoteEscapeCharacter
Th single character used for escaping the quote character inside an already escaped value.
Type: String
Required: No
QuoteFields
Type: String
Required: No
RecordDelimiter
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
DefaultRetention
Service: Amazon Simple Storage Service
The container element for specifying the default object lock retention settings for new objects placed in
the specified bucket.
Contents
Days
The number of days that you want to specify for the default retention period.
Type: Integer
Required: No
Mode
The default object lock retention mode you want to apply to new objects placed in the specified
bucket.
Type: String
Required: No
Years
The number of years that you want to specify for the default retention period.
Type: Integer
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Delete
Service: Amazon Simple Storage Service
Contents
Objects
Required: Yes
Quiet
Element to enable quiet mode for the request. When you add this element, you must set its value to
true.
Type: Boolean
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
DeletedObject
Service: Amazon Simple Storage Service
Contents
DeleteMarker
Type: Boolean
Required: No
DeleteMarkerVersionId
Type: String
Required: No
Key
Type: String
Required: No
VersionId
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
DeleteMarkerEntry
Service: Amazon Simple Storage Service
Contents
IsLatest
Specifies whether the object is (true) or is not (false) the latest version of an object.
Type: Boolean
Required: No
Key
Type: String
Required: No
LastModified
Type: Timestamp
Required: No
Owner
Required: No
VersionId
Version ID of an object.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
DeleteMarkerReplication
Service: Amazon Simple Storage Service
Contents
Status
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Destination
Service: Amazon Simple Storage Service
Specifies information about where to publish analysis or configuration results for an Amazon S3 bucket.
Contents
AccessControlTranslation
Specify this only in a cross-account scenario (where source and destination bucket owners are not
the same), and you want to change replica ownership to the AWS account that owns the destination
bucket. If this is not specified in the replication configuration, the replicas are owned by same AWS
account that owns the source object.
Required: No
Account
Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to
change replica ownership to the AWS account that owns the destination bucket by specifying the
AccessControlTranslation property, this is the account ID of the destination bucket owner. For
more information, see Cross-Region Replication Additional Configuration: Change Replica Owner in
the Amazon Simple Storage Service Developer Guide.
Type: String
Required: No
Bucket
The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store replicas of the
object identified by the rule.
A replication configuration can replicate objects to only one destination bucket. If there are multiple
rules in your replication configuration, all rules must specify the same destination bucket.
Type: String
Required: Yes
EncryptionConfiguration
Required: No
StorageClass
The storage class to use when replicating objects, such as standard or reduced redundancy. By
default, Amazon S3 uses the storage class of the source object to create the object replica.
For valid values, see the StorageClass element of the PUT Bucket replication action in the Amazon
Simple Storage Service API Reference.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Encryption
Service: Amazon Simple Storage Service
Describes the server-side encryption that will be applied to the restore results.
Contents
EncryptionType
The server-side encryption algorithm used when storing job results in Amazon S3 (e.g., AES256,
aws:kms).
Type: String
Required: Yes
KMSContext
If the encryption type is aws:kms, this optional value can be used to specify the encryption context
for the restore results.
Type: String
Required: No
KMSKeyId
If the encryption type is aws:kms, this optional value specifies the AWS KMS key ID to use for
encryption of job results.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
EncryptionConfiguration
Service: Amazon Simple Storage Service
Specifies encryption-related information for an Amazon S3 bucket that is a destination for replicated
objects.
Contents
ReplicaKmsKeyID
Specifies the AWS KMS Key ID (Key ARN or Alias ARN) for the destination bucket. Amazon S3 uses
this key to encrypt replica objects.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
EndEvent
Service: Amazon Simple Storage Service
Contents
The members of this structure are context-dependent.
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Error
Service: Amazon Simple Storage Service
Contents
Code
Type: String
Required: No
Key
Type: String
Required: No
Message
Type: String
Required: No
VersionId
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ErrorDocument
Service: Amazon Simple Storage Service
Contents
Key
The object key name to use when a 4XX class error occurs.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
FilterRule
Service: Amazon Simple Storage Service
Specifies the Amazon S3 object key name to filter on and whether to filter on the suffix or prefix of the
key name.
Contents
Name
The object key name prefix or suffix identifying one or more objects to which the filtering rule
applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not
supported. For more information, see Configuring Event Notifications in the Amazon Simple Storage
Service Developer Guide.
Type: String
Required: No
Value
The value that the filter searches for in object key names.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
GlacierJobParameters
Service: Amazon Simple Storage Service
Contents
Tier
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Grant
Service: Amazon Simple Storage Service
Contents
Grantee
Required: No
Permission
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Grantee
Service: Amazon Simple Storage Service
Contents
DisplayName
Type: String
Required: No
EmailAddress
Type: String
Required: No
ID
Type: String
Required: No
Type
Type of grantee
Type: String
Required: Yes
URI
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
IndexDocument
Service: Amazon Simple Storage Service
Contents
Suffix
A suffix that is appended to a request that is for a directory on the website endpoint (e.g. if the suffix
is index.html and you make a request to samplebucket/images/ the data that is returned will be
for the object with the key name images/index.html) The suffix must not be empty and must not
include a slash character.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Initiator
Service: Amazon Simple Storage Service
Contents
DisplayName
Type: String
Required: No
ID
If the principal is an AWS account, it provides the Canonical User ID. If the principal is an IAM User, it
provides a user ARN value.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InputSerialization
Service: Amazon Simple Storage Service
Contents
CompressionType
Specifies object's compression format. Valid values: NONE, GZIP, BZIP2. Default Value: NONE.
Type: String
Required: No
CSV
Required: No
JSON
Required: No
Parquet
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InventoryConfiguration
Service: Amazon Simple Storage Service
Specifies the inventory configuration for an Amazon S3 bucket. For more information, see GET Bucket
inventory in the Amazon Simple Storage Service API Reference.
Contents
Destination
Required: Yes
Filter
Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria.
Required: No
Id
Type: String
Required: Yes
IncludedObjectVersions
Object versions to include in the inventory list. If set to All, the list includes all the object versions,
which adds the version-related fields VersionId, IsLatest, and DeleteMarker to the list. If set
to Current, the list does not contain these version-related fields.
Type: String
Required: Yes
IsEnabled
Specifies whether the inventory is enabled or disabled. If set to True, an inventory list is generated.
If set to False, no inventory list is generated.
Type: Boolean
Required: Yes
OptionalFields
Contains the optional fields that are included in the inventory results.
Required: No
Schedule
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InventoryDestination
Service: Amazon Simple Storage Service
Contents
S3BucketDestination
Contains the bucket name, file format, bucket owner (optional), and prefix (optional) where
inventory results are published.
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InventoryEncryption
Service: Amazon Simple Storage Service
Contains the type of server-side encryption used to encrypt the inventory results.
Contents
SSEKMS
Required: No
SSES3
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InventoryFilter
Service: Amazon Simple Storage Service
Contents
Prefix
The prefix that an object must have to be included in the inventory results.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InventoryS3BucketDestination
Service: Amazon Simple Storage Service
Contents
AccountId
Type: String
Required: No
Bucket
The Amazon resource name (ARN) of the bucket where inventory results will be published.
Type: String
Required: Yes
Encryption
Contains the type of server-side encryption used to encrypt the inventory results.
Required: No
Format
Type: String
Required: Yes
Prefix
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
InventorySchedule
Service: Amazon Simple Storage Service
Contents
Frequency
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JSONInput
Service: Amazon Simple Storage Service
Contents
Type
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JSONOutput
Service: Amazon Simple Storage Service
Contents
RecordDelimiter
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LambdaFunctionConfiguration
Service: Amazon Simple Storage Service
Contents
Events
The Amazon S3 bucket event for which to invoke the AWS Lambda function. For more information,
see Supported Event Types in the Amazon Simple Storage Service Developer Guide.
Required: Yes
Filter
Required: No
Id
An optional unique identifier for configurations in a notification configuration. If you don't provide
one, Amazon S3 will assign an ID.
Type: String
Required: No
LambdaFunctionArn
The Amazon Resource Name (ARN) of the AWS Lambda function that Amazon S3 invokes when the
specified event type occurs.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LifecycleConfiguration
Service: Amazon Simple Storage Service
Contents
Rules
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LifecycleExpiration
Service: Amazon Simple Storage Service
Contents
Date
Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.
Type: Timestamp
Required: No
Days
Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-
zero positive integer.
Type: Integer
Required: No
ExpiredObjectDeleteMarker
Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true,
the delete marker will be expired; if set to false the policy takes no action. This cannot be specified
with Days or Date in a Lifecycle Expiration Policy.
Type: Boolean
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LifecycleRule
Service: Amazon Simple Storage Service
Contents
AbortIncompleteMultipartUpload
Required: No
Expiration
Required: No
Filter
Required: No
ID
Unique identifier for the rule. The value cannot be longer than 255 characters.
Type: String
Required: No
NoncurrentVersionExpiration
Required: No
NoncurrentVersionTransitions
Required: No
Prefix
Prefix identifying one or more objects to which the rule applies. This is No longer used; use Filter
instead.
Type: String
Required: No
Status
If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied.
Type: String
Required: Yes
Transitions
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LifecycleRuleAndOperator
Service: Amazon Simple Storage Service
This is used in a Lifecycle Rule Filter to apply a logical AND to two or more predicates. The Lifecycle Rule
will apply to any object matching all of the predicates configured inside the And operator.
Contents
Prefix
Type: String
Required: No
Tags
All of these tags must exist in the object's tag set in order for the rule to apply.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LifecycleRuleFilter
Service: Amazon Simple Storage Service
The Filter is used to identify objects that a Lifecycle Rule applies to. A Filter must have exactly one of
Prefix, Tag, or And specified.
Contents
And
Required: No
Prefix
Type: String
Required: No
Tag
This tag must exist in the object's tag set in order for the rule to apply.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LoggingEnabled
Service: Amazon Simple Storage Service
Describes where logs are stored and the prefix that Amazon S3 assigns to all log object keys for a bucket.
For more information, see PUT Bucket logging in the Amazon Simple Storage Service API Reference.
Contents
TargetBucket
Specifies the bucket where you want Amazon S3 to store server access logs. You can have your
logs delivered to any bucket that you own, including the same bucket that is being logged. You
can also configure multiple buckets to deliver their logs to the same target bucket. In this case you
should choose a different TargetPrefix for each source bucket so that the delivered log files can be
distinguished by key.
Type: String
Required: Yes
TargetGrants
Required: No
TargetPrefix
A prefix for all log object keys. If you store log files from multiple Amazon S3 buckets in a single
bucket, you can use a prefix to distinguish which log files came from which bucket.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
MetadataEntry
Service: Amazon Simple Storage Service
Contents
Name
Type: String
Required: No
Value
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
MetricsAndOperator
Service: Amazon Simple Storage Service
Contents
Prefix
Type: String
Required: No
Tags
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
MetricsConfiguration
Service: Amazon Simple Storage Service
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics
configuration ID) from an Amazon S3 bucket. If you're updating an existing metrics configuration, note
that this is a full replacement of the existing metrics configuration. If you don't include the elements
you want to keep, they are erased. For more information, see PUT Bucket metrics in the Amazon Simple
Storage Service API Reference.
Contents
Filter
Specifies a metrics configuration filter. The metrics configuration will only include objects that meet
the filter's criteria. A filter must be a prefix, a tag, or a conjunction (MetricsAndOperator).
Required: No
Id
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
MetricsFilter
Service: Amazon Simple Storage Service
Contents
And
A conjunction (logical AND) of predicates, which is used in evaluating a metrics filter. The operator
must have at least two predicates, and an object must match all of the predicates in order for the
filter to apply.
Required: No
Prefix
Type: String
Required: No
Tag
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
MultipartUpload
Service: Amazon Simple Storage Service
Contents
Initiated
Type: Timestamp
Required: No
Initiator
Required: No
Key
Key of the object for which the multipart upload was initiated.
Type: String
Required: No
Owner
Required: No
StorageClass
Type: String
Required: No
UploadId
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
NoncurrentVersionExpiration
Service: Amazon Simple Storage Service
Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 permanently deletes the
noncurrent object versions. You set this lifecycle configuration action on a bucket that has versioning
enabled (or suspended) to request that Amazon S3 delete noncurrent object versions at a specific period
in the object's lifetime.
Contents
NoncurrentDays
Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated
action. For information about the noncurrent days calculations, see How Amazon S3 Calculates
When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide.
Type: Integer
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
NoncurrentVersionTransition
Service: Amazon Simple Storage Service
Container for the transition rule that describes when noncurrent objects transition to the STANDARD_IA,
ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, or DEEP_ARCHIVE storage class. If your bucket is
versioning-enabled (or versioning is suspended), you can set this action to request that Amazon S3
transition noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING,
GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's lifetime.
Contents
NoncurrentDays
Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated
action. For information about the noncurrent days calculations, see How Amazon S3 Calculates
When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide.
Type: Integer
Required: No
StorageClass
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
NotificationConfiguration
Service: Amazon Simple Storage Service
A container for specifying the notification configuration of the bucket. If this element is empty,
notifications are turned off for the bucket.
Contents
LambdaFunctionConfigurations
Describes the AWS Lambda functions to invoke and the events for which to invoke them.
Required: No
QueueConfigurations
The Amazon Simple Queue Service queues to publish messages to and the events for which to
publish messages.
Required: No
TopicConfigurations
The topic to which notifications are sent and the events for which notifications are generated.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
NotificationConfigurationDeprecated
Service: Amazon Simple Storage Service
Contents
CloudFunctionConfiguration
Required: No
QueueConfiguration
Required: No
TopicConfiguration
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
NotificationConfigurationFilter
Service: Amazon Simple Storage Service
Specifies object key name filtering rules. For information about key name filtering, see Configuring Event
Notifications in the Amazon Simple Storage Service Developer Guide.
Contents
Key
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Object
Service: Amazon Simple Storage Service
Contents
ETag
Type: String
Required: No
Key
Type: String
Required: No
LastModified
Type: Timestamp
Required: No
Owner
Required: No
Size
Type: Integer
Required: No
StorageClass
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ObjectIdentifier
Service: Amazon Simple Storage Service
Contents
Key
Type: String
Required: Yes
VersionId
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ObjectLockConfiguration
Service: Amazon Simple Storage Service
Contents
ObjectLockEnabled
Type: String
Required: No
Rule
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ObjectLockLegalHold
Service: Amazon Simple Storage Service
Contents
Status
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ObjectLockRetention
Service: Amazon Simple Storage Service
Contents
Mode
Type: String
Required: No
RetainUntilDate
Type: Timestamp
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ObjectLockRule
Service: Amazon Simple Storage Service
Contents
DefaultRetention
The default retention period that you want to apply to new objects placed in the specified bucket.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ObjectVersion
Service: Amazon Simple Storage Service
Contents
ETag
Type: String
Required: No
IsLatest
Specifies whether the object is (true) or is not (false) the latest version of an object.
Type: Boolean
Required: No
Key
Type: String
Required: No
LastModified
Type: Timestamp
Required: No
Owner
Required: No
Size
Type: Integer
Required: No
StorageClass
Type: String
Required: No
VersionId
Version ID of an object.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
OutputLocation
Service: Amazon Simple Storage Service
Contents
S3
Describes an S3 location that will receive the results of the restore request.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
OutputSerialization
Service: Amazon Simple Storage Service
Contents
CSV
Required: No
JSON
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Owner
Service: Amazon Simple Storage Service
Contents
DisplayName
Type: String
Required: No
ID
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ParquetInput
Service: Amazon Simple Storage Service
Contents
The members of this structure are context-dependent.
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Part
Service: Amazon Simple Storage Service
Contents
ETag
Type: String
Required: No
LastModified
Type: Timestamp
Required: No
PartNumber
Part number identifying the part. This is a positive integer between 1 and 10,000.
Type: Integer
Required: No
Size
Type: Integer
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
PolicyStatus
Service: Amazon Simple Storage Service
Contents
IsPublic
The policy status for this bucket. TRUE indicates that this bucket is public. FALSE indicates that the
bucket is not public.
Type: Boolean
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Progress
Service: Amazon Simple Storage Service
Contents
BytesProcessed
Type: Long
Required: No
BytesReturned
Type: Long
Required: No
BytesScanned
Type: Long
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ProgressEvent
Service: Amazon Simple Storage Service
Contents
Details
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
PublicAccessBlockConfiguration
Service: Amazon Simple Storage Service
Contents
BlockPublicAcls
Specifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and
objects in this bucket. Setting this element to TRUE causes the following behavior:
• PUT Bucket acl and PUT Object acl calls fail if the specified ACL is public.
• PUT Object calls fail if the request includes a public ACL.
Type: Boolean
Required: No
BlockPublicPolicy
Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this
element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy
allows public access.
Type: Boolean
Required: No
IgnorePublicAcls
Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket.
Setting this element to TRUE causes Amazon S3 to ignore all public ACLs on this bucket and objects
in this bucket.
Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new
public ACLs from being set.
Type: Boolean
Required: No
RestrictPublicBuckets
Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this
element to TRUE restricts access to this bucket to only AWS services and authorized users within this
account if the bucket has a public policy.
Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-
account access within any public bucket policy, including non-public delegation to specific accounts,
is blocked.
Type: Boolean
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
QueueConfiguration
Service: Amazon Simple Storage Service
Specifies the configuration for publishing messages to an Amazon Simple Queue Service (Amazon SQS)
queue when Amazon S3 detects specified events.
Contents
Events
Required: Yes
Filter
Required: No
Id
An optional unique identifier for configurations in a notification configuration. If you don't provide
one, Amazon S3 will assign an ID.
Type: String
Required: No
QueueArn
The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 publishes a
message when it detects events of the specified type.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
QueueConfigurationDeprecated
Service: Amazon Simple Storage Service
Contents
Event
Type: String
Required: No
Events
Required: No
Id
An optional unique identifier for configurations in a notification configuration. If you don't provide
one, Amazon S3 will assign an ID.
Type: String
Required: No
Queue
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RecordsEvent
Service: Amazon Simple Storage Service
Contents
Payload
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Redirect
Service: Amazon Simple Storage Service
Specifies how requests are redirected. In the event of an error, you can specify a different error code to
return.
Contents
HostName
Type: String
Required: No
HttpRedirectCode
The HTTP redirect code to use on the response. Not required if one of the siblings is present.
Type: String
Required: No
Protocol
Protocol to use when redirecting requests. The default is the protocol that is used in the original
request.
Type: String
Required: No
ReplaceKeyPrefixWith
The object key prefix to use in the redirect request. For example, to redirect requests for all pages
with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block
with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /
documents. Not required if one of the siblings is present. Can be present only if ReplaceKeyWith
is not provided.
Type: String
Required: No
ReplaceKeyWith
The specific object key to use in the redirect request. For example, redirect request to error.html.
Not required if one of the siblings is present. Can be present only if ReplaceKeyPrefixWith is not
provided.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RedirectAllRequestsTo
Service: Amazon Simple Storage Service
Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.
Contents
HostName
Type: String
Required: Yes
Protocol
Protocol to use when redirecting requests. The default is the protocol that is used in the original
request.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ReplicationConfiguration
Service: Amazon Simple Storage Service
A container for replication rules. You can add up to 1,000 rules. The maximum size of a replication
configuration is 2 MB.
Contents
Role
The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that
Amazon S3 assumes when replicating objects. For more information, see How to Set Up Cross-
Region Replication in the Amazon Simple Storage Service Developer Guide.
Type: String
Required: Yes
Rules
A container for one or more replication rules. A replication configuration must have at least one rule
and can contain a maximum of 1,000 rules.
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ReplicationRule
Service: Amazon Simple Storage Service
Specifies which Amazon S3 objects to replicate and where to store the replicas.
Contents
DeleteMarkerReplication
Required: No
Destination
Required: Yes
Filter
Required: No
ID
A unique identifier for the rule. The maximum value is 255 characters.
Type: String
Required: No
Prefix
An object keyname prefix that identifies the object or objects to which the rule applies. The
maximum prefix length is 1,024 characters. To include all objects in a bucket, specify an empty
string.
Type: String
Required: No
Priority
The priority associated with the rule. If you specify multiple rules in a replication configuration,
Amazon S3 prioritizes the rules to prevent conflicts when filtering. If two or more rules identify the
same object based on a specified filter, the rule with higher priority takes precedence. For example:
• Same object quality prefix based filter criteria If prefixes you specified in multiple rules overlap
• Same object qualify tag based filter criteria specified in multiple rules
For more information, see Cross-Region Replication (CRR) in the Amazon S3 Developer Guide.
Type: Integer
Required: No
SourceSelectionCriteria
A container that describes additional filters for identifying the source objects that you want to
replicate. You can choose to enable or disable the replication of these objects. Currently, Amazon S3
supports only the filter that you can specify for objects created with server-side encryption using an
AWS KMS-Managed Key (SSE-KMS).
Required: No
Status
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ReplicationRuleAndOperator
Service: Amazon Simple Storage Service
Contents
Prefix
Type: String
Required: No
Tags
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ReplicationRuleFilter
Service: Amazon Simple Storage Service
A filter that identifies the subset of objects to which the replication rule applies. A Filter must specify
exactly one Prefix, Tag, or an And child element.
Contents
And
A container for specifying rule filters. The filters determine the subset of objects to which the rule
applies. This element is required only if you specify more than one filter. For example:
• If you specify both a Prefix and a Tag filter, wrap these filters in an And tag.
• If you specify a filter based on multiple tags, wrap the Tag elements in an And tag.
Required: No
Prefix
An object keyname prefix that identifies the subset of objects to which the rule applies.
Type: String
Required: No
Tag
The rule applies only to objects that have the tag in their tag set.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RequestPaymentConfiguration
Service: Amazon Simple Storage Service
Contents
Payer
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RequestProgress
Service: Amazon Simple Storage Service
Contents
Enabled
Specifies whether periodic QueryProgress frames should be sent. Valid values: TRUE, FALSE. Default
value: FALSE.
Type: Boolean
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RestoreRequest
Service: Amazon Simple Storage Service
Contents
Days
Lifetime of the active copy in days. Do not use with restores that specify OutputLocation.
Type: Integer
Required: No
Description
Type: String
Required: No
GlacierJobParameters
Glacier related parameters pertaining to this job. Do not use with restores that specify
OutputLocation.
Required: No
OutputLocation
Required: No
SelectParameters
Required: No
Tier
Type: String
Required: No
Type
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RoutingRule
Service: Amazon Simple Storage Service
Contents
Condition
A container for describing a condition that must be met for the specified redirect to apply. For
example, 1. If request is for pages in the /docs folder, redirect to the /documents folder. 2. If
request results in HTTP error 4xx, redirect request to another host where you might process the
error.
Required: No
Redirect
Container for redirect information. You can redirect requests to another host, to another page, or
with another protocol. In the event of an error, you can specify a different error code to return.
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Rule
Service: Amazon Simple Storage Service
Specifies lifecycle rules for an Amazon S3 bucket. For more information, see PUT Bucket lifecycle in the
Amazon Simple Storage Service API Reference.
Contents
AbortIncompleteMultipartUpload
Required: No
Expiration
Required: No
ID
Unique identifier for the rule. The value can't be longer than 255 characters.
Type: String
Required: No
NoncurrentVersionExpiration
Required: No
NoncurrentVersionTransition
Required: No
Prefix
Object key prefix that identifies one or more objects to which this rule applies.
Type: String
Required: Yes
Status
If Enabled, the rule is currently being applied. If Disabled, the rule is not currently being applied.
Type: String
Required: Yes
Transition
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3KeyFilter
Service: Amazon Simple Storage Service
A container for object key name prefix and suffix filtering rules.
Contents
FilterRules
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3Location
Service: Amazon Simple Storage Service
Describes an S3 location that will receive the results of the restore request.
Contents
AccessControlList
Required: No
BucketName
The name of the bucket where the restore results will be placed.
Type: String
Required: Yes
CannedACL
Type: String
Required: No
Encryption
Required: No
Prefix
The prefix that is prepended to the restore results for this request.
Type: String
Required: Yes
StorageClass
Type: String
Required: No
Tagging
Required: No
UserMetadata
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
SelectObjectContentEventStream
Service: Amazon Simple Storage Service
Contents
Cont
Required: No
End
Required: No
Progress
Required: No
Records
Required: No
Stats
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
SelectParameters
Service: Amazon Simple Storage Service
Contents
Expression
Type: String
Required: Yes
ExpressionType
Type: String
Required: Yes
InputSerialization
Required: Yes
OutputSerialization
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ServerSideEncryptionByDefault
Service: Amazon Simple Storage Service
Describes the default server-side encryption to apply to new objects in the bucket. If a PUT Object
request doesn't specify any server-side encryption, this default encryption will be applied. For more
information, see PUT Bucket encryption in the Amazon Simple Storage Service API Reference.
Contents
KMSMasterKeyID
KMS master key ID to use for the default encryption. This parameter is allowed if and only if
SSEAlgorithm is set to aws:kms.
Type: String
Required: No
SSEAlgorithm
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ServerSideEncryptionConfiguration
Service: Amazon Simple Storage Service
Contents
Rules
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
ServerSideEncryptionRule
Service: Amazon Simple Storage Service
Contents
ApplyServerSideEncryptionByDefault
Specifies the default server-side encryption to apply to new objects in the bucket. If a PUT Object
request doesn't specify any server-side encryption, this default encryption will be applied.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
SourceSelectionCriteria
Service: Amazon Simple Storage Service
A container that describes additional filters for identifying the source objects that you want to replicate.
You can choose to enable or disable the replication of these objects. Currently, Amazon S3 supports
only the filter that you can specify for objects created with server-side encryption using an AWS KMS-
Managed Key (SSE-KMS).
Contents
SseKmsEncryptedObjects
A container for filter information for the selection of Amazon S3 objects encrypted with AWS KMS. If
you include SourceSelectionCriteria in the replication configuration, this element is required.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
SSEKMS
Service: Amazon Simple Storage Service
Contents
KeyId
Specifies the ID of the AWS Key Management Service (KMS) master encryption key to use for
encrypting Inventory reports.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
SseKmsEncryptedObjects
Service: Amazon Simple Storage Service
A container for filter information for the selection of S3 objects encrypted with AWS KMS.
Contents
Status
Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS
KMS-managed key.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
SSES3
Service: Amazon Simple Storage Service
Contents
The members of this structure are context-dependent.
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Stats
Service: Amazon Simple Storage Service
Contents
BytesProcessed
Type: Long
Required: No
BytesReturned
Type: Long
Required: No
BytesScanned
Type: Long
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
StatsEvent
Service: Amazon Simple Storage Service
Contents
Details
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
StorageClassAnalysis
Service: Amazon Simple Storage Service
Specifies data related to access patterns to be collected and made available to analyze the tradeoffs
between different storage classes for an Amazon S3 bucket.
Contents
DataExport
Specifies how data related to the storage class analysis for an Amazon S3 bucket should be
exported.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
StorageClassAnalysisDataExport
Service: Amazon Simple Storage Service
Contents
Destination
Required: Yes
OutputSchemaVersion
The version of the output schema to use when exporting data. Must be V_1.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Tag
Service: Amazon Simple Storage Service
Contents
Key
Type: String
Required: Yes
Value
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Tagging
Service: Amazon Simple Storage Service
Contents
TagSet
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
TargetGrant
Service: Amazon Simple Storage Service
Contents
Grantee
Required: No
Permission
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
TopicConfiguration
Service: Amazon Simple Storage Service
A container for specifying the configuration for publication of messages to an Amazon Simple
Notification Service (Amazon SNS) topic when Amazon S3 detects specified events.
Contents
Events
The Amazon S3 bucket event about which to send notifications. For more information, see
Supported Event Types in the Amazon Simple Storage Service Developer Guide.
Required: Yes
Filter
Required: No
Id
An optional unique identifier for configurations in a notification configuration. If you don't provide
one, Amazon S3 will assign an ID.
Type: String
Required: No
TopicArn
The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 publishes a
message when it detects events of the specified type.
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
TopicConfigurationDeprecated
Service: Amazon Simple Storage Service
Contents
Event
Type: String
Required: No
Events
Required: No
Id
An optional unique identifier for configurations in a notification configuration. If you don't provide
one, Amazon S3 will assign an ID.
Type: String
Required: No
Topic
Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the
bucket.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Transition
Service: Amazon Simple Storage Service
Contents
Date
Indicates when objects are transitioned to the specified storage class. The date value must be in ISO
8601 format. The time is always midnight UTC.
Type: Timestamp
Required: No
Days
Indicates the number of days after creation when objects are transitioned to the specified storage
class. The value must be a positive integer.
Type: Integer
Required: No
StorageClass
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
VersioningConfiguration
Service: Amazon Simple Storage Service
Describes the versioning state of an Amazon S3 bucket. For more information, see PUT Bucket versioning
in the Amazon Simple Storage Service API Reference.
Contents
MFADelete
Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is
only returned if the bucket has been configured with MFA delete. If the bucket has never been so
configured, this element is not returned.
Type: String
Required: No
Status
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
WebsiteConfiguration
Service: Amazon Simple Storage Service
Contents
ErrorDocument
Required: No
IndexDocument
Required: No
RedirectAllRequestsTo
The redirect behavior for every request to this bucket's website endpoint.
Important
If you specify this property, you can't specify any other property.
Required: No
RoutingRules
Rules that define when a redirect is applied and the redirect behavior.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
AWS S3 Control
The following data types are supported by AWS S3 Control:
JobDescriptor
Service: AWS S3 Control
A container element for the job configuration and status information returned by a Describe Job
request.
Contents
ConfirmationRequired
Indicates whether confirmation is required before Amazon S3 begins running the specified job.
Confirmation is required only for jobs created through the Amazon S3 console.
Type: Boolean
Required: No
CreationTime
Type: Timestamp
Required: No
Description
The description for this job, if one was provided in this job's Create Job request.
Type: String
Required: No
FailureReasons
If the specified job failed, this field contains information describing the failure.
Required: No
JobArn
Type: String
Required: No
JobId
Type: String
Required: No
Manifest
Required: No
Operation
The operation that the specified job is configured to execute on the objects listed in the manifest.
Required: No
Priority
Type: Integer
Required: No
ProgressSummary
Describes the total number of tasks that the specified job has executed, the number of tasks that
succeeded, and the number of tasks that failed.
Required: No
Report
Contains the configuration information for the job-completion report if you requested one in the
Create Job request.
Required: No
RoleArn
The Amazon Resource Name (ARN) for the Identity and Access Management (IAM) Role assigned to
execute the tasks for this job.
Type: String
Required: No
Status
Type: String
Required: No
StatusUpdateReason
Type: String
Required: No
SuspendedCause
The reason why the specified job was suspended. A job is only suspended if you create it through the
Amazon S3 console. When you create the job, it enters the Suspended state to await confirmation
before running. After you confirm the job, it automatically exits the Suspended state.
Type: String
Required: No
SuspendedDate
The timestamp when this job was suspended, if it has been suspended.
Type: Timestamp
Required: No
TerminationDate
A timestamp indicating when this job terminated. A job's termination date is the date and time when
it succeeded, failed, or was canceled.
Type: Timestamp
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobFailure
Service: AWS S3 Control
If this job failed, this element indicates why the job failed.
Contents
FailureCode
Type: String
Required: No
FailureReason
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobListDescriptor
Service: AWS S3 Control
Contains the configuration and status information for a single job retrieved as part of a job list.
Contents
CreationTime
Type: Timestamp
Required: No
Description
The user-specified description that was included in the specified job's Create Job request.
Type: String
Required: No
JobId
Type: String
Required: No
Operation
The operation that the specified job is configured to run on each object listed in the manifest.
Type: String
Required: No
Priority
Type: Integer
Required: No
ProgressSummary
Describes the total number of tasks that the specified job has executed, the number of tasks that
succeeded, and the number of tasks that failed.
Required: No
Status
Type: String
Required: No
TerminationDate
A timestamp indicating when the specified job terminated. A job's termination date is the date and
time when it succeeded, failed, or was canceled.
Type: Timestamp
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobManifest
Service: AWS S3 Control
Contents
Location
Required: Yes
Spec
Describes the format of the specified job's manifest. If the manifest is in CSV format, also describes
the columns contained within the manifest.
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobManifestLocation
Service: AWS S3 Control
Contents
ETag
Type: String
Required: Yes
ObjectArn
Type: String
Required: Yes
ObjectVersionId
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobManifestSpec
Service: AWS S3 Control
Describes the format of a manifest. If the manifest is in CSV format, also describes the columns
contained within the manifest.
Contents
Fields
Required: No
Format
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobOperation
Service: AWS S3 Control
The operation that you want this job to perform on each object listed in the manifest. For more
information about the available operations, see Available Operations in the Amazon Simple Storage
Service Developer Guide.
Contents
LambdaInvoke
Directs the specified job to invoke an AWS Lambda function on each object in the manifest.
Required: No
S3InitiateRestoreObject
Directs the specified job to execute an Initiate Glacier Restore call on each object in the manifest.
Required: No
S3PutObjectAcl
Directs the specified job to execute a PUT Object acl call on each object in the manifest.
Required: No
S3PutObjectCopy
Directs the specified job to execute a PUT Copy object call on each object in the manifest.
Required: No
S3PutObjectTagging
Directs the specified job to execute a PUT Object tagging call on each object in the manifest.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobProgressSummary
Service: AWS S3 Control
Describes the total number of tasks that the specified job has executed, the number of tasks that
succeeded, and the number of tasks that failed.
Contents
NumberOfTasksFailed
Type: Long
Required: No
NumberOfTasksSucceeded
Type: Long
Required: No
TotalNumberOfTasks
Type: Long
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
JobReport
Service: AWS S3 Control
Contents
Bucket
Type: String
Required: No
Enabled
Type: Boolean
Required: Yes
Format
Type: String
Required: No
Prefix
An optional prefix to describe where in the specified bucket the job-completion report will be stored.
Amazon S3 will store the job-completion report at <prefix>/job-<job-id>/report.json.
Type: String
Required: No
ReportScope
Indicates whether the job-completion report will include details of all tasks or only failed tasks.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
LambdaInvokeOperation
Service: AWS S3 Control
Contents
FunctionArn
The Amazon Resource Name (ARN) for the AWS Lambda function that the specified job will invoke
for each object in the manifest.
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
PublicAccessBlockConfiguration
Service: AWS S3 Control
The PublicAccessBlock configuration that you want to apply to this Amazon S3 bucket. You can
enable the configuration options in any combination. For more information about when Amazon S3
considers a bucket or object public, see The Meaning of "Public" in the Amazon Simple Storage Service
Developer Guide.
Contents
BlockPublicAcls
Specifies whether Amazon S3 should block public access control lists (ACLs) for buckets in this
account. Setting this element to TRUE causes the following behavior:
• PUT Bucket acl and PUT Object acl calls fail if the specified ACL is public.
• PUT Object calls fail if the request includes a public ACL.
• PUT Bucket calls fail if the request includes a public ACL.
Type: Boolean
Required: No
BlockPublicPolicy
Specifies whether Amazon S3 should block public bucket policies for buckets in this account. Setting
this element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket
policy allows public access.
Type: Boolean
Required: No
IgnorePublicAcls
Specifies whether Amazon S3 should ignore public ACLs for buckets in this account. Setting this
element to TRUE causes Amazon S3 to ignore all public ACLs on buckets in this account and any
objects that they contain.
Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new
public ACLs from being set.
Type: Boolean
Required: No
RestrictPublicBuckets
Specifies whether Amazon S3 should restrict public bucket policies for buckets in this account.
Setting this element to TRUE restricts access to buckets with public policies to only AWS services and
authorized users within this account.
Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-
account access within any public bucket policy, including non-public delegation to specific accounts,
is blocked.
Type: Boolean
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3AccessControlList
Service: AWS S3 Control
Contents
Grants
Required: No
Owner
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3AccessControlPolicy
Service: AWS S3 Control
Contents
AccessControlList
Required: No
CannedAccessControlList
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3CopyObjectOperation
Service: AWS S3 Control
Contains the configuration parameters for a PUT Copy object operation. Amazon S3 batch operations
passes each value through to the underlying PUT Copy object API. For more information about the
parameters for this operation, see PUT Object - Copy.
Contents
AccessControlGrants
Required: No
CannedAccessControlList
Type: String
Required: No
MetadataDirective
Type: String
Required: No
ModifiedSinceConstraint
Type: Timestamp
Required: No
NewObjectMetadata
Required: No
NewObjectTagging
Required: No
ObjectLockLegalHoldStatus
Type: String
Required: No
ObjectLockMode
Type: String
Required: No
ObjectLockRetainUntilDate
Type: Timestamp
Required: No
RedirectLocation
Type: String
Required: No
RequesterPays
Type: Boolean
Required: No
SSEAwsKmsKeyId
Type: String
Required: No
StorageClass
Type: String
Required: No
TargetKeyPrefix
Type: String
Required: No
TargetResource
Type: String
Required: No
UnModifiedSinceConstraint
Type: Timestamp
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3Grant
Service: AWS S3 Control
Contents
Grantee
Required: No
Permission
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3Grantee
Service: AWS S3 Control
Contents
DisplayName
Type: String
Required: No
Identifier
Type: String
Required: No
TypeIdentifier
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3InitiateRestoreObjectOperation
Service: AWS S3 Control
Contains the configuration parameters for an Initiate Glacier Restore job. Amazon S3 batch operations
passes each value through to the underlying POST Object restore API. For more information about the
parameters for this operation, see Restoring Archives.
Contents
ExpirationInDays
Type: Integer
Required: No
GlacierJobTier
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3ObjectMetadata
Service: AWS S3 Control
Contents
CacheControl
Type: String
Required: No
ContentDisposition
Type: String
Required: No
ContentEncoding
Type: String
Required: No
ContentLanguage
Type: String
Required: No
ContentLength
Type: Long
Required: No
ContentMD5
Type: String
Required: No
ContentType
Type: String
Required: No
HttpExpiresDate
Type: Timestamp
Required: No
RequesterCharged
Type: Boolean
Required: No
SSEAlgorithm
Type: String
Required: No
UserMetadata
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3ObjectOwner
Service: AWS S3 Control
Contents
DisplayName
Type: String
Required: No
ID
Type: String
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3SetObjectAclOperation
Service: AWS S3 Control
Contains the configuration parameters for a Set Object ACL operation. Amazon S3 batch operations
passes each value through to the underlying PUT Object acl API. For more information about the
parameters for this operation, see PUT Object acl.
Contents
AccessControlPolicy
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3SetObjectTaggingOperation
Service: AWS S3 Control
Contains the configuration parameters for a Set Object Tagging operation. Amazon S3 batch operations
passes each value through to the underlying PUT Object tagging API. For more information about the
parameters for this operation, see PUT Object tagging.
Contents
TagSet
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
S3Tag
Service: AWS S3 Control
Contents
Key
Type: String
Required: Yes
Value
Type: String
Required: Yes
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: