1
votes

I am working on a task to create Email notifications for the Cloud-Formation stacks e.g. CREATE_COMPLETE, DELETE_COMPLETE. Currently using Cloud-Formation advance options to send Notifications by using SNS topic. I have created a SNS topic and configured my email as an endpoint with Protocol "Email". After attaching it with Cloud-Formation Stack, I am getting email notifications. Now I am getting approximately 50-60 emails during stack creation and deletion. I want to restrict these emails only for stack resource status as CREATE_COMPLETE, DELETE_COMPLETE.

I am trying to add filter policy in Topic Subscription but after setting filter policy as "FilterPolicy": {"ResourceStatus": ["CREATE_COMPLETE"]}, all the email notifications are blocked.

Does anyone has idea about how to setup the filter policy with SNS subscription to receive restricted email notifications for Cloud-Formation stack ?

Note: I have seen examples of using Lambda to restrict notifications but I don't want to use lambda function.

1

1 Answers

1
votes

As of now it’s not possible to filter the cloudformation notifications in a SNS topic using filter policy for email endpoint. When cloud-formation sends all the events to a SNS topic then SNS does not have any controls on the message text cloudforamtion is sending. SNS-filter policy needs key/value pair to filter out the incoming messages to the topic and then route to the Subscriptions i.e. SMS, EMail, Email-JSON and SQS. Currently, SNS supports filter policies to only SQS subscription endpoints.

I will recommend to use Cloudformation, SNS and Lambda to filter out the email notifications. Lambda also gives you an extra ability to select as many as strings to filter out the messages from code itself, which makes the filtering effective as per the requirements. Here is the link which shows how to restrict the cloudformation notifications using lambda functions. https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-rollback-email/