Repository navigation
Description
What's missing
emulator/ec2_plugin.go dispatches 80 EC2 actions, including the full instance lifecycle
(RunInstances, DescribeInstances, TerminateInstances, StopInstances, StartInstances,
DescribeInstanceStatus) and launch templates (CreateLaunchTemplate,
DescribeLaunchTemplates). CreateFleet is not one of them.
The only occurrences of "fleet" in the repo are in emulator/iam_managed.go — policy strings
for the unrelated Spot Fleet API (ec2:RequestSpotFleet, ec2:CancelSpotFleetRequests, the
spotfleet.amazonaws.com service principal, the spot-fleet service role ARN). No handler.
Why it's worth having
CreateFleet with Type: instant is the standard way to launch a mixed on-demand/spot,
multi-instance-type, multi-subnet group of instances in one call, and it is what
Slurm-on-AWS autoscaling plugins use for node resume. RunInstances cannot substitute: the
reason to call CreateFleet is the launch-template-override matrix and the partial
fulfillment semantics.
Those semantics are the interesting part to emulate, and they are exactly what is hard to
exercise against real AWS:
- Partial fulfillment. An
instantfleet asking for 12 instances can return 8, with
Errors[]explaining the shortfall (InsufficientInstanceCapacity,
InsufficientFreeAddressesInSubnet) andInstances[]listing what it did create. Callers
routinely get this wrong — the response looks successful, andTotalTargetCapacityis what
you asked for, not what you got. - Overrides.
LaunchTemplateConfigs[].Overrides[]across instance types and subnets, with
AllocationStrategychoosing among them. Placement.GroupNameon the template or the override — a cluster placement group also
constrains fulfillment, since it cannot span AZs.Type: instantvsrequest/maintain, which differ in whether the call returns
instance IDs synchronously at all.
Concrete response shape a caller depends on
From the resume.py path in
scttfrdmn/aws-plugin-for-slurm — the
fields actually read, which is a useful minimum bar for a handler:
response_fleet['Instances'] # list; each has ['InstanceIds'] (a list)
response_fleet.get('Errors', []) # each has ['ErrorCode'], ['ErrorMessage'],
# ['LaunchTemplateAndOverrides']['Overrides']
# -> .get('InstanceType'), .get('SubnetId')
# and .get('Lifecycle')Note Instances[].InstanceIds is a list per entry, not one id — flattening it wrong is a
classic bug, and it only shows up when a fleet returns multiple entries.
Request side, the same caller sends LaunchTemplateConfigs (with Overrides appended per
subnet/instance type), TargetCapacitySpecification, Type: instant, and optionally
OnDemandOptions / SpotOptions (with InstanceInterruptionBehavior).
Suggested shape
A case "CreateFleet" handler that:
- Parses
LaunchTemplateConfigs[]+Overrides[]andTargetCapacitySpecification. - Creates instances through the same path as
runInstancesso they are visible to
DescribeInstances— includingPlacement.GroupNameand tag propagation from
TagSpecifications. Tag propagation matters: callers find their own instances afterward
withDescribeInstances(Filters=[{'Name': 'tag:Name', ...}]), which this emulator already
supports and tests. - Returns
{FleetId, Instances[{InstanceIds, InstanceType, LaunchTemplateAndOverrides}], Errors[]}. - Supports a configurable shortfall — "fulfil N of M and report error code X" — so the
partial path is reachable in tests.
DescribeFleets / DeleteFleets would round it out, but CreateFleet with instant alone
covers the autoscaling use case.
Context, and what is not missing
Came up while building the test suite for a Slurm power-save plugin, whose resume path is a
single CreateFleet call. I checked the rest of that plugin's AWS surface against this
emulator, and CreateFleet is the only gap — its other two calls are covered, including the
exact filter forms it uses:
| Plugin call | Substrate |
|---|---|
create_fleet |
missing |
describe_instances with Filters=[{tag:Name}, {instance-state-name}] |
supported (ec2_plugin.go:512,522) and tested |
terminate_instances |
supported |
I am not blocked. That suite uses a small purpose-built boto3 fake, which I would keep
regardless — fault injection on the partial-fleet path is the entire point of those tests, and
a fake I control is the shortest path to it. Filing because the gap is worth recording, not
because I need it.
Activity
feat(ec2): CreateFleet with seedable partial fulfillment; wire four C…
feat(ec2): CreateFleet with seedable partial fulfillment; wire four C…