Event Sources for Lambda: S3, DynamoDB, API Gateway Quiz Quiz

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.

  1. Triggering Lambda with S3

    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?

    1. ObjectCreated
    2. APIInvoke
    3. TableScan
    4. NewRecordStream

    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.

  2. Lambda Integration with DynamoDB Streams

    How can a Lambda function receive and process real-time updates from a NoSQL table when data changes occur?

    1. By configuring bucket notifications
    2. By enabling DynamoDB Streams and associating it with Lambda
    3. By using a Table Gateway trigger
    4. By polling the table with scheduled Lambda jobs

    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.

  3. API Gateway Direct Lambda Invocation

    Which method allows clients to execute backend business logic via HTTP API requests that run Lambda functions?

    1. Invoking Lambda with a database snapshot
    2. Attaching Lambda as a table trigger
    3. Streaming events from S3 to Lambda
    4. Connecting Lambda to API Gateway as a proxy integration

    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.

  4. Event Filtering with Storage Buckets

    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?

    1. Stream partition filtering
    2. Automatic table scan filters
    3. API Gateway request mapping
    4. Event filtering on object key prefixes or suffixes

    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.

  5. Batch Processing in DynamoDB Streams

    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?

    1. Batch size
    2. File filter
    3. API method
    4. Request timeout

    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.

  6. Securing Lambda Invocations from APIs

    Which method helps ensure only authorized users can trigger a Lambda function through an HTTP API?

    1. Setting object lock on the bucket
    2. Enabling table encryption
    3. Using stream view types
    4. Applying authentication and authorization to the API Gateway endpoint

    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.

  7. Invocation Type for Storage Events

    What type of invocation occurs when a Lambda function responds to a storage bucket event, such as an object being deleted?

    1. Manual polling
    2. Event-driven invocation
    3. Stream partitioned batch
    4. Synchronous invocation through API

    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.

  8. Supported Event Sources

    Which source is NOT a direct event trigger option for Lambda functions?

    1. Object created in storage
    2. DynamoDB Streams update
    3. API Gateway HTTP request
    4. Table column change

    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.

  9. API Gateway Integration Types

    Which integration type allows an HTTP API to act as a direct trigger for a Lambda function using the incoming request and response?

    1. S3 notification
    2. Stream mapping
    3. Proxy integration
    4. Direct polling

    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.

  10. Retention of Event Records

    If a Lambda function is unable to process a record from a NoSQL table stream, what happens to that event?

    1. It is sent to an object storage bucket
    2. It is permanently deleted immediately
    3. It triggers an API Gateway retry
    4. It remains in the stream until processed or expired

    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.