Amazon Simple Storage Service
Developer Guide (API Version 2006-03-01)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Adding Objects to Versioning-Enabled Buckets

Once you enable versioning on a bucket, Amazon S3 automatically adds a unique version ID to every object stored (using PUT, POST, or COPY) in the bucket.

The following figure shows that Amazon S3 adds a unique version ID to an object when it is added to a versioning-enabled bucket.

Using the Console

For instructions, see How Do I Upload an Object to an S3 Bucket? in the Amazon Simple Storage Service Console User Guide.

Using the AWS SDKs

For examples of uploading objects using the AWS SDKs for Java, .NET, and PHP, see Uploading Objects. The examples for uploading objects in 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 the REST API

Adding Objects to Versioning-Enabled Buckets

1 Enable versioning on a bucket using a PUT Bucket versioning request. For more information, see PUT Bucket versioning.
2 Send a PUT, POST, or COPY request to store an object in the bucket.

When you add an object to a versioning-enabled bucket, Amazon S3 returns the version ID of the object in the x-amz-version-id response header, for example:

x-amz-version-id: 3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY


Normal Amazon S3 rates apply for every version of an object stored and transferred. Each version of an object is the entire object; it is not just a diff from the previous version. Thus, if you have three versions of an object stored, you are charged for three objects.


The version ID values that Amazon S3 assigns are URL safe (can be included as part of a URI).