- Newest
- Most votes
- Most comments
Hello, I think you also need to edit SNS Access Policy, to allow all other accounts. Ref. Link:- https://docs.aws.amazon.com/sns/latest/dg/sns-access-policy-use-cases.html
To trigger an encrypted SNS topic from Cloudwatch Alarm, you need additionally "kms:DescribeKey" permission in the Key policy which is missing in your policy.
{
"Sid": "Allow Log Archive, Audit and Development Account",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::xxxxxxxxx:root",
"arn:aws:iam::xxxxxxxxx:root",
"arn:aws:iam::xxxxxxxx:root"
]
},
"Action": [
"kms:GenerateDataKey",
"kms:Decrypt",
"kms:DescribeKey"
],
"Resource": "*"
},
{
"Sid": "Allow_CloudWatch_for_CMK",
"Effect": "Allow",
"Principal": {
"Service":[
"cloudwatch.amazonaws.com"
]
},
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey",
"kms:DescribeKey"
],
"Resource": "*"
}
FYI - We cannot use AWS default key to encrypt the topic with this use case, so when we want to trigger an encrypted SNS topic, we have to use custom key with the policy permission described in the above KMS policy
Hello,
For CloudWatch alarms to trigger an encrypted SNS topic using customer managed key, you need to add the "" wild card in the "kms:GenerateDataKey" as "kms:GenerateDataKey" to allow other actions such as "kms:GenerateDataKeyPair". It is this missed portion of the policy forced the API call to generate error. Also notice that, the default AWS KMS key for SNS doesn't allow CloudWatch alarms to perform "kms:Decrypt" and "kms:GenerateDataKey" API calls.
{ "Sid": "Allow_CloudWatch_for_CMK", "Effect": "Allow", "Principal": { "Service":[ "cloudwatch.amazonaws.com" ] }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey*" ], # better use your SNS topic ARN instead of "" in the resource section "Resource": "" }
References [1] CloudWatch Alarm Trigger and SNS topic: https://repost.aws/knowledge-center/cloudwatch-receive-sns-for-alarm-trigger [2] Customer managed key: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk
Relevant content
- asked a year ago
- asked 5 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 4 months ago
Hi Manish, SNS topic is in the local account (same account as cloudwatch alarms). Hence it doesn't require policy to allow other accounts.