Skip to main content

PutObject

Adds an object to a bucket.

note

Astran S3 never adds partial objects; if you receive a success response, Astran S3 added the entire object to the bucket.

Astran S3 is a distributed system. If it receives multiple write requests for the same object simultaneously, it overwrites all but the last object written.

S3 Versioning - When you enable versioning for a bucket, if Astran S3 receives multiple write requests for the same object, it stores all versions of the object. For each write request that is made to the same object, Astran S3 automatically generates a unique version ID of that object being stored in Astran S3. You can retrieve, replace, or delete any version of the object. For more information about versioning, see Adding Objects to Versioning-Enabled Buckets in the Amazon S3 User Guide. For information about returning the versioning state of a bucket, see GetBucketVersioning.

Permissions

ActionDescriptionResource
PutObjectGrants permission to add an object to a bucketobject

For more information about related Astran S3 APIs, see the following:

Request Syntax

PUT /Bucket/Key+ HTTP/1.1
Host: <partition>.s3.astran.io

Body

URI Request Parameters

The request uses the following URI parameters.

Bucket

The bucket name to which the PUT action was initiated.

Required: Yes

Key

Object key for which the PUT action was initiated.

Length Constraints: Minimum length of 1.

Required: Yes

Request Body

The request accepts the following binary data.

Body

Response Syntax

HTTP/1.1 200
ETag: ETag
x-amz-version-id: VersionId

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

ETag

Entity tag for the uploaded object.

To ensure that data is not corrupted traversing the network, for objects where the ETag is the MD5 digest of the object, you can calculate the MD5 while putting an object to Astran S3 and compare the returned ETag to the calculated MD5 value.

x-amz-version-id

Version ID of the object.

If you enable versioning for a bucket, Astran S3 automatically generates a unique version ID for the object being stored. Astran S3 returns this ID in the response. For each write request that is made to the same object, Astran S3 automatically generates a unique version ID of that object being stored in Astran S3. You can retrieve, replace, or delete any version of the object.

For more information about versioning, see Adding Objects to Versioning-Enabled Buckets in the Amazon S3 User Guide. For information about returning the versioning state of a bucket, see GetBucketVersioning.

Examples

Example 1 for general purpose buckets: Upload an object

The following request stores the my-image.jpg file in the mybucket bucket.

      PUT /mybucket/my-image.jpg HTTP/1.1
Host: <partition>.s3.astran.io
Date: Mon, 25 Sep 2024 09:09:17 GMT
Authorization: authorization string
Content-Length: 11434
Expect: 100-continue
[11434 bytes of object data]

Sample Response for general purpose buckets: Versioning suspended

      HTTP/1.1 100 Continue

HTTP/1.1 200 OK
x-request-id: 0A49CE4060975EAC
Date: Mon, 25 Sep 2024 09:09:17 GMT
ETag: 1b2cf535f27731c974343645a3985328
Content-Length: 0
Connection: close

Sample Response for general purpose buckets: Versioning enabled

If the bucket has versioning enabled, the response includes the x-amz-version-id header.

      HTTP/1.1 100 Continue

HTTP/1.1 200 OK
x-request-id: 0A49CE4060975EAC
x-amz-version-id: some_version_id
Date: Mon, 25 Sep 2024 09:09:17 GMT
ETag: fbacf535f27731c9771645a39863328
Content-Length: 0
Connection: close

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: