Ensure S3 bucket has cross-region replication enabled

Error: S3 bucket cross-region replication disabled

Bridgecrew Policy ID: BC_AWS_GENERAL_72
Checkov Check ID: CKV_AWS_144
Severity: LOW

S3 bucket cross-region replication disabled

Description

Cross-region replication enables automatic, asynchronous copying of objects across S3 buckets. By default, replication supports copying new S3 objects after it is enabled. It is also possible to use replication to copy existing objects and clone them to a different bucket, but in order to do so, you must contact AWS Support.

Fix - Buildtime

Terraform

  • Resource: aws_s3_bucket
  • Argument: replication_configuration
resource "aws_s3_bucket" "test" {
  ...
+  replication_configuration {
+    role = aws_iam_role.replication.arn
+    rules {
+      id     = "foobar"
+      prefix = "foo"
+      status = "Enabled"
+
+      destination {
+        bucket        = aws_s3_bucket.destination.arn
+        storage_class = "STANDARD"
+      }
+    }
+  }
}

Did this page help you?