1
votes

I have created lambda and SNS using cloudformation. Here first lambda is invoking a SNS which has a subscription of another lambda. Here SNS is supposed to invoke alias of lambda. In SNS topic lambda ARN is showing as subscriber but in lambda it is not added as trigger. There is not a single invocation log of the lambda invoked from SNS. So is this problem about some kind of permission or else ? need help...

2

2 Answers

0
votes

Yes, this is a permissions issue. You need to add a permission to the lambda function to allow SNS to invoke it.

Use the AWS::Lambda::Permission resource to add permissions to allow SNS to invoke the lambda function.

0
votes

I had a heck of a time with one. I had originally set my lambda function to look for an event source of "aws:s3". In order to get the event source from an s3 event, I used "event.Records[0].eventSource". When I tested event.Records[0].eventSource == "aws:sns" to check if my SNS trigger had fired, it wouldn't work. It wasn't until I found sample SNS event JSON that I noticed that SNS events have an event source node of "EventSource". It's capital case. I changed my test to

event.Records[0].EventSource == "aws:sns" 

and it worked. So much for consistency in event message formats.