

# Working with objects in a versioning-suspended bucket
Working with versioning-suspended objects

In Amazon S3, you can suspend versioning to stop accruing new versions of the same object in a bucket. You might do this because you only want a single version of an object in a bucket. Or, you might not want to accrue charges for multiple versions. 

When you suspend versioning, existing objects in your bucket do not change. What changes is how Amazon S3 handles objects in future requests. The topics in this section explain various object operations in a versioning-suspended bucket, including adding, retrieving, and deleting objects.

For more information about S3 Versioning, see [Retaining multiple versions of objects with S3 Versioning](Versioning.md). For more information about retrieving object versions, see [Retrieving object versions from a versioning-enabled bucket](RetrievingObjectVersions.md).

**Topics**
+ [

# Adding objects to versioning-suspended buckets
](AddingObjectstoVersionSuspendedBuckets.md)
+ [

# Retrieving objects from versioning-suspended buckets
](RetrievingObjectsfromVersioningSuspendedBuckets.md)
+ [

# Deleting objects from versioning-suspended buckets
](DeletingObjectsfromVersioningSuspendedBuckets.md)

# Adding objects to versioning-suspended buckets
Adding objects

You can add objects to versioning-suspended buckets in Amazon S3 to create the object with a null version ID or overwrite any object version with a matching version ID.

After you suspend versioning on a bucket, Amazon S3 automatically adds a `null` version ID to every subsequent object stored thereafter (using `PUT`, `POST`, or `CopyObject`) in that bucket.

The following figure shows how Amazon S3 adds the version ID of `null` to an object when it is added to a version-suspended bucket.

![\[Amazon S3 adding the version ID of null to an object graphic.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_PUT_versionSuspended.png)


If a null version is already in the bucket and you add another object with the same key, the added object overwrites the original null version. 

If there are versioned objects in the bucket, the version you `PUT` becomes the current version of the object. The following figure shows how adding an object to a bucket that contains versioned objects does not overwrite the object already in the bucket. 

In this case, version 111111 was already in the bucket. Amazon S3 attaches a version ID of null to the object being added and stores it in the bucket. Version 111111 is not overwritten.

![\[Amazon S3 adding the version ID of null to an object without overwriting version 111111 graphic.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_PUT_versionSuspended3.png)


If a null version already exists in a bucket, the null version is overwritten, as shown in the following figure.

![\[Amazon S3 adding the version ID of null to an object while overwriting the original contents graphic.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_PUT_versionSuspended4.png)


Although the key and version ID (`null`) of the null version are the same before and after the `PUT`, the contents of the null version originally stored in the bucket are replaced by the contents of the object `PUT` into the bucket.

# Retrieving objects from versioning-suspended buckets
Retrieving objects

A `GET Object` request returns the current version of an object whether you've enabled versioning on a bucket or not. The following figure shows how a simple `GET` returns the current version of an object.

![\[Illustration that shows how a simple GET returns the current version of an object.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_GET_suspended.png)


# Deleting objects from versioning-suspended buckets
Deleting objects

You can delete objects from versioning-suspended buckets to remove an object with a null version ID.

If versioning is suspended for a bucket, a `DELETE` request:
+ Can only remove an object whose version ID is `null`.
+ Doesn't remove anything if there isn't a null version of the object in the bucket.
+ Inserts a delete marker into the bucket.

If bucket versioning is suspended, the operation removes the object that has a null `versionId`. If a version ID exists, Amazon S3 inserts a delete marker that becomes the current version of the object. The following figure shows how a simple `DELETE` removes a null version and Amazon S3 inserts a delete marker in its place instead with a `null` version ID.

![\[Illustration that shows a simple delete to remove an object with a NULL version ID.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_DELETE_versioningSuspended.png)


To permanently delete an object that has a `versionId`, you must include the object’s `versionId` in the request. Since a delete marker doesn't contain any content, you'll lose the content for the `null` version when a delete marker replaces it.

The following figure shows a bucket that doesn't have a null version. In this case, the `DELETE` removes nothing. Instead, Amazon S3 just inserts a delete marker.

![\[Illustration that shows a delete marker insertion.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_DELETE_versioningSuspendedNoNull.png)


Even in a versioning-suspended bucket, the bucket owner can permanently delete a specified version by including the version ID in the `DELETE` request, unless permissions for the `DELETE` request have been explicitly denied. For example, to deny deletion of any objects that have a `null` version ID, you must explicitly deny the `s3:DeleteObject` and `s3:DeleteObjectVersions` permissions.

The following figure shows that deleting a specified object version permanently removes that version of the object. Only the bucket owner can delete a specified object version.

![\[Illustration that shows a permanent object deletion using a specified version ID.\]](http://docs.aws.amazon.com/AmazonS3/latest/userguide/images/versioning_DELETE_versioningEnabled2.png)
