Amazon MQ broker encryption key settings need review

Check Amazon MQ default storage encryption against organizational KMS key requirements.

Description

Amazon MQ always encrypts stored data. Omitting encryption_options uses an AWS owned key. Select a customer managed key for ActiveMQ if you need control over its policy or lifecycle.

Potential impact

Disabling the customer managed key or revoking a required grant can disrupt the broker. Check client permissions and transport protection separately.

Remediation

Set use_aws_owned_key = false and supply a symmetric KMS key ARN from the same Region in kms_key_id. Grant Amazon MQ the required access and check the Terraform plan for broker replacement. Create a broker with a distinct name. In its applied encryption settings, verify that the KMS key ID matches the selected key. Test sending and receiving at the new endpoint. Stop publishing to the old broker, drain or move its pending messages, then switch clients.

Examples

Replace the example ARN and resource references. Use an engine version and instance type supported in the Region. ActiveMQ 5.18 and later requires auto_minor_version_upgrade = true. Supply the password securely and restrict access to the Terraform state that holds it.

Default encryption key

hcl
resource "aws_mq_broker" "mq_broker" {
  broker_name = "example"

  configuration {
    id       = aws_mq_configuration.test.id
    revision = aws_mq_configuration.test.latest_revision
  }

  engine_type        = "ActiveMQ"
  engine_version     = var.activemq_engine_version
  host_instance_type = "mq.t2.micro"
  security_groups    = [aws_security_group.test.id]

  user {
    username = "ExampleUser"
    password = var.broker_password
  }
}

Customer managed key

hcl
resource "aws_mq_broker" "mq_broker" {
  broker_name = "example"

  configuration {
    id       = aws_mq_configuration.test.id
    revision = aws_mq_configuration.test.latest_revision
  }

  engine_type        = "ActiveMQ"
  engine_version     = var.activemq_engine_version
  host_instance_type = "mq.t2.micro"
  security_groups    = [aws_security_group.test.id]

  user {
    username = "ExampleUser"
    password = var.broker_password
  }

  encryption_options {
    kms_key_id        = "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
    use_aws_owned_key = false
  }
}

References