Description
Problem
RunInstances does not return a tagSet for tags applied at launch via TagSpecifications, even though the instance stores them correctly (a subsequent DescribeInstances renders them fine). Real EC2 does populate Instances[].Tags in the RunInstances response for launch-time tags, so SDK callers that read the returned instance's tags get an empty set against substrate but a populated one against AWS — a fidelity gap.
Reproduction (v0.72.0)
curl -s -X POST http://localhost:4566/ \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: AWS4-HMAC-SHA256 Credential=test/.../ec2/aws4_request" \
-d "Action=RunInstances&Version=2016-11-15&MinCount=1&MaxCount=1&InstanceType=c6a.xlarge&ImageId=ami-12345678&TagSpecification.1.ResourceType=instance&TagSpecification.1.Tag.1.Key=Name&TagSpecification.1.Tag.1.Value=echo-test&TagSpecification.1.Tag.2.Key=spawn:managed&TagSpecification.1.Tag.2.Value=true"
# RunInstancesResponse has NO <tagSet> on the instance item
# but the tags ARE stored:
curl ... -d "Action=DescribeInstances&Filter.1.Name=tag:Name&Filter.1.Value.1=echo-test"
# DescribeInstancesResponse DOES contain <tagSet>…</tagSet>Root cause
In emulator/ec2_plugin.go, runInstancesResponse (~line 446) defines a local ec2InstanceItem struct that has no tagSet field, and the population loop never copies inst.Tags:
type ec2InstanceItem struct {
InstanceID string `xml:"instanceId"`
// …ImageID, InstanceType, State, etc.
// (no Tags field)
}Contrast the DescribeInstances item type (~line 591), which already has:
Tags []tagItem `xml:"tagSet>item"`and renders correctly.
Suggested fix
Add the same tagSet field to the RunInstances item struct and populate it from inst.Tags in the build loop (the data is already on the EC2Instance), mirroring the DescribeInstances renderer. RunInstances, StartInstances, and StopInstances responses on real EC2 all echo the instance's tagSet — worth checking the stop/start responses for the same omission while in there. Happy to send a PR.
Impact / context
Found building spawn-ts (browser EC2 launcher; consumer of substrate via the CORS support added in #346). Its RunInstances wrapper built the launched instance's view from the response and got zero tags back, so all lifecycle config (TTL/idle/cost, decoded from spawn:* tags) was silently empty on the returned object until a re-describe. I worked around it on my side by trusting the tags I sent, but the response should match AWS. The integration test that caught it:
RunInstancesResponseshould include<tagSet>with every tag from the launch'sTagSpecificationentries whoseResourceType=instance.
Environment: substrate v0.72.0, EC2 API version 2016-11-15.
Activity
scttfrdmn commentedon Jul 20, 2026
Verified the fix on
784f9af:RunInstancesnow returns the<tagSet>inside the instance item, matching real EC2:Also checked the Stop/Start responses I mentioned above: real EC2's
StopInstances/StartInstancesreturn onlycurrentState/previousStateper instance and no tagSet, and substrate matches that — so there's no equivalent gap there. Confirmed against spawn-ts's integration suite. Thanks for the quick turnaround; leaving this to close on the next tagged release.fix(ec2): RunInstances response includes tagSet for launch-time tags (#…
chore(release): v0.73.0 (#353)