Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SNS subcriptions vs triggers on lambda function?

I have a question regarding the relationship between Lambda functions and Amazon SNS as a service.

In SNS you create subscriptions to a topic, one being a Lambda function. In my head I'd imagine this is to invoke and trigger the function when a message is sent out from that topic. But on the Lambda side you can create triggers to do that same thing, one of them being SNS.

What exactly is the difference, it kinda seems like they do the same thing. But if I create a subscription for a topic using a Lambda, it does not show up in the the triggers of the function in the Lambda services, which makes me wonder what exactly is the difference between these two?

like image 369
apaulino Avatar asked Jun 23 '26 13:06

apaulino


1 Answers

What exactly is the difference?

There is no difference from the functional point of view. What you are observing are just console imperfections.

To make sure, I manually verified using my SNS and my lambda function.

When you use Create subscription in the SNS console, and add a lambda function, it does show up as a trigger in lambda console.

Similarly, if you use lambda console and add SNS trigger, you will find the function in the Subscriptions section of SNS console.

However, AWS console is not perfect. For example, if you remove the lambda function from Subscriptions, it will not remove it from triggers on lambda console. Instead you will see the following error:

enter image description here

For some this may be a bug, for others a feature. I learned not to rely heavily on what AWS console shows. Just double check if the subscription works or not.

like image 106
Marcin Avatar answered Jun 25 '26 05:06

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!