Copying Amazon S3 Objects

[Important]Important

This section describes Beta functionality that is subject to change in future releases. Please provide feedback on this functionality in the Amazon S3 Developer Forum.

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

  • Create additional copies of objects
  • Rename objects by copying them and deleting the original ones
  • Update object metadata by copying original objects to new ones that contain new metadata
[Note]Note

During the copy beta period, you cannot copy objects across Amazon S3 locations.

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

This example describes how to copy an object using REST.

Following is a request that copies the content of the "flotsam" key from the pacific bucket to the "jetsam" key 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>

Access Control Lists