AWS Certified DevOps Engineer – Professional — Question 162

A company is migrating Docker repositories to Amazon Elastic Container Registry (Amazon ECR) in an existing AWS account. A DevOps engineer needs to automate the management of images that are uploaded to the repositories. The solution must limit the number of image versions. As a first step, the DevOps engineer creates a private repository in Amazon ECR for each repository that the company will migrate.

What should the DevOps engineer do next to meet the requirements in the MOST operationally efficient manner?

Answer options

Correct answer: D

Explanation

The correct answer is D because creating a lifecycle policy directly within Amazon ECR is the most efficient way to manage image versions automatically without additional overhead. Options A and C involve extra steps and complexity by using Lambda and Step Functions, which are not necessary for this specific task. Option B suggests a repository policy that is not a feature available in Amazon ECR for managing image versions.