Copying Amazon S3 Objects

The copy operation enables you to copy objects within Amazon S3. Using the copy operation, you can:

[Note]Note

Copying objects across locations incurs bandwidth charges.

For more information about copy requests, see COPY Object for REST and CopyObject for SOAP.

Example

This example describes how to copy an object using REST.

This example copies the flotsam object from the pacific bucket to the jetsam object of the atlantic bucket, preserving its metadata.


PUT /jetsam HTTP/1.1

Host: atlantic.s3.amazonaws.com

x-amz-copy-source: /pacific/flotsam

Authorization: AWS 15B4D3461F177624206A:ENoSbxYByFA0UGLZUqJN5EUnLDg=

Date: Wed, 20 Feb 2008 22:12:21 +0000

The signature was generated from the following information.


PUT\r\n

\r\n

\r\n

Wed, 20 Feb 2008 22:12:21 +0000\r\n

x-amz-copy-source:/pacific/flotsam\r\n

/atlantic/jetsam

Amazon S3 returns the following response which specifies the etag of the object and when it was last modified.


HTTP/1.1 200 OK

x-amz-id-2: Vyaxt7qEbzv34BnSu5hctyyNSlHTYZFMWK4FtzO+iX8JQNyaLdTshL0KxatbaOZt

x-amz-request-id: 6B13C3C5B34AF333

Date: Date: Wed, 20 Feb 2008 22:13:01 +0000

Content-Type: application/xml

Transfer-Encoding: chunked

Connection: close

Server: AmazonS3



<?xml version="1.0" encoding="UTF-8"?>



<CopyObjectResult>

   <LastModified>2008-02-20T22:13:01</LastModified>

   <ETag>"7e9c608af58950deeb370c98608ed097"</ETag>

</CopyObjectResult>

Related Resources

Access Control Lists