S3 Bucket Versioning
Bucket Versioning is an S3 Bucket sub-resource used to protect against accidental object/data deletion or overwrites.
Versioning can also be used for data retention and archiving.
Once you enable versioning on a bucket, it cannot be disabled, however, it can be suspended.
When enabled, bucket versioning will protect existing and new objects and maintains their versions as they are updated.
Updating objects refers to PUT, POST, COPY, and DELETE actions on objects.
When versioning is enabled, and you try to delete an object, a delete marker is placed on the object.
- You can still view the object and the delete marker.
If you reconsider deleting the objects you can delete the "Delete Marker" and the object will be available again.
You will be charged for all S3 storage costs for all object versions stored.
You can use Versioning with S3 Lifecycle policies to delete older versions, or you can move them to a cheaper S3 storage (or Glacier)
There are 3 Bucket Versioning State
- Enable
- Suspended
- Un-versioned
Once you enable the S3 bucket the un-versioned gets removed.
Versioning applies to all objects in a bucket and is not partially applied.
Object existing before enabling versioning will have a version ID or NULL.
If you have a bucket that is already versioned, then you suspend versioning, existing objects and their versions remain as it is.
- However, they will not be updated/versioned further with future updates while the bucket versioning is suspended.
New objects (uploaded after suspension) will have a Version ID "NULL" if the same key (name) is used to store another object, it will override the existing one.
An object deletion in a suspended versioning bucket will only delete the objects with ID "NULL".
MFA Delete in S3
Multifactor Authentication delete is a Versioning capacity that adds another level of security in case your account is compromised.
This adds another layer of security for the following
Changing your Bucket's versioning state.
Permanently deleting an object version.
MFA Delete Requires
Your security credentials
The code is displayed on an approved physical or software-based authentication device.
S3 Multipart Upload
It is used to upload an object in parts.
Parts are uploaded independently and in parallel, in any order.
It is recommended for object sizes of 100MB or larger.
You must use it for objects larger than 5GB.
This is done through S3 multipart upload API.
Copying S3 Objects
The Copy operation creates a copy of an object that is already stored in Amazon S3.
You can create a copy of your object up to 5GB in size for a Single atomic operation.
However, to copy an object greater than 5GB, you must use the multipart upload API.
Incur charges, if copied to another region.
One can use the Copy Operation to
Generate additional copies of the Subject.
Renaming object (copy to a new name)
Changing the copy's storage class or encrypting it at rest.
Move object across AWS location Region.
Change Object Metadata.