1.ECR Repositories, Tags, and Authentication
ECR is a managed private container registry. Images live in repositories, and access is controlled with IAM — both identity policies and a resource-based repository policy. The Docker CLI does not speak IAM, so authentication works by exchanging your IAM credentials for a registry authorization token and passing it to `docker login`.
Key features
- ECR supports private repositories with resource-based permissions using IAM, and handles Docker images, OCI images, and OCI-compatible artifacts
- An authorization token's permission scope matches the IAM principal that retrieved it, and the token is valid for 12 hours
- `aws ecr get-login-password | docker login --username AWS --password-stdin <account>.dkr.ecr.<region>.amazonaws.com` is the standard authentication step
- A tag is a mutable pointer to an image; a digest (`@sha256:…`) names specific bytes and never changes
- Tag immutability is a repository setting that prevents an existing tag from being overwritten by a new push
- Cross-Region and cross-account replication is a registry-level setting configured per Region, and pull-through cache rules mirror an upstream public registry into your private one, keeping the cached copy refreshed
Tag or digest?
- IAM principal — role or user
- leads to Authorization token (GetAuthorizationToken)
- Authorization token — valid 12 hours, same scope as the principal
- leads to docker login (get-login-password)
- docker login — username AWS, token as password
- leads to ECR repository (push / pull)
- ECR repository — IAM + repository policy
- leads to Image + digest (stores as)
- Image + digest — sha256:… — immutable
Signature
IAM principal → GetAuthorizationToken (12h) → docker login → repository (tag: mutable · digest: not)
ECR = private registry with IAM in front. `get-login-password` mints a 12-hour token scoped to your principal. Tags are mutable pointers; digests are not. Turn on tag immutability, and reference images by digest everywhere a deployment does.