Skip to content

fix(iam): grant spored role ECR pull so app launch can pull its image (#588) - #589

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/588-spored-ecr-pull
Sep 14, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/588-spored-ecr-pull

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #588. Found by the #286/#389 real-GPU validation run.

Problem

spawn app launch <container-app> provisions spored-instance-role with sporedDCVRolePolicy, which granted no ECR actions. docker login succeeded (some other policy on the shared role granted account-wide ecr:GetAuthorizationToken), but the pull was denied:

... is not authorized to perform: ecr:BatchGetImage on resource: .../repository/paraview
because no identity-based policy allows the ecr:BatchGetImage action

→ container never starts → DCV session --init fails → no spawn:ready-url → launch times out. The #290 container-catalog path was unusable for any image out of the box; it only appeared to work earlier because the shared 942 role had accumulated demo-specific ECR policies.

Fix

Add a read-only ECR-pull statement to sporedDCVRolePolicy (pkg/aws/iam.go):

{ "Effect": "Allow",
  "Action": ["ecr:GetAuthorizationToken","ecr:BatchCheckLayerAvailability","ecr:GetDownloadUrlForLayer","ecr:BatchGetImage"],
  "Resource": "*" }

GetAuthorizationToken requires Resource:"*"; the pull actions are read-only and cross-account pulls stay gated by the target repo's own policy, so this doesn't over-grant. SetupSporedIAMRole rewrites the inline policy on every launch, so it takes effect on the next launch with no migration.

Tests

TestSporedDCVRolePolicy_Valid extended to require ecr:GetAuthorizationToken + ecr:BatchGetImage (regression guard).

Validation context

The real-GPU run (g5.xlarge, 942/us-east-1, i-0b46e604b61dc9563, terminated + leak-checked clean) confirmed the #286/#389 change works end to end — DLAMI resolved via SSM, Amazon DCV 2025.0 installed at boot, dcvserver + spored + TLS cert + NVIDIA A10G driver all up, dcv create-session invoked — with this ECR gap the only remaining failure. A short follow-up validation run after this merges should show ready with a live session.

… image (#588)

sporedDCVRolePolicy granted no ECR actions, so docker login succeeded
(account-wide GetAuthorizationToken) but the image pull was denied
(ecr:BatchGetImage), the container never ran, and the DCV session --init failed
→ ready-url timeout. Add read-only ECR pull (GetAuthorizationToken,
BatchCheckLayerAvailability, GetDownloadUrlForLayer, BatchGetImage) on Resource:*;
cross-account pulls stay gated by the target repo policy. Regression-guarded in
TestSporedDCVRolePolicy_Valid.

Found by the #286/#389 real-GPU validation run. Fixes #588.
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 8d41f41 into main Sep 14, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/588-spored-ecr-pull branch September 14, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spored-instance-role lacks ECR pull perms → spawn app launch can't pull its container image

1 participant