Skip to Content

Getting Started with Serverless: Understand Lambda Invocation Models for Serverless Architecture

Learn about the different ways AWS Lambda functions can be triggered, including polling and push models used by services like SQS, DynamoDB, Alexa, API Gateway, and S3.

Table of Contents

Question

Which of the following statements about invocation models are correct? (Select THREE.)

A. Amazon SQS triggers Lambda using the polling invocation model.
B. DynamoDB must have an execution role to invoke Lambda.
C. When Alexa is the event source, Lambda makes three attempts to invoke the function before putting the failed invocation into the dead letter queue (DLQ).
D. Amazon API Gateway triggers Lambda synchronously.
E. Amazon S3 triggers Lambda through an asynchronous push.

Answer

A. Amazon SQS triggers Lambda using the polling invocation model.
D. Amazon API Gateway triggers Lambda synchronously.
E. Amazon S3 triggers Lambda through an asynchronous push.

Explanation

Amazon S3 triggers Lambda through an asynchronous push. Amazon API Gateway triggers Lambda synchronously, and Amazon SQS triggers Lambda using the polling invocation model. Alexa is a synchronous event source, so Lambda will not attempt to retry the invocation.

The correct statements about Lambda invocation models are:

A. Amazon SQS triggers Lambda using the polling invocation model.
SQS (Simple Queue Service) invokes Lambda functions using a polling model. Lambda polls the SQS queue periodically and invokes the function when messages are available in the queue for processing.

D. Amazon API Gateway triggers Lambda synchronously.
API Gateway invokes Lambda functions synchronously, meaning it waits for the Lambda function to process the request and return a response before sending the response back to the client. This allows API Gateway to act as the “front door” for Lambda.

E. Amazon S3 triggers Lambda through an asynchronous push.
S3 (Simple Storage Service) invokes Lambda asynchronously via a push model. When an event like an object creation or deletion occurs in an S3 bucket, S3 can be configured to push an event notification to Lambda, triggering the function asynchronously.

The other two statements are incorrect:

B is incorrect because DynamoDB does not need an execution role to invoke Lambda. The Lambda function itself needs permission to access DynamoDB.

C is incorrect. When Alexa invokes a Lambda function, it will retry twice (so a total of 3 attempts) if the function returns an error or times out. However, failed Alexa skill invocations do not get sent to a dead letter queue.

In summary, AWS Lambda can be triggered through both polling and push invocation models, synchronously or asynchronously, by a variety of event sources like SQS, API Gateway, S3, and more. Understanding these invocation models is key for designing serverless architectures.

Getting Started with Serverless EDSELEv1EN-US assessment question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Getting Started with Serverless EDSELEv1EN-US assessment and earn Getting Started with Serverless EDSELEv1EN-US badge.