Q12 — AWS DVA-C02 Ch.2

Question 12 of 100 | ← Chapter 2

A developer wants to insert a record into an Amazon DynamoDB table immediately after a new file is added to an Amazon S3 bucket. What steps are required to achieve this goal?

Correct Answer: B. Configure an S3 event to invoke an AWS Lambda function that inserts the record into DynamoDB.

Explanation

S3 event notifications: Amazon S3 supports event notifications that trigger actions in response to specific events, such as object uploads. These notifications can invoke AWS Lambda functions. AWS Lambda: AWS Lambda is a serverless compute service that executes code in response to events. A Lambda function can be written to automatically trigger upon receiving an S3 event notification. Real-time response: Once S3 event notifications are configured, S3 sends an event notification to the Lambda function whenever a new file is uploaded. The Lambda function responds immediately and performs the specified action—such as inserting a record into a DynamoDB table. Comparison with other options: Option A: Using Amazon EventBridge to monitor the S3 bucket and insert records into DynamoDB is feasible, but AWS recommends using S3 event notifications to directly invoke Lambda functions, which is simpler and more real-time. Option C: Polling the S3 bucket with a Lambda function is possible but less efficient and less responsive than using event-driven S3 notifications. Option D: A scheduled cron job introduces latency and is not event-driven, making it unsuitable for immediate insertion. Therefore, to achieve immediate record insertion into DynamoDB upon file upload to S3, the best step is option B: configure an S3 event to invoke a Lambda function.