Repository navigation
docs(snapshot): document EBS-direct perms + --iam-policy-file build path (#579) - #583
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…cument --iam-policy-file path (#579) snapshot create runs with the caller's credentials and needs the EBS-direct actions (ebs:StartSnapshot/PutSnapshotBlock/CompleteSnapshot + ec2:DescribeSnapshots) plus source-bucket read. A stock 'spawn launch' instance (spored-instance-role) has none of these, so the documented in-region build path failed with AccessDenied and the prerequisite was unstated. - snapshot create --help (Long) + docs/reference-data-volumes.md now spell out the required permissions and that the command uses the caller's creds, not a spawn-managed instance. - Document the existing, supported way to build from a spawn-launched instance: pass --iam-policy-file with a scoped policy (no new flag / standing grant). - Add examples/iam/snapshot-build-policy.json (ready-to-edit) + a JSON-validity test guarding it contains the required actions. Fixes #579
scttfrdmn
force-pushed
the
fix/579-snapshot-build-perms-docs
branch
from
September 9, 2026 18:58
530f187 to
638c17f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #579.
Problem
spawn snapshot create --helprecommends building large snapshots "from AWS CloudShell or a small in-region EC2 instance." The obvious in-region instance isspawn launch, but such an instance runs as the sharedspored-instance-role, which is denied at two points:s3:ListBucket/s3:GetObject).ebs:StartSnapshot/PutSnapshotBlock/CompleteSnapshotare not in its policy.So the documented path can't be satisfied by a
spawn launchinstance, and that prerequisite was stated nowhere.What I did — options 1 + 3 (documentation), plus documenting the existing
--iam-policy-filepathNo new flag, no change to the
spored-instance-rolebaseline.I verified that
--iam-policy-filealready provides a working path:cmd/launch_single.go:ensureIAMProfilepassesiamPolicyFileintoIAMRoleConfig.PolicyFile, andCreateOrGetInstanceProfile(pkg/aws/iam.go) attaches that JSON as an inline policy on a dedicatedspawn-instance-<hash>role/profile — notspored-instance-role. So a user can give exactly one instance the EBS-direct + source-bucket perms today. A bespoke--for-snapshot-buildflag would be redundant (and a standing IAM-surface change I deliberately avoided), so I documented the existing supported path instead.Changes:
spawn snapshot create --help(Long) now states the command runs with the caller's credentials (not a spawn-managed instance), lists the required actions (ebs:StartSnapshot/PutSnapshotBlock/CompleteSnapshot+ec2:DescribeSnapshots+ source-bucket read), and notes a stockspawn launchinstance (spored-instance-role) lacks them.docs/reference-data-volumes.mdmirrors the note with a "Credentials the builder needs" subsection and a workedspawn launch --iam-policy-file …example.examples/iam/snapshot-build-policy.json— ready-to-edit scoped policy (threeebs:actions onsnapshot/*,ec2:DescribeSnapshots, and source-bucket read with aYOUR-SOURCE-BUCKETplaceholder).pkg/aws/snapshot_build.go(StartSnapshot/PutSnapshotBlock/CompleteSnapshot + DescribeSnapshots waiter; tags ride on StartSnapshot, so noec2:CreateTags).Tests
cmd/snapshot_test.go:TestSnapshotBuildPolicyExampleWellFormedasserts the example policy is well-formed JSON and contains the four required actions (fails if the example drifts or breaks).Checks
make check— pass.make gen-docs+make check-docs— regenerateddocs-gen/snapshot.md, clean.lambda/autoscale-orchestrator/autoscale-orchestratorbinary reverted; no nested lambda go.mod drift (no dependency/lambda code touched).