DVA-C02 practice question 30 of 35
A developer wants to insert a record into an Amazon DynamoDB table as soon as a new file is added to an Amazon S3 bucket. Which set of steps would be necessary to achieve this?
Full set: 598 questionsDomain Development with AWS Services
The most efficient and direct method to meet this requirement is using an event-driven, serverless architecture. Amazon S3 event notifications can be configured to trigger an AWS Lambda function automatically and in near-real time when a specific event occurs, such as an object creation (s3:ObjectCreated:). The Lambda function receives the event data, which includes details about the new S3 object. The function's code can then use the AWS SDK to process this information and write a new record to the specified Amazon DynamoDB table. This pattern is highly scalable, cost-effective, and avoids the latency and inefficiency of polling.
A. Amazon EventBridge can react to S3 events, but it cannot directly insert records into DynamoDB. It would still require a target, such as a Lambda function, to perform the database write, making this option less direct than B.
C. Polling an S3 bucket with a Lambda function is an inefficient anti-pattern. It introduces latency, as the function only runs on a schedule, and incurs unnecessary costs from repeated API calls to list bucket contents.
D. A cron job is a scheduled task, not an event-driven one. This approach would introduce a delay between the file upload and the database insert, failing to meet the "as soon as" requirement.
1. AWS Lambda Developer Guide, "Using AWS Lambda with Amazon S3": This document explicitly describes the pattern of using S3 to trigger a Lambda function. It states, "You can use Lambda to process event notifications from Amazon Simple Storage Service. Amazon S3 can send an event to a Lambda function when an object is created or deleted in a bucket." (Section: "Tutorial: Using an Amazon S3 trigger to invoke a Lambda function").
2. Amazon S3 User Guide, "Amazon S3 event notifications": This guide details how to configure notifications and lists AWS Lambda as a primary destination. "Amazon S3 event notifications can be sent to the following destinations: Amazon Simple Notification Service (Amazon SNS) topics, Amazon Simple Queue Service (Amazon SQS) queues, and AWS Lambda functions." (Section: "Event notification destinations").
3. AWS Lambda Developer Guide, "Tutorial: Using an Amazon S3 trigger to create thumbnail images": This official tutorial provides a step-by-step implementation of a nearly identical pattern (S3 trigger -> Lambda -> S3 write), which demonstrates the core principle of S3 event notifications invoking a Lambda function for processing. The same logic applies to writing to DynamoDB instead of S3.
Keep practicing
Take the free DVA-C02 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DVA-C02 practice questions
- Question 1A company has a multi-node Windows legacy application that runs on premises. The applicat…
- Question 2A developer migrated a legacy application to an AWS Lambda function. The function uses a …
- Question 3A development learn has an Amazon API Gateway REST API that is backed by an AWS Lambda fu…
- Question 4A company is expanding the compatibility of its photo-snaring mobile app to hundreds of a…
- Question 5A company has an ecommerce application. To track product reviews, the company's developme…
- Question 6A social media company is designing a platform that allows users to upload data, which is…
