Search code examples
amazon-web-servicesamazon-sns

how to send AWS sns notification to specific user?


I have a requirement where I will fetch a list of users from an AWS account. Let's say I have 10 users in the account. All of the 10 users are subscribed to one SNS topic. Out of 10 users, 4 users need to get a notification to rotate their credentials via email.

how can I achieve that using SNS and python? I just need to know the SNS part where I need to filter like SNS will send a notification to only 4 users


Solution

  • You could create a lambda and subscribe it to your topic instead of subscribing individuals. Then in the lambda, you can do the filtering with your own custom logic and then use SES to email only the users that you need to notify. One consideration is that the domains or email addresses that you send email from must be verified in SES before they are usable.

    So this answer uses SNS, Python, lambda, and SES.

    See