Skip to main content

CopyObject

Creates a copy of an object that is already stored in QStorage.

Description

The CopyObject operation creates a copy of an object that is already stored in QStorage. A copy operation creates a new object with the same data and metadata as the source object, but with a different key name and/or destination bucket.

Permissions

You must have:

  • s3:GetObject permission on the source object
  • s3:PutObject permission on the destination bucket
note
  • The source object and destination must be in QStorage buckets.
  • When copying an object, you can preserve all metadata (default) or specify new metadata.
  • You cannot copy objects that are larger than 5 GB in size. For larger objects, you must use multipart upload operations.
  • The source bucket and destination bucket must exist before you can copy an object.
  • You can use SSE, but this means your uploaded data will be encrypted twice, once with the specified key, and again for storage.

Request Headers

NameDescriptionRequiredType
x-amz-copy-sourceThe name of the source bucket and key name of the source object, separated by a forward slashYestext
x-amz-aclThe canned ACL to apply to the object.

Valid Values: private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control
Notext
x-amz-checksum-algorithmIndicates the algorithm used to create the checksum for the object.

Valid Values: CRC32 | CRC32C | SHA1 | SHA256
Notext
x-amz-copy-source-if-matchCopy the object only if its entity tag (ETag) matches the specified tagNotext
x-amz-copy-source-if-none-matchCopy the object only if its entity tag (ETag) is different from the specified tagNotext
x-amz-copy-source-if-modified-sinceCopy the object only if it has been modified since the specified timeNotext
x-amz-copy-source-if-unmodified-sinceCopy the object only if it hasn't been modified since the specified timeNotext
x-amz-copy-source-server-side-encryption-customer-algorithmSpecifies the algorithm to use when decrypting the source object. Must be used with x-amz-copy-source-server-side-encryption-customer-key and x-amz-copy-source-server-side-encryption-customer-key-MD5Notext
x-amz-copy-source-server-side-encryption-customer-keySpecifies the customer-provided encryption key for decrypting the source object. Must be used with x-amz-copy-source-server-side-encryption-customer-algorithm and x-amz-copy-source-server-side-encryption-customer-key-MD5Notext
x-amz-copy-source-server-side-encryption-customer-key-MD5Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Must be used with x-amz-copy-source-server-side-encryption-customer-algorithm and x-amz-copy-source-server-side-encryption-customer-keyNotext
x-amz-metadata-directiveSpecifies whether to copy the metadata from the source object or replace it with metadata provided in the request

Valid values: COPY | REPLACE
Notext
x-amz-server-side-encryptionSpecifies server-side encryption algorithm to use for the destination object

Valid values: AES256 | verenc
Notext
x-amz-server-side-encryption-customer-algorithmSpecifies the algorithm to use to when encrypting the destination object. Must be used with x-amz-server-side-encryption-customer-key and x-amz-server-side-encryption-customer-key-MD5Notext
x-amz-server-side-encryption-customer-keySpecifies the customer-provided encryption key for encrypting the destination object. Must be used with x-amz-server-side-encryption-customer-algorithm and x-amz-server-side-encryption-customer-key-MD5Notext
x-amz-server-side-encryption-customer-key-MD5Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Must be used with x-amz-server-side-encryption-customer-algorithm and x-amz-server-side-encryption-customer-keyNotext
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-expected-bucket-ownerThe account ID of the expected destination bucket ownerNotext
x-amz-source-expected-bucket-ownerThe account ID of the expected source bucket ownerNotext
x-amz-request-payerConfirms that the requester knows that they will be charged for the request. Required for Requester Pays buckets.Notext
x-amz-object-lock-retain-until-dateThe date and time when the Object Lock retention period expires. Must be formatted as a timestamp in ISO 8601 format.Notext
x-amz-object-lock-modeThe Object Lock mode that you want to apply to the copied object.

Valid Values: GOVERNANCE | COMPLIANCE
Notext
x-amz-object-lock-legal-holdSpecifies whether you want to apply a legal hold to the copied object.

Valid Values: ON | OFF
Notext
x-amz-server-side-encryption-aws-kms-key-idThe ID of the symmetric encryption key to use for object encryption. Must be used with x-amz-server-side-encryption=verenc.Notext
x-amz-server-side-encryption-bucket-key-enabledSpecifies whether QStorage should use an S3 Bucket Key for object encryption.

Valid values: true | false
Notext
x-amz-server-side-encryption-contextSpecifies the encryption context to use for object encryption. Must be base64-encoded and must be used with x-amz-server-side-encryption=verenc.Notext
x-amz-taggingThe tag-set for the object. The tag-set must be encoded as URL Query parameters.Notext
x-amz-tagging-directiveSpecifies whether to copy the tag-set from the source object or replace it with tags provided in the request.

