PUT Object
The PUT Object operation adds an object to a bucket. To add an object to a bucket, you must have WRITE permissions on the bucket. To ensure data is not corrupted when using the PUT Object operation, you should use the Content-MD5
header. To configure your application to send Request Headers
prior to sending the request body, use the 100-continue
HTTP status code.
Access Permissions
To grant specific permission on an object using a request header, you can either:
-
Specify a canned (predefined) ACL using the
x-amz-acl
request header. For more information, see Controlling Access to Resources Using S3 ACLs. -
Specify access permissions explicitly using the
x-amz-grant-read
,x-amz-grant-read-acp
, andx-amz-grant-write-acp
,x-amz-grant-full-control
headers. These headers map to the set of permissions S3 supports in an ACL. For more information, see Controlling Access to Resources Using S3 ACLs.
Object Versioning
If you enable versioning for a bucket, S3 automatically generates a unique
version ID for the object being stored. S3 returns this ID in the response using
the x-amz-version-id
response header. If versioning is
suspended, S3 always uses null
as the version ID for the
object stored. If you enable versioning for a bucket, when S3 receives multiple
write requests for the same object simultaneously, it stores all of the objects
as separate versions.
Request Parameters
This implementation of the PUT Object operation does not support the use of request parameters.
Request Headers
The PUT Object operation supports the use of following request headers:
-
Request headers common to all operations. For more information, see table "Common Supported Request Headers" in Supported Common Request Headers.
-
Request headers for PUT Object operations, which include
Content-Disposition
,Content-Encoding
,Content-Length
,Content-MD5
,Content-Type
,Expect
,x-amz-meta-
,x-amz-tagging
. For a description of these request headers, see PUT Object.
Response Headers
The PUT Object operation supports the use of the following response headers:
-
Response headers common to all operations. For more information, see table "Supported Response Headers" in Supported Common Response Headers.
-
The
x-amz-version-id
header. This header describes the object version.
Response Elements
This implementation of the PUT Object operation does not return response elements.
Error Response Code
The PUT Object API does not return special errors. For general information about S3 errors and a list of error codes, see S3 Client Error Handling Reference.
Example
PUT /my-image.jpg Date: Wed, 12 Oct 2018 17:50:00 GMT Authorization: authorization string Content-Type: text/plain Content-Length: 11434 x-amz-grant-full-control: id="michael" x-amz-meta-author: Janet Expect: 100-continue HTTP/1.1 100 Continue HTTP/1.1 200 OK x-amz-request-id: tx0A49CE4060975EAC Date: Wed, 12 Oct 2018 17:50:00 GMT ETag: "1b2cf535f27731c974343645a3985328" Content-Length: 0 Connection: close Server: Apache
When versioning is enabled on the bucket, the response includes the
x-amz-version-id
header:
HTTP/1.1 100 Continue HTTP/1.1 200 OK x-amz-request-id: tx0A49CE4060975EAC x-amz-version-id: 0075 Date: Wed, 12 Oct 2018 17:50:00 GMT ETag: "fbacf535f27731c9771645a39863328" Content-Length: 0 Connection: close