To meet data retention requirements and permanently delete S3 objects with versioning enabled 1 year after creation, create an S3 Lifecycle rule to expire current versions and delete noncurrent versions. Detailed explanation provided.
Table of Contents
Question
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?
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.
Answer
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.
Explanation
When you have an S3 bucket with versioning enabled, each object can have multiple versions – a current version and one or more noncurrent versions. To permanently remove objects 1 year after creation in this scenario, you need to configure an S3 Lifecycle rule that will:
- Expire the current version of the object after 1 year. This will add a delete marker as the current version, making the object inaccessible.
- Permanently delete any noncurrent (prior) versions of the object 1 year after the object was originally created.
Together, these actions in the Lifecycle rule will ensure objects are completely removed from the versioned bucket 1 year after they are first added.
The other options are not suitable:
B. Using a Lambda function triggered by object creation to check age and delete is unnecessary when Lifecycle rules can handle this automatically. It would also only delete the current version, leaving noncurrent versions.
C. A Lambda function triggered by object removal events does not make sense for this requirement, as you want to proactively remove objects based on creation date, not react after some versions are deleted.
D. Deleting expired object delete markers is not relevant here, as no expiration is involved. You wouldn’t set an expiration time if you want to keep current versions for 1 year. This also would not remove the current version of each object after a year.
So in summary, configuring an S3 Lifecycle rule to expire current versions and permanently delete noncurrent versions 1 year after creation (Option A) is the most straightforward and reliable way to meet the stated data retention requirements.
Amazon AWS Certified Developer – Associate DVA-C02 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Amazon AWS Certified Developer – Associate DVA-C02 exam and earn Amazon AWS Certified Developer – Associate DVA-C02 certification.