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 Astran 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
x-amz-sdk-checksum-algorithm: ChecksumAlgorithm
x-amz-checksum-crc32: ChecksumCRC32

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

x-amz-checksum-crc32

This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the Base64 encoded, 32-bit CRC32 checksum of the object. For more information, see Checking object integrity in the Astran S3 User Guide.

x-amz-sdk-checksum-algorithm

Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding x-amz-checksum-algorithm or x-amz-trailer header sent. Otherwise, Astran S3 fails the request with the HTTP status code 400 Bad Request.

For the x-amz-checksum-algorithm header, replace algorithm with the supported algorithm from the following list:

  • CRC32

For more information, see Checking object integrity in the Astran S3 User Guide.

If the individual checksum value you provide through x-amz-checksum-algorithm doesn't match the checksum algorithm you set through x-amz-sdk-checksum-algorithm, Astran S3 fails the request with a BadDigest error.

Valid Values: CRC32

Request Body

The request accepts the following binary data.

Body

Response Syntax

HTTP/1.1 200
ETag: ETag
x-amz-checksum-crc32: ChecksumCRC32
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-checksum-crc32

The Base64 encoded, 32-bit CRC32 checksum of the object. This checksum is only be present if the checksum was uploaded with the object. When you use an API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it's a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see Checking object integrity in the _Astran S3 User Guide.

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 Astran 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: