Skip to content

launch attaches an instance profile with no access to the workload's bucket, and the failure surfaces minutes later as a 403 on a paid instance #550

Closed

Description

@scttfrdmn

What happened

Two spawn launch calls in the same account, same region, same campaign, minutes-to-days apart, got different IAM instance profiles, and only one of them can reach the bucket the workload uses.

instance instance profile role can read/write the campaign bucket?
i-0c18f6171e560834c (launched 2026-08-17) spawn-instance-d1029e0a spawn-instance-d1029e0a yes — inline spawn-custom-policy scopes ListBucket to corpus/* + registry/* and PutObject/GetObject to corpus/pilot/*
i-01040759abdfa2076 (launched 2026-08-20T06:40:26Z) spored-instance-profile spored-instance-role no — its S3 policies are scoped to unrelated buckets (scttfrdmn-microbiome-demo, omics-demo, etc.)

The second instance 403s on the first S3 call:

$ aws s3api head-object --bucket <campaign-bucket> --key corpus/pilot/stack/gpaw-26.7.0/....whl
An error occurred (403) when calling the HeadObject operation: Forbidden

Why it costs something

Nothing fails at launch. The instance boots, SSH works, the toolchain installs, a conda env builds — and the 403 lands ~5 minutes in, on a c8g.48xlarge at $7.657/h, inside a detached provisioning script. In our case it killed the run under set -e, the log froze, and the wasted window was only caught by polling. An unattended pipeline would have burned to its TTL having produced nothing.

The 403 is also on HeadObject, i.e. before any digest is computed, so a provisioning step whose whole job is "install this artifact by sha256" fails in a way that looks like a missing object rather than a missing permission.

Suggested fixes, roughly in order of value

  1. Preflight the profile against the workload at launch, and fail there. If spawn launch accepts a bucket/prefix (or can infer one from --tag Campaign=... reuse, or from an explicit --s3 s3://bucket/prefix), do one HeadBucket/ListObjectsV2 from the instance as part of readiness and refuse the launch on 403. A launch that cannot reach its data is better failed at second 30 than at minute 5.
  2. Make profile selection explicit and deterministic. --instance-profile NAME (and echoing the resolved profile in spawn launch's output and in spawn list) would have made this a one-line fix instead of an investigation. Right now the resolved profile appears nowhere in the CLI output — I had to read it out of ec2:DescribeInstances.
  3. Document the fallback order. It is not clear from the docs why one launch got a per-launch spawn-instance-<hash> profile and another got a pre-existing shared spored-instance-profile. If the rule is "reuse an existing profile when one matches some heuristic", that heuristic is load-bearing for data access and should be stated.
  4. Consider reporting the profile in spawn list/spawn describe. Alongside TTL and on-complete, since it determines whether the instance can save its own results.

Related, from the same instance's tags (separate but adjacent)

spawn-instance-<hash> profiles are not cleaned up on termination — 8 exist in this account dating back to 2026-05-17 with only 1 running instance. That is arguably the safe default (reuse works, no dangling-permission surprise mid-run), but it is worth deciding deliberately rather than leaving it as an artifact, and it interacts with fix (2): a user told to pass --instance-profile will reasonably reach for one of those.

Versions: spawn:version = 0.101.0, spawn:spored-version = 0.101.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions