What triggers can initiate AWS Lambda functions?

Instruction: List and describe various event sources that can trigger the execution of AWS Lambda functions.

Context: This question tests the candidate's knowledge of AWS Lambda's integrations with other AWS services and external event sources, demonstrating an understanding of event-driven architectures.

Updated

Official answer

Useful event sources include:

  • HTTP requests through API Gateway, an Application Load Balancer or a function URL, subject to the integration's authentication and response contract.
  • S3 object notifications, standard SNS topic messages and EventBridge events, which use service integrations with their own delivery and retry behavior.
  • SQS queues, DynamoDB Streams, Kinesis Data Streams and supported Kafka sources through Lambda event source mappings. Lambda polls or consumes these sources and invokes the handler with batches.
  • EventBridge Scheduler for one-time or recurring schedules.
  • Direct invocation through an SDK or CLI, choosing synchronous request/response or asynchronous acceptance as supported by the invocation API.

The source determines permissions, payload shape, batching, ordering and failure handling. For example, SNS invokes Lambda asynchronously, while an SQS event source mapping manages polling and message deletion after successful processing. Do not apply Lambda's asynchronous retry settings to every source.

Grant the appropriate invocation permission and execution-role access separately. Test duplicate deliveries, malformed records, throttling and exhausted retries. Delivery and successful side effects are different outcomes; a notification service does not guarantee that arbitrary handler code completes successfully exactly once.

Lambda service integrations, event source mappings

Related Questions