1

Below are the steps to reproduce using AWS Java API: 1. Create a Nodejs Lambda function 2. Create an SNS topic 3. Subscribe the SNS topic to the lambda function created using it's ARN

Now if we go to the Lambda function and look at the Event Sources tab, we don't see SNS topic listed as an event source. So the SNS doesn't trigger the Lambda function at all. Looks like an AWS issue to me.

P.S: The AWS user keys used to reproduce the above issue had blanket access (Admin Policy) attached. So it doesn't look like a permissions issue. If I repeat the above steps via AWS Console, the event source gets added properly into the Lambda function.

Has anyone encountered this issue before? How to resolve this? Or any workarounds.

1 Answer 1

1

You need to add permission for SNS to call Lambda. You can do this by calling the AddPermission Function.

Background: The Lambda SNS uses the Push Model to invoke Lambda. This means that SNS directly invokes your lambda function (similar to you calling invokeFunction from the Java SDK). The lambda IAM permission model requires that each caller be explicitly permitted to call the function.

This is different from the Lambda Kinesis event source, which uses a Pull Model (the lambda function runs and then pulls records from the Kinesis Stream).

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Ryan. Yes this is true. I later figured this out after skimming through their Developer Guide. Apparently we don't need to do this step when we create lambda functions from the AWS console. It does it behind the scenes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.