Bird
0
0

An AWS SNS subscription to a Lambda function is not triggering the function. The subscription code is:

medium📝 Debug Q7 of 15
AWS - SNS and SQS
An AWS SNS subscription to a Lambda function is not triggering the function. The subscription code is:
sns.subscribe({ Protocol: 'lambda', Endpoint: 'arn:aws:lambda:region:account-id:function:myFunction' });
What is a possible cause?
ALambda function policy does not allow SNS invocation
BProtocol 'lambda' is not supported
CEndpoint ARN is incorrect format for Lambda
DSNS topics cannot trigger Lambda functions
Step-by-Step Solution
Solution:
  1. Step 1: Verify Lambda permissions for SNS

    Lambda functions must have a resource policy allowing SNS to invoke them.
  2. Step 2: Identify missing permission as cause

    If the policy is missing or incorrect, SNS cannot trigger the Lambda function despite correct subscription.
  3. Final Answer:

    Lambda function policy does not allow SNS invocation -> Option A
  4. Quick Check:

    Lambda needs invoke permission from SNS [OK]
Quick Trick: Add SNS invoke permission to Lambda policy to enable triggers [OK]
Common Mistakes:
MISTAKES
  • Thinking 'lambda' protocol is invalid
  • Incorrect ARN format
  • Believing SNS can't trigger Lambda

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes