Skip to content

--fsx-import-path silently does nothing: spored's DRA create always fails on a missing iam:CreateServiceLinkedRole, leaving an empty 1200 GB filesystem #622

Closed

Description

@scttfrdmn

Summary

A --fsx-create --fsx-import-path … launch reports success and mounts /fsx, but the filesystem is empty and not linked to S3. The data-repository association fails with a 400 and the failure is visible only in /var/log/spored.log on the instance — the CLI prints 🎉 Instance Ready!.

Net effect: you get a mounted 1200 GB PERSISTENT_2 filesystem (the minimum, ~$174/month) containing nothing, and a workload that reads /fsx sees an empty directory. Same class as #558 / #613 — a flag that parses, validates and launches without acting.

Reproduction

spawn launch dpaths --region us-west-2 --instance-type m8g.8xlarge --volume-size 160 \
  --az us-west-2b --efs-id fs-… \
  --fsx-create --fsx-s3-bucket $BUCKET \
  --fsx-import-path s3://$BUCKET/inputs/star-index-GRCh38-116 \
  --fsx-lifecycle ephemeral \
  --iam-policy s3:ReadOnly,s3:WriteOnly \
  --ttl 90m --cost-limit 2.50

Observed (spawn 0.111.2, AL2023 arm64, lustre-client-2.15.6-32.amzn2023.aarch64):

$ aws fsx describe-file-systems --file-system-ids fs-0355f3a3160d8618c \
    --query 'FileSystems[0].LustreConfiguration.DataRepositoryConfiguration'
null

$ aws fsx describe-data-repository-associations \
    --filters Name=file-system-id,Values=fs-0355f3a3160d8618c --query 'Associations'
[]

# on the instance
$ df -h /fsx
172.31.53.58@tcp:/mszmnb4v  1.2T  7.5M  1.2T   1% /fsx     # empty

Root cause

/var/log/spored.log on the instance has it exactly:

2026/09/26 07:15:17 fsx: pending filesystem fs-0355f3a3160d8618c — waiting for AVAILABLE to mount at /fsx
2026/09/26 07:19:59 fsx: data-repository association for fs-0355f3a3160d8618c failed: operation error FSx:
  CreateDataRepositoryAssociation, https response error StatusCode: 400, RequestID: 1961efa5-…,
  BadRequest: Amazon FSx is unable to create Service-Linked-Role to access the S3 bucket. Ensure the IAM
  role or user you are using has the required permissions.
  — mounting anyway (results may not auto-export to S3)
2026/09/26 07:20:01 fsx: mounted fs-0355f3a3160d8618c at /fsx

FSx creates a per-filesystem service-linked role (AWSServiceRoleForFSxS3Access_<fsid>) on the first CreateDataRepositoryAssociation, and that requires the calling principal to hold iam:CreateServiceLinkedRole. #221 added the fsx:* actions to the spored baseline — necessary but not sufficient:

  • pkg/aws/iam.go:917-925 — sporedFSxMount grants fsx:DescribeFileSystems, fsx:CreateDataRepositoryAssociation, fsx:DescribeDataRepositoryAssociations and nothing else.
  • iam:CreateServiceLinkedRole appears nowhere in spawn's policy building (only scripts/setup-sweep-cross-account-role.sh:70 and pkg/aws/imagebuilder.go:79). Confirmed still absent at v0.111.4.
  • So pkg/aws/fsx.go:255 (associateFSxS3) → pkg/agent/fsx_mount.go:117 fails on every fresh filesystem in an account, not just ours. The role exists after the first successful DRA, so anyone who has ever created one by hand won't see this.

It reproduced with my own admin profile creating the same DRA successfully from the laptop — the difference is purely the instance role's permissions.

Suggested fix

Add to sporedFSxMount in pkg/aws/iam.go, scoped to the one service:

{
  "Effect": "Allow",
  "Action": "iam:CreateServiceLinkedRole",
  "Resource": "*",
  "Condition": { "StringEquals": { "iam:AWSServiceName": "s3.data-source.lustre.fsx.amazonaws.com" } }
}

Second, separable half: pkg/agent/fsx_mount.go:88 degrades to a log line on the box. For a flag whose entire purpose is "put this S3 prefix on the filesystem", a silent degrade means the workload reads an empty mount. Surfacing the association failure where the launch is watched — and saying data will not be there, not only "results may not auto-export" — would have turned a 15-minute diagnosis into a one-line read. The mount-anyway behaviour itself seems right; it's the silence that costs.

Why it matters

--fsx-create provisions the most expensive thing a launch can create. Failing open here means paying the 1200 GB minimum for a filesystem that holds nothing, with no signal at the CLI — the guardrail-you-believe-is-armed shape of #558/#613, one layer over.

Found while measuring four data paths (local copy / EFS / FSx Lustre / S3 mount) for one 28.6 GiB genome index in the scientific-codes-cookbook.

Activity

  1. scttfrdmn commented on Oct 2, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed in #628 (merged as `c859ed7`). Your diagnosis was exactly right — including the specific grant and the condition to scope it — so this is essentially your suggested fix, plus one path you couldn't have known about.

    The grant

    `iam:CreateServiceLinkedRole` conditioned on `iam:AWSServiceName = s3.data-source.lustre.fsx.amazonaws.com`, as you proposed.

    It was missing on both instance-profile paths, not one. spawn resolves a profile two ways:

    path taken when policy
    `CreateOrGetInstanceProfile` any `--iam-role`/`--iam-policy`/`--iam-policy-file` dynamic `sporedBaselinePolicyDoc()`
    `SetupSporedIAMRole` no `--iam-*` flags static `sporedDCVRolePolicy`

    You passed `--iam-policy s3:ReadOnly`, so you hit the first. The second had the identical gap — it already carried the #221 `fsx:` actions but not the service-linked-role grant — and it's the path a bare `spawn launch --fsx-create --fsx-import-path` takes, i.e. the simplest invocation. Both are fixed, and a test asserts them together keyed to `fsx:CreateDataRepositoryAssociation`, so they can't diverge on it again.

    No action needed on existing roles. Both paths rewrite their policy via `PutRolePolicy` on every launch, so a role cached from before this fix self-heals on its next use.

    The silence, which you were right to treat as the equal half

    • spored now tags `spawn:fsx-dra-status` / `spawn:fsx-dra-error` (mirroring `spawn:dns-status`/`spawn:dns-error`, including clearing a stale error after a later success), and `spawn status` reports it — the filesystem id, the real error, and that it is billing regardless, with `spawn fsx list` / `spawn fsx delete`.
    • The log line no longer says "results may not auto-export to S3". You identified precisely why that was wrong: with `--fsx-import-path` the association is how the data arrives, so the real outcome is an empty filesystem. It now states the consequence for the paths actually given.
    • The synchronous launch path (`pkg/aws/fsx.go`) already returned this error and failed loudly; only the spored-side async path swallowed it. Unchanged, recorded so the asymmetry is known.

    One thing I nearly got wrong

    My first attempt annotated the new policy statement with a `"_comment"` key for readability. IAM rejects unknown statement elements with `MalformedPolicyDocument`, which would have broken every launch on that path rather than degrading it — strictly worse than the bug. There's now a well-formedness test that fails on any non-IAM statement element.

    Ships in the next spawn release. Thanks for the `spored.log` excerpt and the `iam.go` line references — they turned this from a hunt into a confirmation.

  2. added a commit that references this issue on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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