Adding objects to versioning-enabled buckets - Amazon Simple Storage Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Adding objects to versioning-enabled buckets

After 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.

Note

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

For more information about versioning, see Using versioning in S3 buckets. You can add object versions to a versioning-enabled bucket using the console, Amazon SDKs, and REST API.

For instructions, see Uploading objects.

For examples of uploading objects using the Amazon 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 Amazon SDKs, see the Amazon Developer Center.

To add objects to versioning-enabled buckets

  1. Enable versioning on a bucket using a PutBucketVersioning request.

    For more information, see PutBucketVersioning in the Amazon Simple Storage Service API Reference.

  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, as shown in the following example.

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