

# `AWSSupportRemediator-EnableSnsEncryptionAtRest`

**Description**

Enables server-side encryption (SSE) for an Amazon Simple Notification Service (Amazon SNS) topic using an Amazon Key Management Service (Amazon KMS) key.

This automation remediates findings identified by Amazon Well-Architected Agent. It remediates findings from Amazon Security Hub CSPM control [SNS topics should be encrypted at-rest using Amazon KMS](https://docs.amazonaws.cn/securityhub/latest/userguide/sns-controls.html#sns-1).

If the Amazon SNS topic does not exist or server-side encryption (SSE) is already enabled, the automation completes successfully without making changes.

The automation sets the `KmsMasterKeyId` attribute on the Amazon SNS topic to the specified Amazon KMS key. To roll back the change, set `KmsMasterKeyId` to the value of `validateTopic.InitialKmsKey` (or to an empty string if `InitialKmsKey` is `N/A`) by calling the `SetTopicAttributes` API.

After enabling server-side encryption (SSE), subscribers and publishers must have `kms:GenerateDataKey` and `kms:Decrypt` permissions on the specified Amazon KMS key. If the Amazon KMS key policy does not grant these permissions to the subscriber's IAM principal, message delivery can fail.

This requirement applies to cross-account subscribers and Amazon service subscribers such as Amazon Lambda, Amazon Simple Queue Service (Amazon SQS), and HTTPS endpoints. Review subscriber and Amazon KMS key permissions before running this automation. For more information, see [Enabling server-side encryption (SSE) for an Amazon SNS topic](https://docs.amazonaws.cn/sns/latest/dg/sns-enable-encryption-for-topic.html).

Using a customer managed Amazon KMS key to encrypt an Amazon SNS topic incurs Amazon KMS charges for each publish, subscribe, and management call. For more information about pricing, see [Amazon KMS pricing](https://www.amazonaws.cn/kms/pricing/).

**Important considerations**  
You are responsible for reviewing automation actions before they run.
This automation might cause stack drift if the resource is part of an Amazon CloudFormation stack.
Access to `AWSSupportRemediator-*` runbooks requires an active Business Support\+, Enterprise Support, or Unified Operations Support plan. For more information, see [Compare Amazon Web Services Support Plans](https://www.amazonaws.cn/premiumsupport/plans/) on the Amazon website.

**Document type**

Automation

**Owner**

Amazon

**Platforms**

Linux, macOS, Windows

**Parameters**
+ AutomationAssumeRole

  Type: String

  Description: (Optional) The Amazon Resource Name (ARN) of the Amazon Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses the permissions of the user that starts this runbook.
+ TopicArn

  Type: String

  Description: (Required) The Amazon Resource Name (ARN) of the Amazon SNS topic on which to enable server-side encryption (SSE).
+ KmsKeyId

  Type: String

  Description: (Optional) The Amazon KMS key ID, multi-region key ID, or key alias to use for server-side encryption (SSE) on the Amazon SNS topic.

  Default: alias/aws/sns

**Required IAM permissions**

The `AutomationAssumeRole` parameter requires the following actions to use the runbook successfully.
+ `sns:GetTopicAttributes`
+ `sns:SetTopicAttributes`

**Document Steps**

1. **validateTopic** - Validates that the Amazon SNS topic exists and checks whether server-side encryption (SSE) is already enabled.

1. **branchOnChangeRequired** - Branches on whether to enable server-side encryption (SSE) on the Amazon SNS topic.

1. **enableSNSSSE** - Enables server-side encryption (SSE) on the Amazon SNS topic using the specified Amazon KMS key.

**Outputs**
+ validateTopic.ChangeRequired: Whether to enable server-side encryption (SSE) on the Amazon SNS topic.
+ validateTopic.InitialKmsKey: The Amazon KMS key ID configured on the Amazon SNS topic before execution, or `N/A` if the Amazon SNS topic does not have server-side encryption (SSE) configured.
+ validateTopic.ValidationMessage: A message describing the validation result.