MDAA TS Docs
    Preparing search index...
    • Grants the CloudWatch alarm service principal what it needs to publish alarm notifications to an SNS topic: sns:Publish on the topic and, when the topic is CMK-encrypted, kms:Decrypt + kms:GenerateDataKey* on the key.

      Both grants carry aws:SourceAccount and aws:SourceArn conditions to prevent the confused-deputy problem, so the CloudWatch service principal may only act on behalf of alarms in this account and region matching alarmNamePattern.

      The KMS grant is required for CloudWatch to publish to a CMK-encrypted topic at all

      NOTE: unlike the EventBridge-to-encrypted-topic case, conditions here are both supported and correct. AWS documents that aws:SourceAccount / aws:SourceArn / aws:SourceOrgID are not supported in a KMS policy for EventBridge delivery, so do not copy this conditioning onto an EventBridge grant - the KMS request does not carry those keys and every notification would be dropped silently.

      Because the conditions match on an alarm name pattern rather than on full alarm ARNs, this can be called before the alarms are constructed. That ordering matters: the alarms take the topic ARN as their action, so granting after the fact would introduce a circular dependency.

      Parameters

      • scope: Construct

        Construct scope used to resolve the stack account and region

      • props: GrantCloudWatchAlarmsTopicAccessProps

        The topic, optional key, and alarm name pattern to scope the grants to

      Returns void