DOP-C02 Question 55
Single answerYour organization uses AWS CodePipeline for its CI/CD process. The pipeline builds an application artifact and stores it in an S3 bucket. Compliance regulations mandate that all artifacts must be retained for five years, and older artifacts must be deleted automatically to reduce storage costs. What is the best way to ensure compliance while managing the artifact lifecycle in the S3 bucket?
- A
Enable S3 Versioning and manually delete older artifacts using a custom script.
- B
Use an S3 Lifecycle policy to transition artifacts to Amazon S3 Glacier Instant Retrieval after one year and delete them after five years.
- C
Configure a separate S3 bucket for long-term storage and move artifacts to this bucket using an AWS Lambda function.
- D
Implement an S3 Event Notification to trigger an Amazon SNS topic when an artifact is older than five years.
Show answer and explanation
Correct answer: B
Explanation
S3 Lifecycle policies are the most efficient and automated way to manage the lifecycle of objects in an S3 bucket. They allow you to transition objects to lower-cost storage tiers such as Amazon S3 Glacier Instant Retrieval and automatically delete them after a specified period, ensuring compliance with retention policies while optimizing storage costs.
- A. Incorrect.
Enabling S3 Versioning is useful for retaining multiple versions of an object, but it does not provide automated deletion or lifecycle management. Manually deleting artifacts with a script is error-prone and not ideal for compliance.
- B. Correct.
An S3 Lifecycle policy is the correct way to automate transitions and deletions of objects. By transitioning artifacts to Amazon S3 Glacier Instant Retrieval after one year, you reduce storage costs, and by deleting them after five years, you ensure compliance with the retention requirement.
- C. Incorrect.
Using a separate S3 bucket and moving artifacts with a Lambda function is a complex and less efficient solution compared to S3 Lifecycle policies, which are purpose-built for managing object lifecycles.
- D. Incorrect.
S3 Event Notifications can trigger actions when changes occur in the bucket, but they are not designed for managing object lifecycles or enforcing retention policies.