Skip to Content

Amazon DVA-C02: What’s the Best Way to Permanently Remove S3 Objects After 1 Year Using Versioning?

Learn the most efficient approach to automatically delete versioned S3 objects and permanently remove object versions after 1 year to meet data retention requirements.

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

  • S3 Lifecycle rules allow you to define actions that S3 will apply to a group of objects based on filters you specify. This is the most efficient and scalable way to manage object lifecycles.
  • Since the S3 bucket has versioning enabled, each object can have multiple versions. The Lifecycle rule needs to handle both the current version and noncurrent (previous) versions of each object.
  • Configuring the rule to expire the current version will make the object eligible for permanent deletion after the specified time period (1 year).
  • Setting the rule to also permanently delete noncurrent versions ensures that all previous versions are removed as well after 1 year. This meets the requirement to permanently delete objects 1 year after creation.

The other options are not ideal:

B and C use event notifications and Lambda to manually check object age and delete them. This is much less efficient than using S3’s built-in Lifecycle capabilities. It would require custom code and constant Lambda invocations.

D mentions deleting expired object delete markers, but this is not relevant to the versioning use case described. The rule still needs to expire current versions and delete noncurrent versions.

Therefore, creating an S3 Lifecycle rule to expire current versions and permanently delete noncurrent versions after 1 year (Choice A) is the best approach to automatically remove objects and meet the data retention requirements when versioning is enabled.

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.