Repository navigation
Closed
Labels
Description
Summary
--command (and the command: field in a launch/spawn config) longer than 256 characters causes RunInstances to fail with:
InvalidParameterValue: Tag value exceeds the maximum length of 256 characters
The instance never launches. This is a hard ceiling on a documented feature (run-a-workload-on-boot), and it's easy to exceed with any non-trivial inline script.
Root cause
spawn delivers the workload by writing it to the spawn:command EC2 tag, which the Linux bootstrap reads at boot:
pkg/launcher/bootstrap.go:426— bootstrap reads the workload from thespawn:commandtag (aws ec2 describe-tags ... Name=key,Values=spawn:command).- The command value is therefore tagged at launch time, and AWS caps tag values at 256 characters, so any longer command is rejected by
RunInstances.
Reproduction (hit live, 2026-06-17)
Via lagotto --action spawn (which maps command → JobArrayCommand → spawn:command tag), a ~1.4 KB inline probe script produced:
auto-spawn failed: ... api error InvalidParameterValue: RunInstances ...
Tag value exceeds the maximum length of 256 characters
Shortening the command to a <256-char one-liner that fetches the real script from S3 worked. So the workload mechanism is fine; only the transport (EC2 tag) is length-limited.
Impact
- Any
spawn launch --command '<longer than 256 chars>'fails to launch. lagotto --action spawnwith a realisticcommand:silently fails the same way (lagotto correctly forwards it; the limit is here).- The failure mode is opaque — the error mentions "Tag value", not "--command too long".
Proposed fixes (in order of preference)
- Don't put the command in a tag. Pass it via EC2 user-data (16 KB limit) — write it to a file in the bootstrap, or base64 it into a
spawn:command-ref. user-data is the natural place for boot workloads. - For long commands, stage to S3 automatically: if
len(command) > N, upload it to the spawn-binaries/scratch bucket and tagspawn:command-s3with the URI; bootstrap fetches+executes. (This is the workaround users currently do by hand.) - At minimum, fail fast with a clear error: if
len(command) > 256and the tag transport is used, error beforeRunInstanceswith "command exceeds 256-char tag limit; use a script URL or user-data", instead of surfacing the raw AWS tag error.
Environment
- spawn (current local build),
lagotto --action spawn, region sa-east-1, AMI on Ubuntu 24.04.
Activity
fix: keyless status over SSM (#222), --command >256 via user-data (#214/
scttfrdmn commentedon Jun 25, 2026
Fixed in #250 (v0.68.0):
--commandis now embedded in user-data instead of the 256-charspawn:commandtag.