Skip to content

AWS S3 object versioning is disabled

Description

S3 versioning is a managed data backup and recovery service provided by AWS. When enabled it allows users to retrieve and restore previous versions of their buckets.

S3 versioning can be used for data protection and retention scenarios such as recovering objects that have been accidentally/intentionally deleted or overwritten.

Fix - Runtime

AWS Console

To change the policy using the AWS Console, follow these steps:

  1. Log in to the AWS Management Console at https://console.aws.amazon.com/.
  2. Open the Amazon S3 console.
  3. Select the bucket that you want to configure.
  4. Select the Properties tab.
  5. Navigate to the Permissions section.
  6. Select Edit bucket policy. If the selected bucket does not have an access policy, click Add bucket policy.
  7. Select the Versioning tab from the Properties panel, and expand the feature configuration section.
  8. To activate object versioning for the selected bucket, click Enable Versioning, then click OK. The feature status should change to versioning is currently enabled on this bucket.

Fix - Buildtime

Terraform

Resource: aws_s3_bucket, aws_s3_bucket_versioning

go aws_s3_bucket.state_bucket.tf + resource "aws_s3_bucket_versioning" "example" { + bucket = aws_s3_bucket.example.id + + versioning_configuration { + status = "Enabled" + } + }