ECR Repositories, Tags, and Authentication
coreintermediateECR 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`.
Think of it as
ECR is S3 for container images: an AWS resource with IAM in front of it, plus a translation layer for a client that only understands usernames and passwords. `get-login-password` is that translation — a temporary password minted from your IAM identity.
What we're doing: See what tag immutability actually prevents.
- 1
- Nothing about the second push looks unusual — repushing a tag after a small fix is a very common habit.
- 5
- The service is healthy, the tag is right, and the fleet is inconsistent. Nothing in the console shows a discrepancy, because the console shows the tag.
Why this works: A version number that can point at two different builds makes every other traceability effort meaningless — the running task, the CI record, and the git commit no longer agree. Tag immutability makes the registry enforce what everyone already assumes.
Baking registry credentials into an image or a CI secret
Wrong
Better
What you see: The credential outlives the person who created it, works from anywhere, and is discovered during an audit rather than being rotated on schedule.
Why: The authorization token is deliberately short-lived and scoped to the IAM principal that requested it, which means the durable credential is the IAM role, not a password. Storing a password reintroduces exactly the long-lived secret the token model exists to avoid.
- 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
Tag or digest?
Together
Remember: 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.
See also: lifecycle policies and promotion · image provenance and hardening · pipeline stages and artifacts

