AWS Certified Solutions Architect – Professional (SAP-C02) — Question 307

A company uses AWS Organizations to manage a multi-account structure. The company has hundreds of AWS accounts and expects the number of accounts to increase. The company is building a new application that uses Docker images. The company will push the Docker images to Amazon Elastic Container Registry (Amazon ECR). Only accounts that are within the company’s organization should have access to the images.

The company has a CI/CD process that runs frequently. The company wants to retain all the tagged images. However, the company wants to retain only the five most recent untagged images.

Which solution will meet these requirements with the LEAST operational overhead?

Answer options

Correct answer: A

Explanation

Using a private ECR repository ensures that the images are secure, and the aws:PrincipalOrgID condition key automatically allows access to any current or future accounts within the AWS Organization without manual updates. Additionally, native ECR lifecycle policies can manage the deletion of untagged images beyond the count of five automatically, eliminating the need to write and maintain custom AWS Lambda functions or EventBridge rules. Options involving public repositories are insecure, and listing individual account IDs or using Lambda functions introduces high operational overhead.