我正在尝试创建 SNS 订阅过滤策略。我希望此过滤策略仅当 s3 存储桶的 cloudformation 资源状态为“CREATE_IN_PROGRESS”时才向用户发送消息,并且所有其他 cloudformation 资源创建事件不应发送给用户。任何有为 Cloudformation 事件创建 SNS 订阅过滤器策略经验的人都可以提供帮助吗?我只希望用户仅在 ResourceType='AWS::S3::Bucket' 的 ResourceStatus='CREATE_IN_PROGRESS' 且存储桶是逻辑资源时收到通知Id='TestBucket'
'
最佳答案
我认为这行不通。
来自Amazon SNS subscription filter policies - Amazon Simple Notification Service :
A subscription filter policy allows you to specify attribute names and assign a list of values to each attribute name... Each attribute name in a filter policy matches an attribute name assigned to the message.
当 AWS CloudFormation 发送事件时,它们会作为 JSON block 发送。单个元素(例如状态、存储桶名称)不会作为 Amazon SNS 消息属性发送。因此,规则将无法检测到这些值。
另一种方法是编写一个 AWS Lambda 函数来解析消息并做出相应响应。
关于amazon-web-services - 如何创建 SNS 订阅过滤策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67943448/