2
votes

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?

1
It does show. Please double check, maybe have to refresh your browser?Marcin

1 Answers

2
votes

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.