Bird
0
0

Given this Lambda trigger code snippet:

medium📝 Predict Output Q4 of 15
AWS - Lambda
Given this Lambda trigger code snippet:
event = {"Records": [{"eventSource": "aws:sqs", "body": "Hello"}]}

What will happen when this event is received by the Lambda function?
ALambda processes the message from the SQS queue
BLambda ignores the event because it's not from SNS
CLambda throws an error due to missing eventSourceArn
DLambda triggers another Lambda function automatically
Step-by-Step Solution
Solution:
  1. Step 1: Identify event source type

    The eventSource is 'aws:sqs', indicating the event is from an SQS queue.
  2. Step 2: Understand Lambda behavior on SQS events

    Lambda processes messages from SQS queues when triggered by such events.
  3. Final Answer:

    Lambda processes the message from the SQS queue -> Option A
  4. Quick Check:

    SQS event triggers Lambda processing = Lambda processes the message from the SQS queue [OK]
Quick Trick: SQS events have eventSource 'aws:sqs' and trigger Lambda processing [OK]
Common Mistakes:
MISTAKES
  • Assuming only SNS triggers Lambda
  • Expecting eventSourceArn is mandatory in event
  • Thinking Lambda auto-triggers other Lambdas

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes