AWS Certified Developer – Associate (DVA-C02) — Question 402
A developer needs to store files in an Amazon S3 bucket for a company's application. Each S3 object can have multiple versions. The objects must be permanently removed 1 year after object creation.
The developer creates an S3 bucket that has versioning enabled.
What should the developer do next to meet the data retention requirements?
Answer options
- A. Create an S3 Lifecycle rule on the S3 bucket. Configure the rule to expire current versions of objects and permanently delete noncurrent versions 1 year after object creation.
- B. Create an event notification for all object creation events in the S3 bucket. Configure the event notification to invoke an AWS Lambda function. Program the Lambda function to check the object creation date and to delete the object if the object is older than 1 year.
- C. Create an event notification for all object removal events in the S3 bucket. Configure the event notification to invoke an AWS Lambda function. Program the Lambda function to check the object creation date and to delete the object if the object is older than 1 year.
- D. Create an S3 Lifecycle rule on the S3 bucket. Configure the rule to delete expired object delete markers and permanently delete noncurrent versions 1 year after object creation.
Correct answer: A
Explanation
An S3 Lifecycle rule is the most cost-effective and native way to manage object retention without writing custom code. Because versioning is enabled on the bucket, the lifecycle rule must be configured to both expire current versions and permanently delete noncurrent versions after 1 year to ensure complete removal of the data. Using AWS Lambda functions triggered by event notifications is unnecessary and introduces additional operational overhead and execution costs.