Terraform on AWS: Nonprod and Production Environments · Containers and Compute: ECR, ECS Fargate and EC2
ECR Repositories: Immutable Tags, Scan on Push and Lifecycle Policies
Create ECR repositories with immutable image tags and lifecycle policies that keep the last N images and clean up untagged layers, so your registry stays tidy without manual cleanup.
What you'll build
An ECR repository per service with image_tag_mutability = "IMMUTABLE" (so a tag like v1.2.3 can never be overwritten), scan on push enabled, and a lifecycle policy that keeps the 10 most recent tagged images and deletes untagged images after one day.
Premium course
Keep reading with a membership
The rest of this lesson, its practice questions and the whole Terraform on AWS: Nonprod and Production Environments course are part of the membership.
Open in the app to mark lessons complete, take notes and track your progress.