Search code examples
amazon-web-servicesamazon-cloudwatchamazon-sns

CloudWatch to SNS: how to set message attributes for SNS subscription filtering?


I have CloudWatch event rules targeting SNS. I want SNS subscriptions to use attributes filter policies, but can't figure out how to have CloudWatch set attributes. I'd like to avoid the overhead of Lambda setting attributes based on message body.


Solution

  • As of November 2022, you can filter CloudWatch events in SNS topics, via payload-based message filtering: https://aws.amazon.com/blogs/compute/introducing-payload-based-message-filtering-for-amazon-sns/

    That way, we don't need to have CloudWatch publish their events with attributes to SNS anymore. I hope this helps!