ec2_launch_probe
The EC2 control plane, timed from a box: the current Spot price and offering of an
instance type in a zone (read-only), or how long one instance takes from RunInstances to
running, with capacity errors recorded as evidence. Only the read-only spot_price mode
is scheduled; the binary also runs launch_ready, which is not scheduled yet.
What a figure means
Mode spot_price: each sample (repetitions 1) calls DescribeSpotPriceHistory and
DescribeInstanceTypeOfferings for target_instance_type in target_zone; its time is
both calls, DNS, TCP and TLS included (one connection per call). Mode launch_ready: each
sample calls RunInstances, then polls DescribeInstances every interval_ms until the
instance is running; the sample ends with the response that said so, so the figure is
coarse by up to one interval. Either way an op_histogram (metric ec2_probe_latency)
holds the counted samples that succeeded: both calls' time, or launch to running.
What a figure does not show
- Boot time:
runningis EC2's state, not the operating system being up. - Every zone: one instance type in one zone per parameter set.
- A Spot price that holds: the price read is the one in effect at the call.
Parameters
The benchmark's Series and their figures are listed at https://api.ledgermath.com/v1/benchmarks/ec2_launch_probe.json.
| Variable | --quick default | Meaning |
|---|---|---|
LM_PARAM_MODE | spot_price | spot_price or launch_ready |
LM_PARAM_TARGET_INSTANCE_TYPE | m7g.medium | The instance type |
LM_PARAM_TARGET_ZONE | us-east-2a | The Availability Zone |
LM_PARAM_IMAGE_ID, LM_PARAM_SUBNET_ID | unset | launch_ready: the AMI (required) and subnet (optional) |
LM_PARAM_INTERVAL_MS | 2000 | Pause between spot_price samples, and between polls |
LM_PARAM_LAUNCH_TIMEOUT_SECONDS | 300 | How long to wait for running |
LM_PARAM_TIMEOUT_MS | 5000 | Each read, write, connect and DNS reply |
LM_PARAM_BUDGET_SECONDS | 300 | No sample starts after this |
LM_PARAM_CA_FILE, LM_PARAM_RESOLV_CONF, LM_PARAM_AUTH | as http_get | CA bundle, resolver, sigv4 or none |
Service inputs: LM_SERVICE_ENDPOINT, LM_SERVICE_REGION and the LM_SERVICE_AWS_*
credentials. Every credential and signature is kept off stdout by lm_lines' guard.
Observed values
| Key | What it is |
|---|---|
mode, target_instance_type, target_zone, region, host, port | What was probed |
tls_library, ca_file_sha256, resolver, auth, api_version | How |
calls_made, calls_failed, instances_launched, instances_terminated, capacity_errors | After the samples |
Each sample is followed by ec2_probe (spot_price_usd as EC2 wrote it,
offering_available, launch_to_running_ns, capacity_error, status), each call by
ec2_call or ec2_probe_failed (status, EC2's error code, request ID and the names of the
error's elements; never its message, which may echo a credential; a field too long to keep
is withheld whole, never cut), each launched instance by ec2_terminate, and each search by
client token by ec2_reconcile.
Findings
- c8g.2xlarge Spot in us-east-2b: $0.1315 an hour on 2026-12-02, offered in the zone; the two calls took 65 to 110 ms together from a box in us-east-2.
How it works
launch_ready always terminates what it launched, after the sample, also on SIGTERM. Each
instance is launched with InstanceInitiatedShutdownBehavior terminate and user-data that
shuts it down ten minutes after boot, so it ends even if the binary is killed outright. A
RunInstances whose outcome is unknown (no response, a 5xx other than a capacity refusal, a
2xx without an instance ID) is followed by DescribeInstances by its client token, up to five
times, interval_ms apart and doubling (each pause, the first too, at most 8 s), as EC2's
reads lag its writes, and what it finds is
terminated; if nothing is found, or a termination is not confirmed, no other instance is
launched and the Run exits 1. An InsufficientInstanceCapacity is an ec2_probe_failed
event and the Run goes on (ADR-0028). Core files are off and the process is not dumpable
before a credential is read. Exit codes: 0 every call succeeded; 4 a call failed or the Run
ended early; 1 a fatal setup error, or an instance not confirmed terminating; 2 a bad
parameter; 3 stdout failed.
Building and testing
make BUILD=static AWS_LC_ARCHIVE=<path> builds AWS-LC as http_get does. bun test tests/net-and-ec2-benchmarks.test.ts runs both modes against a local EC2 stand-in.