Amazon ECR

5 minutes 5 Questions

Amazon Elastic Container Registry (ECR) is a fully managed container image registry service provided by AWS that makes it easy to store, manage, and deploy Docker container images. For Solutions Architects working on workload migration and modernization, ECR serves as a critical component in containerization strategies. ECR integrates seamlessly with Amazon Elastic Container Service (ECS), Amazon Elastic Kubernetes Service (EKS), and AWS Fargate, enabling streamlined container orchestration workflows. The service eliminates the need to operate your own container repositories or worry about scaling the underlying infrastructure. Key features include: **Security**: ECR encrypts images at rest using AWS KMS and transfers images over HTTPS. IAM policies control access to repositories, and image scanning capabilities detect vulnerabilities in container images. **High Availability**: Images are stored redundantly across multiple Availability Zones, ensuring durability and availability for production workloads. **Lifecycle Policies**: Automated rules help manage image retention, allowing you to define policies that clean up unused images and reduce storage costs. **Cross-Region and Cross-Account Replication**: ECR supports replicating images across AWS regions and accounts, facilitating disaster recovery and multi-region deployment strategies. **Public Repositories**: ECR Public allows sharing container images publicly, useful for open-source projects. For migration scenarios, ECR enables teams to containerize legacy applications and establish CI/CD pipelines. When modernizing monolithic applications into microservices, ECR provides a centralized registry for all container images. Pricing is based on data storage and data transfer. The AWS Free Tier includes 500 MB of storage per month for private repositories. Best practices include implementing image scanning during build pipelines, using immutable image tags for production deployments, and establishing lifecycle policies to manage repository growth. ECR is essential for organizations adopting container-based architectures during their cloud transformation journey.

Amazon ECR (Elastic Container Registry) - Complete Guide

Why Amazon ECR is Important

Amazon Elastic Container Registry (ECR) is a critical service for organizations adopting containerized workloads and microservices architectures. As businesses migrate and modernize their applications, container images need a secure, scalable, and highly available repository. ECR eliminates the operational burden of managing your own container registry infrastructure, integrates seamlessly with AWS services, and provides enterprise-grade security features essential for production workloads.

What is Amazon ECR?

Amazon ECR is a fully managed container image registry service that makes it easy to store, manage, share, and deploy container images. It supports both Docker images and Open Container Initiative (OCI) images and artifacts.

Key Components:
• Registry - A private registry provided to each AWS account for storing repositories
• Repository - A collection of related container images with the same name but different tags
• Repository Policy - Controls access to repositories and images within them
• Authorization Token - Required to push and pull images, valid for 12 hours
• Image - Container images stored in repositories

ECR Public vs ECR Private
• ECR Private - For internal workloads, supports IAM-based access control
• ECR Public - For publicly sharing container images via Amazon ECR Public Gallery

How Amazon ECR Works

Image Lifecycle:
1. Developers build container images locally or in CI/CD pipelines
2. Authenticate to ECR using aws ecr get-login-password command
3. Tag images with the ECR repository URI
4. Push images to ECR repository
5. Pull images from ECR to ECS, EKS, Lambda, or other compute services

Key Features:

Image Scanning
• Basic Scanning - Uses Common Vulnerabilities and Exposures (CVE) database
• Enhanced Scanning - Powered by Amazon Inspector, provides continuous automated scanning for OS and programming language vulnerabilities
• Scanning can be configured on push or manually triggered

Lifecycle Policies
• Automate cleanup of unused or old images
• Define rules based on image age or count
• Reduce storage costs and maintain repository hygiene

Cross-Region and Cross-Account Replication
• Replicate images across AWS regions for disaster recovery
• Share images across accounts for multi-account architectures
• Supports both private and public image replication

Encryption
• Images encrypted at rest using AWS KMS
• Default encryption with AWS-managed keys
• Option to use customer-managed KMS keys (CMK) for additional control

Integration with AWS Services
• Amazon ECS - Native integration for container deployments
• Amazon EKS - Pull images for Kubernetes workloads
• AWS Lambda - Deploy container images as Lambda functions
• AWS CodeBuild/CodePipeline - CI/CD integration
• AWS Fargate - Serverless container execution

Security Best Practices
• Use IAM policies for fine-grained access control
• Enable image scanning for vulnerability detection
• Implement lifecycle policies to remove untagged or old images
• Use VPC endpoints (PrivateLink) for private connectivity
• Enable immutable tags to prevent image overwrites

Exam Tips: Answering Questions on Amazon ECR

Scenario Recognition:
• When questions mention storing Docker images or container registries in AWS, think ECR
• Migration scenarios from Docker Hub or self-managed registries point to ECR
• Questions about securing container images suggest ECR with scanning and encryption

Key Points to Remember:
• ECR integrates natively with ECS, EKS, and Lambda - no additional configuration needed
• Authentication tokens expire after 12 hours
• For cross-account access, use repository policies (resource-based policies)
• VPC Endpoints allow private access to ECR from within VPC
• Enhanced scanning with Inspector provides more comprehensive vulnerability detection than basic scanning
• Pull-through cache repositories allow caching public registry images in ECR

Common Exam Scenarios:
• Reducing egress costs - Use ECR in the same region as compute resources
• Multi-region deployment - Configure cross-region replication
• Compliance requirements - Enable encryption with CMK and image scanning
• Automated cleanup - Implement lifecycle policies
• Private connectivity - Use Interface VPC Endpoints for ECR API and Gateway Endpoint for S3 (image layers)

Watch Out For:
• Questions mixing up ECR with ECS - ECR stores images, ECS runs containers
• Understand the difference between repository policies (resource-based) and IAM policies (identity-based)
• Remember that ECR requires both ecr-api and ecr-dkr endpoints for complete private access
• Enhanced scanning requires Amazon Inspector to be enabled
Test mode:
More Amazon ECR questions
30 questions (total)

Other Accelerate Workload Migration and Modernization concepts

7Rs migration strategiesAmazon Aurora ServerlessAmazon DynamoDBAmazon EBSAmazon EC2 for migrationsAmazon ECSAmazon EFSAmazon EKSAmazon ElastiCacheAmazon EventBridgeAmazon FSxAmazon OpenSearch ServiceAmazon RDSAmazon S3 storageAmazon S3 Transfer AccelerationApplication decoupling opportunitiesApplication integration service selectionApplication migration assessmentApplication transfer mechanism selectionAsset planning for migrationAWS Application Discovery ServiceAWS Application Migration ServiceAWS Database Migration Service (DMS)AWS DataSyncAWS Directory ServiceAWS Elastic BeanstalkAWS FargateAWS IAM Identity Center for migrationAWS LambdaAWS Migration HubAWS Schema Conversion Tool (SCT)AWS Snow FamilyAWS Storage GatewayAWS Transfer FamilyCompute platform selectionContainer hosting platform selectionContainer service selectionContainers for modernizationDatabase platform selectionDatabase transfer mechanism selectionData transfer service selectionDirect Connect for migrationEvent-driven architecture modernizationGovernance model selectionGovernance tools for migrationMicroservices modernizationMigration assessment toolsPortfolio assessmentPurpose-built database opportunitiesRefactor migration strategyRehost migration strategyRelocate migration strategyReplatform migration strategyRepurchase migration strategyRetain migration strategyRetire migration strategyRoute 53 for migrationSecurity methods for migration toolsSelf-managed databases on EC2Serverless compute offeringsServerless solution opportunitiesSite-to-Site VPN for migrationStorage service selectionTotal cost of ownership (TCO) evaluationWave planning for migrationWorkload prioritization