Skip to main content

PutObject

Adds an object to a bucket.

Description

The PutObject operation adds an object to a bucket. You can use PutObject to create a new object or replace an existing object. To use this operation, you must have s3:PutObject permissions on the bucket, or be the bucket owner.

Important
  • QStorage never adds partial objects; if you receive a success response, QStorage added the entire object to the bucket.
  • If you upload an object that has the same key as an existing object in the bucket, QStorage replaces the existing object.
  • You cannot use PutObject to only update a single piece of metadata for an existing object. You must put the entire object with updated metadata if you want to update some values.
  • The maximum size of a single PUT operation is 5 GB.
  • For objects larger than 100 MB, consider using multipart uploads for better reliability.
  • User-defined metadata is limited to 2 KB in size.
  • Headers with the prefix x-amz-meta- are treated as user-defined metadata.
  • You can use SSE, but this means your uploaded data will be encrypted twice, once with the specified key, and again for storage.

Access Control Lists (ACLs)

  • By default, all objects are private. Only the owner has full access control.
  • You can use headers to grant ACL-based permissions to individual accounts or predefined groups.
  • You can use either canned ACLs (x-amz-acl) or grant specific permissions (x-amz-grant-* headers).
  • If the bucket uses the bucket owner enforced setting for Object Ownership, ACLs are disabled.

Data Integrity

  • You can use Content-MD5 header for basic data integrity verification.
  • For enhanced integrity checking, you can use one of the following checksum algorithms:
    • CRC32 (x-amz-checksum-crc32)
    • CRC32C (x-amz-checksum-crc32c)
    • SHA1 (x-amz-checksum-sha1)
    • SHA256 (x-amz-checksum-sha256)
  • When using SDKs, you can specify the checksum algorithm using x-amz-sdk-checksum-algorithm.

Server-Side Encryption

  • Objects are encrypted by default using server-side encryption with QStorage managed keys.
  • You can specify the following encryption options:
    • QStorage managed keys (SSE-S3) using AES256
    • QKMS keys (SSE-KMS) using verenc
    • Double encryption with QKMS keys (DSSE-KMS) using verenc:dsse
  • When using KMS encryption, you can specify:
    • The KMS key ID (x-amz-server-side-encryption-aws-kms-key-id)
    • Additional encryption context (x-amz-server-side-encryption-context)
    • Whether to use QStorage Bucket Keys (x-amz-server-side-encryption-bucket-key-enabled)

Object Lock

  • You can use Object Lock to prevent an object from being deleted or overwritten for a fixed amount of time or indefinitely.
  • Object Lock can be applied in one of two modes:
    • GOVERNANCE mode: Users with special permissions can override these retention settings
    • COMPLIANCE mode: No one, including the root user, can override or delete the object until retention expires
  • Legal holds can be placed independently of retention periods
  • To use Object Lock:
    • Specify the lock mode using x-amz-object-lock-mode
    • Set the retention period using x-amz-object-lock-retain-until-date
    • Apply legal holds using x-amz-object-lock-legal-hold
  • Object Lock must be enabled on the bucket before it can be used on objects

Required Permissions

  • To successfully complete the PutObject request, you must have the s3:PutObject permission on the bucket.
  • To change the object's ACL with your PutObject request, you must have the s3:PutObjectAcl permission.
  • To set the tag-set with your PutObject request, you must have the s3:PutObjectTagging permission. :::

Request Syntax

PUT /ObjectKey HTTP/1.1
Host: BucketName.qstorage.quilibrium.com
Content-Length: ContentLength
Content-Type: ContentType
Content-MD5: ContentMD5
x-amz-meta-*: MetadataValue
x-amz-expected-bucket-owner: OwnerAccountId
[12345 bytes of object data]
Values in italics indicate user input and should be replaced with actual values.

Request Parameters

Headers

