Learn the key Lambda invocation models, including synchronous, asynchronous, and polling. Master AWS serverless with our expert guide to Lambda triggers.
Table of Contents
Question
Which of the following patterns are Lambda invocation models? (Select THREE.)
A. Polling
B. Asynchronous
C. First In-First Out (FIFO)
D. Trigger
E. Synchronous
Answer
A. Polling
B. Asynchronous
E. Synchronous
Explanation
Event sources can invoke a Lambda function in three general design patterns. These patterns are called invocation models: synchronous, asynchronous, and polling.
AWS Lambda supports two main invocation models:
1. Synchronous invocation (Option E): The calling service waits for Lambda to process the event and return a response before continuing. The caller receives the response from Lambda directly. This is commonly used for real-time processing and interactive workloads like web APIs or Alexa skills.
2. Asynchronous invocation (Option B): The calling service puts the event into an internal Lambda queue and continues without waiting for a response. Lambda processes events from the queue when it has available resources. The caller doesn’t get the function response. This model allows high throughput and is suitable for background tasks like data processing or notifications.
In an asynchronous invocation model, Lambda can also be invoked via triggers (Option D). A trigger is an AWS service or developer-created application that publishes events to Lambda. Common triggers include S3 events, DynamoDB streams, SNS notifications, and more. Lambda processes the published events asynchronously.
Polling (Option A) refers to how some AWS services retrieve messages from upstream event sources, but it’s not a direct Lambda invocation model. For example, Lambda polls the SQS queue when used with SQS as an event source.
FIFO (Option C) is not a Lambda invocation model but rather an attribute of SQS queues. FIFO queues preserve message order and ensure exactly-once processing, while standard queues provide best-effort ordering and at-least-once delivery.
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.