Add ECR Public authentication support to Atmos via a new aws/ecr-public integration kind. This enables authenticated pulls from public.ecr.aws, eliminating rate limits that affect CI workflows.
Companion to: ecr-authentication.md (private ECR).
Docker image pulls from public.ecr.aws are rate-limited when unauthenticated. The cloudposse/github-action-docker-build-push action pulls BuildKit and binfmt images from public ECR, so every Docker build hits these limits. Currently there is no native Atmos way to authenticate to ECR Public — users must add manual docker/login-action steps to their workflows.
Current Experience:
# Must manually authenticate to ECR Public
$ aws ecr-public get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin public.ecr.aws
# Or add docker/login-action steps to every CI workflowDesired Experience:
# Automatic via integration auto_provision
$ atmos auth login dev-admin
✓ Authenticated as arn:aws:sts::123456789012:assumed-role/DevRole/user
✓ ECR Public login: public.ecr.aws (expires in 12h)
# Or explicit
$ atmos auth ecr-login ecr-public
✓ ECR Public login: public.ecr.aws (expires in 12h)| Aspect | Private ECR (aws/ecr) |
Public ECR (aws/ecr-public) |
|---|---|---|
| AWS SDK service | ecr |
ecrpublic |
| API call | ecr:GetAuthorizationToken |
ecr-public:GetAuthorizationToken |
| Auth mechanism | SigV4 | Bearer token (sts:GetServiceBearerToken) |
| Auth region | Any region where registry exists | us-east-1 only |
| Service regions | All commercial AWS regions | us-east-1, us-west-2 only |
| Registry URL | {account_id}.dkr.ecr.{region}.amazonaws.com |
public.ecr.aws (always) |
| IAM permissions | ecr:GetAuthorizationToken |
ecr-public:GetAuthorizationToken + sts:GetServiceBearerToken |
| Config needs | account_id + region required |
No config needed (fixed endpoint) |
| China/GovCloud | Private ECR available | Not available |
ECR Public is only available in two regions:
| Region | Service endpoints | Auth (GetAuthorizationToken) |
|---|---|---|
| us-east-1 (N. Virginia) | Yes | Yes (only region) |
| us-west-2 (Oregon) | Yes | No |
Not available in: EU, Asia Pacific, China (cn-north-1, cn-northwest-1), GovCloud, or any other region.
Source: AWS ECR Public endpoints and quotas.
The implementation must validate any user-specified region against the supported set {us-east-1, us-west-2}. Auth calls are always forced to us-east-1 regardless of any user configuration.
auth:
integrations:
ecr-public:
kind: aws/ecr-public
via:
identity: plat-dev/terraform
spec:
auto_provision: trueNo registry block is needed since ECR Public is always public.ecr.aws in us-east-1.
| Field | Required | Default | Description |
|---|---|---|---|
kind |
Yes | — | Must be aws/ecr-public |
via.identity |
No | — | Identity providing AWS credentials |
spec.auto_provision |
No | true |
Auto-trigger on identity login |
Registered via the existing integration registry pattern (same as aws/ecr).
- Build AWS config with credentials from the linked identity.
- Force region to
us-east-1(the only supported auth region). - Call
ecrpublic.GetAuthorizationToken()via AWS SDK v2. - Decode base64 authorization token to
username:password. - Write credentials to Docker config for
public.ecr.aws. - Log success with token expiration time.
pkg/auth/
├── cloud/aws/
│ ├── ecr.go # Existing private ECR
│ ├── ecr_public.go # NEW: ECR Public token fetcher
│ └── ecr_public_test.go # NEW: Tests
├── integrations/
│ ├── types.go # Add KindAWSECRPublic constant
│ └── aws/
│ ├── ecr.go # Existing private ECR integration
│ ├── ecr_public.go # NEW: ECR Public integration
│ └── ecr_public_test.go # NEW: Tests
New sentinel errors in errors/errors.go:
ErrECRPublicAuthFailed— "ECR Public authentication failed"ErrECRPublicInvalidRegion— "invalid ECR Public region"
Integration failures during auto-provision are non-fatal (logged as warnings, don't block identity auth). Explicit ecr-login command failures are fatal.
No new CLI command needed. The existing atmos auth ecr-login command routes through the integration registry and handles aws/ecr-public automatically:
# Named integration
atmos auth ecr-login ecr-public
# Via identity (triggers all auto_provision integrations)
atmos auth ecr-login --identity plat-dev/terraform- PRD document (
docs/prd/ecr-public-authentication.md) - SDK dependency (
github.com/aws/aws-sdk-go-v2/service/ecrpublic) - Error sentinels (
errors/errors.go) - Kind constant (
pkg/auth/integrations/types.go) - Cloud layer (
pkg/auth/cloud/aws/ecr_public.go) - Cloud layer tests (
pkg/auth/cloud/aws/ecr_public_test.go) - Integration (
pkg/auth/integrations/aws/ecr_public.go) - Integration tests (
pkg/auth/integrations/aws/ecr_public_test.go)
- Token lifetime: ECR Public tokens expire after 12 hours (AWS-enforced).
- Docker config: Credentials written to standard Docker config location with
0600permissions. - No secrets in logs: Authorization tokens are never logged.
- Secret masking: ECR Public tokens follow Atmos secret masking patterns via Gitleaks integration.
- Region pinning: Auth is always pinned to us-east-1, preventing misconfiguration.