ECR Image Build and Lifecycle
Build and push a Docker image to Amazon ECR with scan-on-push, manage tags, apply a lifecycle policy, and configure cross-region replication.

Lab Overview
In this lab you'll operate Amazon ECR end-to-end like a DevOps engineer. You'll create an ECR repository with tag immutability and scan-on-push, build a small Dockerfile-based image and push two tagged versions, view the vulnerability scan results, apply a lifecycle policy that deletes untagged images older than 7 days while keeping the last 10 tagged images, and configure a same-account cross-region replication rule so the image is copied to a target region.
You will:
- Create a private ECR repository with `IMMUTABLE` tag mutability and scan-on-push enabled
- Authenticate Docker to ECR, build a tiny Alpine-based image, and push `:v1` and `:v2`
- Inspect ECR scan findings via the CLI
- Attach a JSON lifecycle policy with two rules (untagged > 7 days, keep last 10 tagged)
- Configure a cross-region replication rule (us-east-1 to us-west-2) and verify the replica
This lab uses the `ubuntu2024` image and the standard hardened TeKanAid AWS lab IAM policy with ECR access added. Docker is installed automatically by the setup script.
What You'll Learn
Create a private ECR repository with tag immutability and scan-on-push
Authenticate Docker to ECR and push multi-tag container images
Inspect ECR vulnerability scan findings via the AWS CLI
Author and apply an ECR lifecycle policy using JSON rules
Configure a cross-region ECR replication rule and verify replicated images
Prerequisites
basic-docker-familiarity
aws-cli-familiarity
aws-devops-cli-operations-baseline
Technologies Covered
Part of a Course
This lab is part of the AWS Certified DevOps Engineer - Professional (DOP-C02) course
View All CoursesChoose your plan
Simple, Transparent Pricing
Unlock full access to TeKanAid courses, labs, and bootcamps
Pro
Course content without labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Full access to all courses
- Progress tracking
- Certificate of completion
- Community access
- Bootcamp participation
- New content access
Premium
Full access with hands-on labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Everything in Pro
- Unlimited hands-on labs
- Lab AI Assistant
- Accelerator bootcamps with live office hours
- Priority support
Prefer a single course?
Purchase individual courses for a one-time fee of $79. Full access to course content, quizzes, certificates, and community features, lab access is not included.
Browse CoursesTry it free, no credit card
Three free ways to start. All bridge into the paid Premium catalog when you're ready.
Not ready to commit? The crash course is email-only. No academy account required.
Ready to Get Started?
Start this hands-on lab and build real-world Platform Engineering skills
Get Access Now