NameDescriptionRequiredType
Content-LengthSize of the object in bytesYesnumber
Content-TypeA standard MIME type describing the format of the object dataNotext
Content-MD5The base64-encoded 128-bit MD5 digest of the message (RFC 1864)Notext
Cache-ControlCan be used to specify caching behavior along the request/reply chainNotext
Content-DispositionSpecifies presentational information for the objectNotext
Content-EncodingSpecifies what content encodings have been applied to the objectNotext
ExpiresThe date and time at which the object is no longer cacheableNotext
x-amz-aclThe canned ACL to apply to the object

Valid values: private | public-read | public-read-write | authenticated-read | aws-exec-read | bucket-owner-read | bucket-owner-full-control
Notext
x-amz-checksum-crc32The Base64 encoded, 32-bit CRC32 checksum of the object for data integrity verificationNotext
x-amz-checksum-crc32cThe Base64 encoded, 32-bit CRC32C checksum of the object for data integrity verificationNotext
x-amz-checksum-sha1The Base64 encoded, 160-bit SHA1 digest of the object for data integrity verificationNotext
x-amz-checksum-sha256The Base64 encoded, 256-bit SHA256 digest of the object for data integrity verificationNotext
x-amz-grant-full-controlGives the grantee READ, READ_ACP, and WRITE_ACP permissions on the objectNotext
x-amz-grant-readAllows grantee to read the object data and its metadataNotext
x-amz-grant-read-acpAllows grantee to read the object ACLNotext
x-amz-grant-write-acpAllows grantee to write the ACL for the applicable objectNotext
x-amz-server-side-encryptionThe server-side encryption algorithm to use when storing this object

Valid values: AES256 | verenc
Notext
x-amz-server-side-encryption-aws-kms-key-idThe ID of the QKMS key to use for object encryption. Required if x-amz-server-side-encryption is verencNotext
x-amz-server-side-encryption-contextSpecifies the QKMS Encryption Context to use for object encryption (Base64-encoded string of UTF-8 encoded JSON)Notext
x-amz-server-side-encryption-bucket-key-enabledSpecifies whether to use an QStorage Bucket Key for object encryption with QKMS (SSE-KMS)Notext
x-amz-sdk-checksum-algorithmIndicates the algorithm used to create the checksum when using the SDK

Valid values: CRC32 | CRC32C | SHA1 | SHA256 | CRC64NVME
Notext
x-amz-meta-*User-defined metadata. Each key-value pair in the metadata is stored with the object. Total size of all metadata must be less than 2KB.Notext
x-amz-taggingThe tag-set for the object. The tag-set must be encoded as URL Query parametersNotext
x-amz-expected-bucket-ownerThe account ID of the expected bucket owner. Request fails with 403 Forbidden if the account ID doesn't match the actual bucket ownerNotext
x-amz-object-lock-legal-holdSpecifies whether a legal hold will be applied to this object. For more information about Object Lock, see Object Lock documentation

Valid values: ON | OFF
Notext
x-amz-object-lock-modeThe Object Lock mode that you want to apply to this object

Valid values: GOVERNANCE | COMPLIANCE
Notext
x-amz-object-lock-retain-until-dateThe date and time when you want this object's Object Lock to expire. Must be formatted as a timestamp parameter.Notext

Examples

Example 1: Upload a text file

PUT /hello.txt HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
Content-Length: 11
Content-Type: text/plain
Hello World
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
x-amz-id-2: Example7qoYGN7uMuFuYS6m7a4l
x-amz-request-id: TX234S0F24A06C7
Date: Wed, 01 Mar 2024 12:00:00 GMT
ETag: "7778aef83f66abc1fa1e8477f296d394"
Values in italics indicate variable response values.

Example 2: Upload an object with metadata

