Skip to content

ec2: DescribeInstances and DescribeInstanceAttribute report no blockDeviceMapping #669

Closed

Description

@scttfrdmn

Context

v0.103.0 (#666) made a launch's block device mappings observable by materializing real
volumes, so DescribeVolumes now answers "how large is this instance's root volume". It
deliberately stopped short of rendering the mappings on the instance itself.

Two surfaces are still silent:

  • DescribeInstances renders no blockDeviceMapping set, so a caller cannot learn a
    device's volumeId or deleteOnTermination without going to DescribeVolumes and
    filtering on attachment.instance-id. Real EC2 answers it directly.
  • DescribeInstanceAttribute still refuses blockDeviceMapping explicitly
    (emulator/ec2_instanceattribute.go), which was correct when there was nothing to
    render and is now a refusal of a question substrate can answer.

Why it was deferred rather than folded into #666

AWS's EbsInstanceBlockDevice — the shape both surfaces render per device — carries
associatedResource, attachTime, deleteOnTermination, ebsCardIndex, operator,
status, volumeId and volumeOwnerId, and no size. So neither surface would have
closed #666's gap, and adding them would have been scope beside the fix rather than part
of it. The state they need now exists.

Acceptance criteria

  • DescribeInstances renders blockDeviceMapping>item per attached EBS volume, with
    deviceName and an ebs sub-element carrying volumeId, status, attachTime and
    deleteOnTermination — the members AWS's own sample response shows, and no
    fabricated ones.
  • RunInstances' response renders the same set, since the reference shows it there too.
  • DescribeInstanceAttribute with Attribute=blockDeviceMapping answers rather than
    refusing, and blockDeviceMapping leaves the explicit-refusal list with a test
    asserting the refusal list shrank deliberately.
  • An instance-store device (VirtualName, no Ebs.*) is not reported as an EBS
    mapping, matching what EC2: RunInstances' inline BlockDeviceMapping.N.Ebs.* is parsed nowhere and never reaches DescribeVolumes #666 already decided for DescribeVolumes.
  • The set is derived from the volumes, not from the recorded request, so a volume
    detached after launch stops appearing and one attached later starts.
  • docs/services.md — the launch-time storage subsection's "not modeled" paragraph is
    updated.
  • CHANGELOG.md under ## [Unreleased].

Activity

  1. modified the milestones: v0.104.0, v0.105.0 on Aug 20, 2026
  2. scttfrdmn commented on Aug 20, 2026

    @scttfrdmn
    OwnerAuthor

    Moved to milestone v0.105.0. v0.104.0 ships the #662 privilege-boundary fix alone, matching how #660 shipped as v0.102.0 — a false-allow in the authorization path gets a release to itself.

    Research findings

    Verified against the AWS EC2 API reference and the tree this session:

    • AWS's InstanceBlockDeviceMapping has exactly two members, deviceName and ebs. EbsInstanceBlockDevice has eight, of which substrate can honestly source four: volumeId, status, attachTime, deleteOnTermination. That is exactly what the DescribeInstances sample response shows, and in that order — so the acceptance criterion's member list is the right one and needs no widening.
    • RunInstances' own sample response emits <blockDeviceMapping /> (empty), because the instance in that sample is still pending. Worth deciding deliberately whether substrate matches that or renders the mappings it has just created.
    • The "refusal list" this issue refers to is really the default arm of ec2AttributeSupported's allow-list (emulator/ec2_instanceattribute.go:157-165) — there is no explicit deny list. So the change is "the allow-list grew, and the refusal test row at emulator/ec2_instanceattribute_test.go:259 is deleted", which is what the "refusal list shrank deliberately" criterion should assert against.
    • EC2Instance has no BlockDeviceMappings field, so deriving the response from the volume records EC2: RunInstances' inline BlockDeviceMapping.N.Ebs.* is parsed nowhere and never reaches DescribeVolumes #666 created is not merely preferable — it is the only possible implementation. The "derived from the volumes, not the recorded request" criterion is therefore free.
    • The groupSet pointer-wrapper lesson (emulator/ec2_instanceattribute.go:63-70) applies verbatim to this attribute's response shape: an SDK distinguishes an empty array from a nil one, so an instance with no EBS mappings must render an empty blockDeviceMapping element rather than omitting it.
    • Incidental but in the blast radius: ec2_plugin.go holds two duplicate function-local ec2InstanceItem structs (:784 and :943). Rendering a new member means editing both. They should be hoisted, following ec2GroupItem (:649) whose comment records the EC2: launch template NetworkInterfaces is dropped, so template-specified subnets are ignored #444 drift bug this exact duplication caused before.
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