Dive into event-driven compute triggers with this quiz focused on S3, DynamoDB, and API Gateway as Lambda event sources. Enhance your understanding of how these services initiate serverless functions, their integration methods, and use cases for automation and real-time processing.
Which event in an object storage bucket can be used to automatically trigger a Lambda function, such as resizing an image when it's uploaded?
Explanation: The 'ObjectCreated' event occurs when a new object is added to the storage bucket, which is commonly used to trigger Lambda functions for immediate processing. 'TableScan' is related to data searching, not object storage. 'NewRecordStream' sounds related to streams but is not a valid event type for this case. 'APIInvoke' refers to an API call, not storage events.
How can a Lambda function receive and process real-time updates from a NoSQL table when data changes occur?
Explanation: Enabling streams captures changes in the table and triggers Lambda functions automatically for real-time processing. 'Table Gateway trigger' is not a recognized mechanism. Polling the table is inefficient and not real-time. 'Bucket notifications' are used for object storage, not NoSQL tables.
Which method allows clients to execute backend business logic via HTTP API requests that run Lambda functions?
Explanation: API Gateway proxy integration allows HTTP requests to be routed directly to Lambda, enabling web or mobile application backends. Streaming from S3 is unrelated to API requests. Attaching Lambda as a table trigger pertains to database event sources, not HTTP APIs. Database snapshots do not invoke Lambda.
Which feature allows you to trigger a Lambda function only when certain types of files, such as '.jpg' images, are added to a storage bucket?
Explanation: By setting key prefix or suffix filters, events can be limited to files matching certain patterns, such as '.jpg'. Table scan filters do not apply to storage events. API Gateway request mapping targets API requests, not file uploads. Stream partition filtering is used in stream processing, not storage buckets.
When a Lambda function is triggered by changes in a NoSQL table stream, which setting determines how many records are sent in a single invocation?
Explanation: The batch size controls how many stream records Lambda receives per call, allowing batch processing of changes. Request timeout controls duration, not data quantity. File filter does not apply to streams. API method relates to HTTP requests, not streaming data.
Which method helps ensure only authorized users can trigger a Lambda function through an HTTP API?
Explanation: API Gateway endpoints can be secured with authentication and authorization, ensuring only permitted users invoke Lambda. Table encryption secures data, not access. Stream view types control what data is captured, not access. Object locks apply to storage, not API security.
What type of invocation occurs when a Lambda function responds to a storage bucket event, such as an object being deleted?
Explanation: Event-driven invocation happens automatically when a specific bucket event occurs, requiring no manual intervention. Manual polling would need separate logic and delays. Synchronous invocation through API is unrelated to object storage events. Stream partitioned batch applies to streaming sources.
Which source is NOT a direct event trigger option for Lambda functions?
Explanation: Lambda can be triggered by events like object creations in storage, HTTP requests, or DynamoDB Stream updates, but not by simple table column changes without an associated stream or event setup. Object created events, HTTP requests, and stream updates are all supported triggers, while a column change alone is not.
Which integration type allows an HTTP API to act as a direct trigger for a Lambda function using the incoming request and response?
Explanation: Proxy integration forwards the entire HTTP request to Lambda, allowing it to handle the event and response directly. Stream mapping applies to streams, not HTTP. Direct polling is not used for API requests. S3 notification deals with storage buckets, not APIs.
If a Lambda function is unable to process a record from a NoSQL table stream, what happens to that event?
Explanation: Unprocessed events stay in the stream for a set retention period, allowing for retry. They are not deleted immediately upon error, nor are they sent to object storage. There is no automatic API Gateway retry for such events; this applies only to streaming services.