Other Articles

SNS Topic – Enable Encryption

Secure Configuration Checks > AWS

This check ensures that every Amazon SNS topic is encrypted at rest with an AWS KMS key. Encryption protects the messages that SNS stores while it delivers them.

Check Details

  • Resource: SNS Topic
  • Check: Enable SNS topic encryption (EncryptionEnabled)
  • Risk: Sensitive messages are stored without a key you control

Key policy for AWS services

Add this statement to the policy of your customer managed key. Keep only the services that publish to the topic.

{
  "Sid": "AllowServicesToPublishToEncryptedTopic",
  "Effect": "Allow",
  "Principal": {
    "Service": [
      "cloudwatch.amazonaws.com",
      "events.amazonaws.com",
      "s3.amazonaws.com"
    ]
  },
  "Action": ["kms:GenerateDataKey*", "kms:Decrypt"],
  "Resource": "*"
}

Remediation via AWS Console

  1. Log in to the AWS Management Console and open the Amazon SNS console.

    Amazon SNS Console
  2. In the left navigation pane, click Topics and select the affected topic.
  3. Click Edit.

    SNS topic with the Edit button
  4. Expand Encryption and turn on Enable encryption. Choose an AWS managed key or a customer managed key.

    SNS encryption settings
  5. Click Save changes.
  6. Repeat steps 2 to 5 for every unencrypted topic.

Remediation via AWS CLI

  1. Log in to the AWS Management Console and click the CloudShell icon (>_) in the top-right corner.

    AWS CloudShell
  2. List the topics that have no KMS key:

    for ARN in $(aws sns list-topics \
      --query 'Topics[].TopicArn' --output text); do
      KEY=$(aws sns get-topic-attributes \
        --topic-arn "$ARN" \
        --query 'Attributes.KmsMasterKeyId' \
        --output text)
      if [ "$KEY" = "None" ]; then echo "$ARN"; fi
    done
    

    The command covers one region. Add --region <region> to each command to check another.

  3. Enable encryption on a topic:

    aws sns set-topic-attributes \
    --topic-arn <topic-arn> \
    --attribute-name KmsMasterKeyId \
    --attribute-value <kms-key>
    
  4. Verify the key on the topic:

    aws sns get-topic-attributes \
    --topic-arn <topic-arn> \
    --query 'Attributes.KmsMasterKeyId'
    

Replace <topic-arn> with the topic ARN, for example arn:aws:sns:us-east-1:123456789012:my-topic. Replace <kms-key> with alias/aws/sns, or with the ID, ARN or alias of your own key.

Updated on 04 November, 2026