Description
Both alias/aws/sns and a customer managed key encrypt message bodies stored by SNS. Choose a customer managed key if you need to control its policy or lifecycle. AWS controls the policy for its managed key.
Potential impact
Missing key permissions can interrupt publishing or delivery. Keep the old key and its required permissions available while existing messages still need it.
Remediation
Set kms_master_key_id to the ARN or alias of a customer managed symmetric encryption key. Check publisher and service permissions in the topic and key policies, then test delivery to an actual subscriber. Protect message metadata and transport separately.
Examples
The examples also change the topic name. Keep the current name when changing only the key to avoid replacing the topic, and replace alias/MyAlias with the actual key alias.
AWS managed key
resource "aws_sns_topic" "example" {
name = "user-updates-topic"
kms_master_key_id = "alias/aws/sns"
}
Customer-managed key
resource "aws_sns_topic" "example" {
name = "sns_ecnrypted"
kms_master_key_id = "alias/MyAlias"
}