AWS Certified Developer – Associate / Question #1109 of 557

Question #1109

A company uses an Amazon S3 bucket to store critical financial records. The records are updated several times daily via an automated process running on AWS Lambda. The company has enabled S3 Versioning to preserve all object versions. Over time, they notice excessive versions increasing storage costs. They need to maintain only the current version and the immediate previous version of each object. Which solution meets these requirements?

A

Configure an S3 bucket policy to retain one previous non-current version of the objects.

B

Configure an S3 Lifecycle rule to retain one previous non-current version of the objects.

C

Enable S3 Object Lock. Configure an S3 Object Lock policy to retain one previous non-current version of the objects.

D

Suspend S3 Versioning. Modify the Lambda function to delete old versions before uploading new updates.

Explanation

Option B is correct because S3 Lifecycle rules allow automated management of non-current object versions. By creating a lifecycle rule that retains only one previous non-current version, older versions are automatically deleted, aligning with the requirement to keep only the current and immediate previous version. This reduces storage costs without manual intervention.

Option A is incorrect because S3 bucket policies control access permissions, not version retention. Option C is incorrect because S3 Object Lock enforces retention periods for compliance, not version count limits. Option D is incorrect because suspending versioning stops new versions but leaves existing versions intact, and manual deletion via Lambda is error-prone and inefficient.

Key Points:
- Use S3 Lifecycle rules to manage non-current versions.
- Lifecycle rules can expire older non-current versions based on count or age.
- Versioning must remain enabled to preserve the required versions.

Answer

The correct answer is: B