Amazon Simple Storage Service
API Reference (API Version 2006-03-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

POST Object restore

Description

Restores a temporary copy of an archived object. In the request, you specify the number of days that you want the restored copy to exist. After the specified period, Amazon S3 deletes the temporary copy. Note that the object remains archived; Amazon S3 deletes only the restored copy.

An object in the Glacier storage class is an archived object. To access the object, you must first initiate a restore request, which restores a copy of the archived object. Restore jobs typically complete in three to five hours.

For more information about archiving objects, go to Object Lifecycle Management in Amazon Simple Storage Service Developer Guide.

You can obtain restoration status by sending a HEAD request. In the response, these operations return the x-amz-restore header with restoration status information.

After restoring an object copy, you can update the restoration period by reissuing this request with the new period. Amazon S3 updates the restoration period relative to the current time.

You cannot issue another restore request when Amazon S3 is actively processing your first restore request; however, after Amazon S3 restores a copy of the object, you can send restore requests to update the expiration period of the restored object copy.

If your bucket has a lifecycle configuration with a rule that includes an expiration action, the object expiration overrides the life span that you specify in a restore request. For example, if you restore an object copy for 10 days but the object is scheduled to expire in 3 days, Amazon S3 deletes the object in 3 days. For more information about lifecycle configuration, see PUT Bucket lifecycle.

To use this action, you must have s3:RestoreObject permissions on the specified object. For more information, go to Access Control section in the Amazon S3 Developer Guide.

Requests

Syntax

POST /ObjectName?restore HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: signatureValue
Content-MD5: MD5

<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-3-01">
   <Days>NumberOfDays</Days>
</RestoreRequest> 

Note

The syntax shows some of the request headers. For a complete list, see the Request Headers section.

Request Parameters

This implementation of the operation does not use request parameters.

Request Headers

Name Description Required
Content-MD5

The base64-encoded 128-bit MD5 digest of the data. This header must be used as a message integrity check to verify that the request body was not corrupted in transit. For more information, go to RFC 1864.

Type: String

Default: None

Yes

Request Elements

Name Description
RestoreRequest

Container for restore information

Type: Container

Ancestors: AccessControlPolicy

Days

Lifetime of the restored (active) copy. The minimum number of days that you can restore an object from Amazon Glacier is 1. After the object copy reaches the specified lifetime, Amazon S3 removes the copy from the bucket.

Type: Positive integer

Ancestors: RestoreRequest

Responses

A successful operation returns either 200 OK or 202 Accepted status code.

  • If the object copy is not previously restored, then Amazon S3 returns 202 Accepted in the response.

  • If the object copy is previously restored, Amazon S3 returns 200 OK in the response.

Response Headers

This implementation of the operation uses only response headers that are common to most responses. For more information, see Common Response Headers.

Response Elements

This operation does not return response elements.

Special Errors

Error CodeDescriptionHTTP Status CodeSOAP Fault Code Prefix
RestoreAlreadyInProgressObject restore is already in progress. 409 ConflictClient

Examples

Restore an object for 2 days

The following restore request restores a copy of the photo1.jpg object from Amazon Glacier for a period of 2 days.

POST /photo1.jpg?restore HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Mon, 22 Oct 2012 01:49:52 GMT
Authorization: AWS AKIAIOSFODNN7EXAMPLE:xQE0diMbLRepdf3YB+FIEXAMPLE=
Content-Length: 53

<RestoreRequest>
  <Days>2</Days>
</RestoreRequest>

If the examplebucket does not have a restored copy of the object, Amazon S3 returns the following 202 Accepted response.

HTTP/1.1 202 Accepted
x-amz-id-2: GFihv3y6+kE7KG11GEkQhU7/2/cHR3Yb2fCb2S04nxI423Dqwg2XiQ0B/UZlzYQvPiBlZNRcovw=
x-amz-request-id: 9F341CD3C4BA79E0
Date: Sat, 20 Oct 2012 23:54:05 GMT
Content-Length: 0
Server: AmazonS3

If a copy of the object is already restored, Amazon S3 returns a 200 OK response, only updating the restored copy's expiry time.