PUT /document.txt HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
Content-Length: 11
Content-Type: text/plain
x-amz-meta-title: My Document
x-amz-meta-author: John Doe
Hello World
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
x-amz-id-2: Example7qoYGN7uMuFuYS6m7a4l
x-amz-request-id: TX234S0F24A06C7
Date: Wed, 01 Mar 2024 12:00:00 GMT
ETag: "7778aef83f66abc1fa1e8477f296d394"
Values in italics indicate variable response values.

Response Syntax

HTTP/1.1 200 OK
x-amz-id-2: RequestId
x-amz-request-id: AmazonRequestId
Date: ISO8601Date
ETag: EntityTag
Values in italics indicate variable response values.

Response Elements

Response Headers

NameDescriptionRequiredType
x-amz-id-2An identifier for the request that you can use to troubleshoot issuesNoString
x-amz-request-idA unique identifier for the request that you can use to troubleshoot issuesNoString
x-amz-version-idThe version ID of the object. When you upload an object in a bucket with versioning enabled, QStorage automatically generates a version ID for the objectNoString
x-amz-expirationIf the object expiration is configured, this header contains the expiration date of the object and the rule ID that matches the objectNoString
ETagEntity tag containing an MD5 hash of the object. The ETag reflects changes only to the contents of an object, not its metadataNoString
x-amz-server-side-encryptionThe server-side encryption algorithm used when storing this object (AES256, verenc)

Valid values: AES256 | verenc
NoString
x-amz-server-side-encryption-aws-kms-key-idIf x-amz-server-side-encryption is verenc, this header specifies the ID of the Quilibrium Key Management Service (QKMS) symmetric encryption customer managed key that was used for the objectNoString
x-amz-server-side-encryption-customer-algorithmIf server-side encryption with customer-provided encryption keys was requested, this header confirms the encryption algorithm usedNoString
x-amz-server-side-encryption-customer-key-MD5If server-side encryption with customer-provided encryption keys was requested, this header provides the base64-encoded MD5 digest of the encryption keyNoString
x-amz-server-side-encryption-bucket-key-enabledIndicates whether the uploaded object uses an QStorage Bucket Key for server-side encryption with QKMS (SSE-KMS)NoString
x-amz-checksum-crc32This header is returned when using the CRC32 checksum algorithm to verify object integrityNoString
x-amz-checksum-crc32cThis header is returned when using the CRC32C checksum algorithm to verify object integrityNoString
x-amz-checksum-sha1This header is returned when using the SHA-1 checksum algorithm to verify object integrityNoString
x-amz-checksum-sha256This header is returned when using the SHA-256 checksum algorithm to verify object integrityNoString
x-amz-request-chargedIf present, indicates that the requester was successfully charged for the request.

Valid values: requester
NoString
x-amz-object-sizeThe size of the object in bytes. This value is only present if you append to an objectNoString
x-amz-checksum-typeSpecifies the checksum type of the object.

For PutObject uploads, the value is always FULL_OBJECT.

Valid values: COMPOSITE | FULL_OBJECT
NoString

Special Errors

Error CodeDescription
NoSuchBucketThe specified bucket does not exist
InvalidDigestThe Content-MD5 you specified did not match what we received
BadDigestThe Content-MD5 you specified was invalid
EntityTooLargeYour proposed upload exceeds the maximum allowed object size
InvalidTagThe tag provided was not a valid tag. All tags must follow the tag format requirements
MissingContentLengthYou must provide the Content-Length HTTP header
MissingRequestBodyErrorRequest body is empty
RequestTimeoutYour socket connection to the server was not read from or written to within the timeout period
403Forbidden. Authentication failed or you do not have permission to add an object to the bucket

Permissions

You must have the s3:PutObject permission on the bucket. Additional permissions may be required:

  • s3:PutObjectAcl - To set the object ACL
  • s3:PutObjectTagging - To set object tags
  • s3:PutObjectVersionAcl - To set ACL on a specific object version

Try It Out

Test PutObject

Add an object to a bucket.

Coming Soon

This feature is currently under development and will be available soon.