Valid Values: COPY | REPLACE
Notext
x-amz-website-redirect-locationIf the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL.Notext

Request URI Parameters

This operation does not use URI parameters.

Request Body

This operation does not have a request body.

Request Syntax

PUT /{ObjectKey} HTTP/1.1
Host: {BucketName}.qstorage.quilibrium.com
x-amz-copy-source: {SourceBucket}/{SourceObjectKey}
x-amz-copy-source-if-match: {ETag}
x-amz-copy-source-if-none-match: {ETag}
x-amz-copy-source-if-modified-since: {TimeStamp}
x-amz-copy-source-if-unmodified-since: {TimeStamp}
x-amz-metadata-directive: COPY | REPLACE
x-amz-expected-bucket-owner: {OwnerAccountId}
x-amz-source-expected-bucket-owner: {SourceOwnerAccountId}
Values in italics indicate user input and should be replaced with actual values.

Response Headers

NameDescriptionRequiredType
x-amz-id-2An identifier for the requestNoString
x-amz-request-idA unique identifier for the requestNoString
x-amz-version-idVersion ID of the newly created copyNoString
x-amz-copy-source-version-idVersion ID of the source objectNoString
x-amz-server-side-encryptionThe server-side encryption algorithm used when storing this object in QStorageNoString
x-amz-server-side-encryption-aws-kms-key-idIf x-amz-server-side-encryption is present and has the value of verenc, this indicates the ID of the Q KMS Key Management Service (KMS) symmetric encryption customer master key that was used for the objectNoString
x-amz-server-side-encryption-customer-algorithmIf server-side encryption with customer-provided encryption keys was requested, the response will include this header confirming the encryption algorithm usedNoString
x-amz-server-side-encryption-customer-key-MD5If server-side encryption with customer-provided encryption keys was requested, the response will include this header to provide round-trip message integrity verification of the customer-provided encryption keyNoString
x-amz-server-side-encryption-bucket-key-enabledIndicates whether the copied object uses an S3 Bucket Key for server-side encryption with QKMS (SSE-KMS)NoString

Response Body Elements

NameDescriptionRequiredType
CopyObjectResultContainer for all response elements. See CopyObjectResult for details.NoString
ETagThe entity tag (ETag) that represents the copied object. The ETag reflects only changes to the contents of an object, not its metadata.NoString
LastModifiedThe date and time at which the copied object was last modified.NoString
ChecksumCRC32The base64-encoded, 32-bit CRC32 checksum of the object. This will only be present if it was uploaded with the object.NoString
ChecksumCRC32CThe base64-encoded, 32-bit CRC32C checksum of the object. This will only be present if it was uploaded with the object.NoString
ChecksumCRC64NVMEThe base64-encoded, 64-bit CRC64 checksum of the object computed using the NVME format. This will only be present if it was uploaded with the object.NoString
ChecksumSHA1The base64-encoded, 160-bit SHA-1 digest of the object. This will only be present if it was uploaded with the object.NoString
ChecksumSHA256The base64-encoded, 256-bit SHA-256 digest of the object. This will only be present if it was uploaded with the object.NoString
ChecksumTypeThe algorithm that was used to create the checksum for the object.NoString

Special Errors

Error CodeDescription
NoSuchBucketThe specified bucket does not exist
NoSuchKeyThe specified source object does not exist
InvalidRequestThe specified copy source is not supported
EntityTooLargeThe source object is too large to copy using a single operation
403Forbidden. Authentication failed or you do not have permission to copy the object

Examples

Example 1: Copy an object

PUT /destination.txt HTTP/1.1
Host: destination-bucket.qstorage.quilibrium.com
x-amz-copy-source: source-bucket/source.txt
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}"
<?xml version="1.0" encoding="UTF-8"?> <CopyObjectResult> <LastModified>2024-03-01T12:00:00.000Z</LastModified> <ETag>"7778aef83f66abc1fa1e8477f296d394"</ETag> </CopyObjectResult>
Values in italics indicate variable response values.

Example 2: Copy an object and replace its metadata

PUT /destination.txt HTTP/1.1
Host: destination-bucket.qstorage.quilibrium.com
x-amz-copy-source: source-bucket/source.txt
x-amz-metadata-directive: REPLACE
x-amz-meta-title: New Document
x-amz-meta-author: Jane Doe
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}"
<?xml version="1.0" encoding="UTF-8"?> <CopyObjectResult> <LastModified>2024-03-01T12:00:00.000Z</LastModified> <ETag>"7778aef83f66abc1fa1e8477f296d394"</ETag> </CopyObjectResult>
Values in italics indicate variable response values.

Try It Out

Test CopyObject

Create a copy of an existing object in QStorage.

Coming Soon

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