Enable and suspend object versioning in Lightsail - Amazon Lightsail

Enable and suspend object versioning in Lightsail

Versioning in Amazon Lightsail object storage service is a means of keeping multiple variants of an object in the same bucket. You can use the versioning feature to preserve, retrieve, and restore every version of every object stored in your buckets. With versioning, you can recover more easily from both unintended user actions and application failures. When you enable versioning for a bucket, if the Lightsail object storage service receives multiple write requests for the same object simultaneously, it stores all of those objects. Versioning is disabled by default on buckets in the Lightsail object storage service, so you must explicitly enable it. For more information about buckets, see Object storage.

Important

When you enable or suspend versioning on a bucket that has the Individual objects can be made public (read-only) access permission configured, the permission resets to All objects are private. If you want to continue having the option to make individual objects public, you must manually change the bucket access permission back to Individual objects can be made public (read-only). For more information, see Configure bucket access permissions.

Version disabled, enabled, and suspended buckets

Bucket versioning can be in one of three states in the Lightsail console:

  • Disabled (NeverEnabled in the API and SDKs)

  • Enabled (Enabled in the API and SDKs)

  • Suspended (Suspended in the API and SDKs)

After you enable versioning in a bucket, it cannot return to a disabled state. But you can suspend versioning. You enable and suspend versioning at the bucket level.

The versioning state applies to all (not some) of the objects in that bucket. When you enable versioning in a bucket, all new objects are versioned and given a unique version ID. Objects that already exist in the bucket when versioning is enabled are always versioned going forward. They are given a unique version ID when they are modified by future requests.

Version IDs

If you enable versioning for a bucket, the Lightsail object storage service automatically generates a unique version ID for the object that is being stored. For example, in one bucket you can have two objects with the same key but different version IDs, such as photo.gif (version 111111) and photo.gif (version 121212).

Bucket versioning enabled

Version IDs cannot be edited. They are Unicode, UTF-8 encoded, URL-ready, opaque strings that are no more than 1,024 bytes long. The following is an example of a version ID:

3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo

Enable or suspend object versioning using the Lightsail console

Complete the following procedure to enable or suspend object versioning using the Lightsail console.

  1. Sign in to the Lightsail console.

  2. In the left navigation pane, choose Storage.

  3. Choose the name of the bucket for which you want to enable or suspend versioning.

  4. Choose the Versioning tab.

  5. Complete one of the following actions depending on the current versioning state of your bucket:

    • If versioning is currently suspended or has not been enabled, choose the toggle under the Object versioning section of the page to enable versioning.

    • If versioning is currently enabled, choose the toggle under the Object versioning section of the page to suspend versioning.

Enable or suspend object versioning using the AWS CLI

Complete the following procedure to enable or suspend object versioning using the AWS Command Line Interface (AWS CLI). You do this by using the update-bucket command. For more information, see update-bucket in the AWS CLI Command Reference.

Note

You must install the AWS CLI and configure it for Lightsail and Amazon S3 before continuing with this procedure. For more information, see Configure the AWS CLI to work with Lightsail.

  1. Open a Command Prompt or Terminal window.

  2. Enter the following command to enable or suspend object versioning.

    aws lightsail update-bucket --bucket-name BucketName --versioning VersioningState

    In the command, replace the following example text with your own:

    • BucketName - The name of the bucket for which you want to enable object versioning.

    • VersioningState - One of the following:

      • Enabled - Enables object versioning.

      • Suspended - Suspends object versioning if it was previously enabled.

    Example:

    aws lightsail update-bucket --bucket-name amzn-s3-demo-bucket --versioning Enabled

    You should see a result similar to the following example:

    Response to the update bucket request

Manage buckets and objects

These are the general steps to manage your Lightsail object storage bucket:

  1. Learn about objects and buckets in the Amazon Lightsail object storage service. For more information, see Object storage in Amazon Lightsail.

  2. Learn about the names that you can give your buckets in Amazon Lightsail. For more information, see Bucket naming rules in Amazon Lightsail.

  3. Get started with the Lightsail object storage service by creating a bucket. For more information, see Creating buckets in Amazon Lightsail.

  4. Learn about security best practices for buckets and the access permissions that you can configure for your bucket. You can make all objects in your bucket public or private, or you can choose to make individual objects public. You can also grant access to your bucket by creating access keys, attaching instances to your bucket, and granting access to other AWS accounts. For more information, see Security Best Practices for Amazon Lightsail object storage and Understanding bucket permissions in Amazon Lightsail.

    After learning about bucket access permissions, see the following guides to grant access to your bucket:

  5. Learn how to enable access logging for your bucket, and how to use access logs to audit the security of your bucket. For more information, see the following guides.

  6. Create an IAM policy that grants a user the ability to manage a bucket in Lightsail. For more information, see IAM policy to manage buckets in Amazon Lightsail.

  7. Learn about the way that objects in your bucket are labeled and identified. For more information, see Understanding object key names in Amazon Lightsail.

  8. Learn how to upload files and manage objects in your buckets. For more information, see the following guides.

  9. Enable object versioning to preserve, retrieve, and restore every version of every object stored in your bucket. For more information, see Enabling and suspending object versioning in a bucket in Amazon Lightsail.

  10. After enabling object versioning, you can restore previous versions of objects in your bucket. For more information, see Restoring previous versions of objects in a bucket in Amazon Lightsail.

  11. Monitor the utilization of your bucket. For more information, see Viewing metrics for your bucket in Amazon Lightsail.

  12. Configure an alarm for bucket metrics to be notified when the utilization of your bucket crosses a threshold. For more information, see Creating bucket metric alarms in Amazon Lightsail.

  13. Change the storage plan of your bucket if it's running low on storage and network transfer. For more information, see Changing the plan of your bucket in Amazon Lightsail.

  14. Learn how to connect your bucket to other resources. For more information, see the following tutorials.

  15. Delete your bucket if you're no longer using it. For more information, see Deleting buckets in Amazon Lightsail.