AWS Certified Developer – Associate (DVA-C02)Development with AWS ServicesEasy

A developer is building a serverless application that processes large files uploaded to an S3 bucket. The processing logic is implemented as an AWS Lambda function. The Lambda function needs to be triggered automatically whenever a new file is uploaded to the S3 bucket. Which of the following is the MOST efficient way to configure this trigger?

  1. AConfigure the Lambda function to poll the S3 bucket periodically for new files.
  2. BConfigure an S3 event notification to invoke the Lambda function directly.
  3. CUse Amazon SQS to queue messages for new S3 objects, then have Lambda poll the SQS queue.
  4. DImplement a custom CloudWatch Events rule to detect S3 uploads and trigger Lambda.
Show answer & explanation

Correct answer: B. Configure an S3 event notification to invoke the Lambda function directly.

S3 event notifications provide a direct and efficient mechanism to trigger Lambda functions in response to object-related events, eliminating the need for polling or intermediate services.

Why the other options are wrong

  • A. Polling is inefficient, consumes resources, and introduces latency compared to event-driven triggers.
  • C. While SQS can be used, it adds unnecessary complexity and an additional service when S3 can directly invoke Lambda for this scenario.
  • D. CloudWatch Events can monitor S3 API calls, but S3 event notifications are a more direct and purpose-built integration for object-level events.

S3 Event Notifications

A feature of Amazon S3 that allows you to receive notifications when certain events happen in your bucket, such as object creation, deletion, or restoration.

  • Can send notifications to SQS, SNS, or Lambda.
  • Provides real-time, event-driven processing.
  • Configured directly on the S3 bucket.

Memory trick: S3's direct event message sparks Lambda's immediate action.

More Development with AWS Services questions