Versioning enables you to keep multiple versions of an object in one bucket, for example,
my-image.jpg (version 111111) and
(version 222222). You might want to enable versioning to protect yourself from
unintended overwrites and deletions or to archive objects so that you can retrieve previous
versions of them.
The SOAP API does not support versioning. SOAP support over HTTP is deprecated, but it is still available over HTTPS. New Amazon S3 features will not be supported for SOAP.
Object versioning can be used in combination with Object Lifecycle Management, allowing you to customize your data retention needs while controlling your related storage costs. For more information about adding lifecycle configuration to versioning-enabled buckets using the AWS Management Console, see Lifecycle Configuration for a Bucket with Versioning in the Amazon Simple Storage Service Console User Guide.
If you have an object expiration lifecycle policy in your non-versioned bucket and you want to maintain the same permanent delete behavior when you enable versioning, you must add a noncurrent expiration policy. The noncurrent expiration lifecycle policy will manage the deletes of the noncurrent object versions in the version-enabled bucket. (A version-enabled bucket maintains one current and zero or more noncurrent object versions.)
You must explicitly enable versioning on your bucket. By default, versioning is disabled. Regardless of whether you have enabled versioning, each object in your bucket has a version ID. If you have not enabled versioning, then Amazon S3 sets the version ID value to null. If you have enabled versioning, Amazon S3 assigns a unique version ID value for the object. When you enable versioning on a bucket, existing objects, if any, in the bucket are unchanged: the version IDs (null), contents, and permissions remain the same.
Enabling and suspending versioning is done at the bucket level. When you enable versioning
for a bucket, all objects added to it will have a unique version ID. Unique version IDs are
randomly generated, Unicode, UTF-8 encoded, URL-ready, opaque strings that are at most 1024
bytes long. An example version ID is
3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo. Only Amazon S3
generates version IDs. They cannot be edited.
For simplicity, we will use much shorter IDs in all our examples.
PUT an object in a versioning-enabled bucket, the noncurrent
version is not overwritten. The following figure shows that when a new version of
PUT into a bucket that already
contains an object with the same name, the original object (ID = 111111) remains in the
bucket, Amazon S3 generates a new version ID (121212), and adds the newer version to the
This functionality prevents you from accidentally overwriting or deleting objects and affords you the opportunity to retrieve a previous version of an object.
DELETE an object, all versions remain in the bucket and Amazon S3
inserts a delete marker, as shown in the following figure.
The delete marker becomes the current version of the object. By default,
GET requests retrieve the most recently stored version. Performing a
GET Object request when the current version is a delete marker
404 Not Found error, as shown in the following figure.
You can, however,
GET a noncurrent version of an object by specifying
its version ID. In the following figure, we
GET a specific object
version, 111111. Amazon S3 returns that object version even though it's not the current
You can permanently delete an object by specifying the version you want to delete. Only
the owner of an Amazon S3 bucket can permanently delete a version. The following figure shows how
DELETE versionId permanently deletes an object from a bucket and that
Amazon S3 doesn't insert a delete marker.
You can add additional security by configuring a bucket to enable MFA (Multi-Factor Authentication) Delete. When you do, the bucket owner must include two forms of authentication in any request to delete a version or change the versioning state of the bucket. For more information, see MFA Delete.
For more information, see Using Versioning.