Skip to content

EC2: only network interface index 1 is modeled on RunInstances and launch templates #455

Closed

Description

@scttfrdmn

What

Both runInstances and (as of #444) createLaunchTemplate read only NetworkInterface.1.*. A request or template declaring a second interface loses it silently — no error, and the instance comes back with one interface.

v0.84.0 documents this as a known limit in docs/services.md rather than leaving it to be rediscovered. This issue tracks lifting it.

Filed as a limit rather than a bug: multi-interface instances are a real AWS pattern but a much smaller consumer need than the index-1 case, and the parsl-aws-provider reports that produced #443/#444 did not hit it.

Acceptance criteria

  • NetworkInterface.N.* parsed for all N on RunInstances, contiguously from 1, stopping at the first gap (match the existing indexedParams convention).
  • Same for LaunchTemplateData.NetworkInterface.N.*.
  • DeviceIndex respected rather than assumed from the parameter index — AWS keys interface identity on DeviceIndex, and the two need not agree.
  • Decide and document how a multi-interface instance reports subnetId, privateIpAddress and groupSet at the top level: real AWS reports the primary interface's (DeviceIndex=0) values there. Confirm against the API reference.
  • Consider whether networkInterfaceSet should be emitted in DescribeInstances — check what real EC2 returns before deciding scope.
  • Existing index-1 behaviour unchanged; the ec2_launchtemplate_test.go suite is the regression surface.
  • docs/services.md drops the "only interface index 1 is modeled" note.

Activity

  1. modified the milestones: v0.85.0, v0.86.0 on Aug 1, 2026
  2. scttfrdmn commented on Aug 2, 2026

    @scttfrdmn
    OwnerAuthor

    Moved from the v0.85.0 milestone to v0.86.0, which is now cut and closed.

    v0.85.0 shipped four bounded defect fixes (#452, #453, #458, #461). This one was
    deliberately left out as feature-scale rather than defect-scale: modelling a
    second network interface is new behaviour, not a wrong answer being corrected.

    It became more visible in v0.85.0, though, and that is worth recording here.
    #453 made runInstances read a launch template even when the request also passes
    ImageId, so a template's network-interface block is now consulted on launches
    that previously skipped it entirely. That widens the set of requests reaching the
    index-1-only limitation — the limitation is unchanged, but it is easier to hit.

    No work has started. Nothing about the issue's analysis has changed.

  3. modified the milestones: v0.86.0, v0.87.0, v0.88.0 on Aug 2, 2026
  4. scttfrdmn commented on Aug 2, 2026

    @scttfrdmn
    OwnerAuthor

    Deferred again — moved from v0.87.0 to v0.88.0. Second deferral (it also came out of v0.86.0), so recording the reasoning.

    Why it moved. The issue's own framing still holds: this is a limit, not a defect, and the consumer pull is smaller than the index-1 case. What moved it out of v0.87.0 specifically is that two of its acceptance criteria are open design questions rather than implementation work — how a multi-interface instance reports top-level subnetId/privateIpAddress/groupSet, and whether networkInterfaceSet should appear in DescribeInstances at all. Both need the API reference consulted and a decision written down before any code, and v0.87.0 was already carrying nine consumer-filed items. Pairing this with #411 in v0.88.0 gives it room to be designed rather than squeezed.

    Whether the shipped releases changed the analysis. Two things are now different, and both make this easier rather than harder:

    • v0.86.0's EC2: CreateLaunchTemplateVersion and ModifyLaunchTemplate are unregistered #456 introduced launch-template versioning, so LaunchTemplateData is now stored per version behind templateVersions(). The LaunchTemplateData.NetworkInterface.N parsing this issue asks for lands in parseLaunchTemplateData, which every version now flows through — so the fix applies to all versions of a template by construction, with no per-version special case. That was not true when the issue was filed.
    • v0.86.0's EC2: launch template NetworkInterfaces is dropped, so template-specified subnets are ignored #444 work established the groupSet reporting shape on DescribeInstanceAttribute, and its fix (emit the parent element only when set) is the same trap the fourth criterion here has to navigate: Go's encoding/xml emits the parent of an a>b path even for an empty slice, so a networkInterfaceSet added carelessly will appear on every instance. Worth knowing before writing the response struct.

    v0.87.0 does not touch the network-interface path, so the criteria stand as written.

  5. modified the milestones: v0.88.0, v0.89.0 on Aug 3, 2026
  6. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Moved from v0.88.0 to v0.89.0. Third deferral (v0.86.0 → v0.87.0 → v0.88.0 → v0.89.0), so recording it as with the previous two.

    Why it moved. v0.88.0 was retargeted onto the CloudFormation resolver cluster (#521, #522, #526, #527) after v0.87.0 shipped CloudFormation over the wire and a consumer immediately filed four priority: high defects against it — two on the resolver, which is one change touching one function. This issue's own framing is unchanged and still correct: a limit, not a defect, with two acceptance criteria that are design questions rather than implementation work. It keeps its pairing with #411, which also moved.

    Whether the shipped releases changed the analysis. One thing is now different, and it is a finding worth having before starting.

    The CloudFormation launch-template deploy path forwards no network-interface block at all. deployEC2LaunchTemplate (emulator/betty_cfn_v77_plugins.go:21) enumerates exactly four members of LaunchTemplateData — ImageId, InstanceType, KeyName, UserData — plus SecurityGroupIds, and nothing else. So a CloudFormation template writing

    LaunchTemplateData:
      NetworkInterfaces:
        - DeviceIndex: 0
          SubnetId: !Ref PrivateSubnet
          Groups: [!Ref WorkerSG]

    loses the subnet and the groups entirely — not "only index 1 is modeled", but zero interfaces modeled — because the property never reaches parseLaunchTemplateData, which is where the index-1 limitation this issue describes actually lives (emulator/ec2_plugin.go:4292). Note also that CloudFormation spells the property NetworkInterfaces (a list) while the EC2 query API spells it NetworkInterface.N, so the CFN path needs a list-to-indexed translation that does not exist yet.

    That widens this issue by one acceptance criterion, and it is arguably the most consumer-visible part of it: declaring a subnet on a launch template's interface is how the AWS docs tell you to launch into a non-default subnet, and it is the same class of silent loss as #444. Adding a criterion:

    • deployEC2LaunchTemplate forwards LaunchTemplateData.NetworkInterfaces (CFN's list form) to LaunchTemplateData.NetworkInterface.N.* (the query form), for all N, including DeviceIndex, SubnetId, Groups/SecurityGroupIds, AssociatePublicIpAddress.

    The other v0.86.0/v0.87.0 notes from the previous comment still hold: parseLaunchTemplateData is the single choke point every template version flows through, and encoding/xml will emit a networkInterfaceSet parent for an empty slice unless the response struct guards it (the #444 trap).

  7. modified the milestones: v0.89.0, v0.90.0 on Aug 3, 2026
  8. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Moved to v0.90.0 (second deferral). v0.89.0 is scoped to the CloudFormation
    delete/rollback cluster (#518, #508, #534, #520), which shares no code with this.

    Re-checked against main at v0.88.0: nothing in v0.88.0 or the v0.89.0 plan touches
    this, and the analysis recorded on the previous move still holds.

    deployEC2LaunchTemplate (emulator/betty_cfn_v77_plugins.go:21) still enumerates
    LaunchTemplateData key by key — ImageId, InstanceType, KeyName, UserData,
    plus SecurityGroupIds — and forwards no network interface at all. So the CFN
    path's gap remains "none modeled", not "only index 1"; that framing applies to the
    RunInstances/launch-template query API, and the two need separate criteria.

    Worth noting v0.88.0's resolveNested did not change this: LaunchTemplateData is
    enumerated rather than forwarded whole, so it never went through the new deep
    resolver. A NetworkInterfaces list added here will need its interior resolved
    explicitly, which is a small addition to this issue's scope rather than something
    v0.88.0 already handled.

  9. scttfrdmn commented on Aug 4, 2026

    @scttfrdmn
    OwnerAuthor

    Staying in v0.90.0 — its second deferral ends here. Confirmed against v0.89.0
    that nothing in v0.88.0, v0.89.0 or the #549 rename touched the parse sites:
    runInstances still reads NetworkInterface.1.* only (emulator/ec2_plugin.go:343-362)
    and createLaunchTemplate still carries the comment documenting the limit
    (:4278, const niPrefix = ltPrefix + "NetworkInterface.1." at :4292).

    One finding that shapes the work and is not in the acceptance criteria: there is
    nowhere to put a second interface.
    EC2Instance (emulator/ec2_types.go:50-69) has
    flat SubnetID, PrivateIPAddress and SecurityGroupIDs fields and no interface
    list, and ec2GroupItems (:619) builds the groupSet response from that flat
    SecurityGroupIDs. So this is a state shape change plus a response decision, not just
    a parse loop — which is worth knowing before starting, since it is where the estimate
    actually lives.

    The plan is to add an interface slice alongside those fields rather than replacing
    them, and keep the flat fields reporting the primary (DeviceIndex=0) interface's
    values, which is what real EC2 puts at the top level — to be confirmed against the
    RunInstances/DescribeInstances references before writing it, along with the open
    networkInterfaceSet question the issue already raises. indexedParams
    (emulator/ec2_plugin.go:2881) is the existing "contiguous from 1, stop at the first
    gap" convention to follow for the N loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions