Retrieving object versions - Amazon Simple Storage Service

This guide is no longer being updated. For current information and instructions, see the new Amazon S3 User Guide.

Retrieving object versions

A simple GET request retrieves the current version of an object. The following figure shows how GET returns the current version of the object, photo.gif.

To retrieve a specific version, you have to specify its version ID. The following figure shows that a GET versionId request retrieves the specified version of the object (not necessarily the current one).

Using the console

For instructions see, How Do I See the Versions of an S3 Object? in the Amazon Simple Storage Service Console User Guide.

Using the AWS SDKs

For examples of uploading objects using AWS SDKs for Java, .NET, and PHP, see Getting objects. The examples for uploading objects in a nonversioned and versioning-enabled buckets are the same, although in the case of versioning-enabled buckets, Amazon S3 assigns a version number. Otherwise, the version number is null.

For information about using other AWS SDKs, see Sample Code and Libraries.

Using REST

To retrieve a specific object version

  1. Set versionId to the ID of the version of the object you want to retrieve.

  2. Send a GET Object versionId request.

Example Retrieving a versioned object

The following request retrieves version L4kqtJlcpXroDTDmpUMLUo of my-image.jpg.

GET /my-image.jpg?versionId=L4kqtJlcpXroDTDmpUMLUo HTTP/1.1 Host: Date: Wed, 28 Oct 2009 22:32:00 GMT Authorization: AWS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=

Retrieving the metadata of an object version