Review customer-managed keys for an Alicloud OSS bucket

Use a customer-managed key when separate key control is required.

Description

With AES256, OSS encrypts objects using OSS-managed keys. Choose a customer-managed KMS key if your organization must control key access and rotation.

Potential impact

Changing the bucket default affects new writes. Existing objects keep their current encryption.

Remediation

Set sse_algorithm = "KMS", supply the approved key from the bucket’s region as kms_master_key_id, and grant the necessary key permissions. Check the key on a newly uploaded object. Migrate older objects separately if they must use that key.

Examples

Before

hcl
resource "alicloud_oss_bucket" "bucket" {
  bucket = "bucket-170309-sserule"
  acl    = "private"

  server_side_encryption_rule {
    sse_algorithm = "AES256"
  }
}

After

hcl
resource "alicloud_oss_bucket" "bucket" {
  bucket = "bucket-170309-sserule"
  acl    = "private"

  server_side_encryption_rule {
    sse_algorithm     = "KMS"
    kms_master_key_id = var.kms_key_id
  }
}

References