- Newest
- Most votes
- Most comments
Using a Customer Managed Key (CMK) from one AWS account to encrypt an SNS topic in another account, and then connecting CloudWatch Alarms to that encrypted SNS topic, is a complex scenario that requires careful configuration. Based on the information provided and the error you're encountering, there are a few key points to consider:
-
Cross-account key usage: It is possible to use a CMK from Account A to encrypt an SNS topic in Account B. However, this requires proper key policy configuration in Account A and appropriate permissions in Account B.
-
CloudWatch Alarms and encrypted SNS topics: CloudWatch Alarms can work with encrypted SNS topics, but they require specific permissions to access the encryption key.
-
The error message you're receiving ("CloudWatch Alarms does not have authorization to access the SNS topic encryption key") indicates that the CloudWatch service in Account B doesn't have the necessary permissions to use the CMK from Account A.
To resolve this issue, you need to focus on granting the correct permissions to the CloudWatch service in Account B to use the CMK from Account A. Here are some steps to try:
-
In the key policy of the CMK in Account A, ensure that you have a statement that explicitly allows the CloudWatch service from Account B to use the key. You should include permissions for "kms:GenerateDataKey*" and "kms:Decrypt" actions.
-
The policy should look something like this:
{ "Sid": "Allow CloudWatch in Account B to use the key", "Effect": "Allow", "Principal": { "Service": "cloudwatch.amazonaws.com" }, "Action": [ "kms:GenerateDataKey*", "kms:Decrypt" ], "Resource": "*", "Condition": { "StringEquals": { "aws:SourceAccount": "444555666" } } }
-
In Account B, make sure that the IAM role or user that CloudWatch Alarms is using has permissions to use the CMK from Account A. This might involve creating a new IAM policy in Account B that allows the use of the specific CMK ARN from Account A.
-
Double-check that the SNS topic's access policy in Account B allows CloudWatch to publish to it.
-
Ensure that all requests to the encrypted SNS topic are using HTTPS and Signature Version 4.
It's worth noting that while it's technically possible to set up this cross-account encryption scenario, it adds complexity and potential points of failure. If possible, consider using a CMK within the same account as the SNS topic and CloudWatch Alarms for simplicity and easier troubleshooting.
If you've tried all these steps and are still encountering issues, you may need to reach out to AWS Support for further assistance, as there could be account-specific configurations or limitations at play.
Sources
Configure a CloudWatch alarm with an encrypted SNS topic | AWS re:Post
Securing Amazon SNS data with server-side encryption - Amazon Simple Notification Service
Managing Amazon SNS encryption keys and costs - Amazon Simple Notification Service
Relevant content
- asked 2 years ago
