Skip to content

EC2: preserve device names and security groups in launch template data - #10530

Open
dailyun wants to merge 1 commit into
getmoto:masterfrom
dailyun:codex/ec2-launch-template-config
Open

dailyun wants to merge 1 commit into
getmoto:masterfrom
dailyun:codex/ec2-launch-template-config

Conversation

@dailyun

@dailyun dailyun commented Nov 3, 2026

Copy link
Copy Markdown

GetLaunchTemplateData currently replaces every block-device name with "string" and serializes each network interface's security-group ID as a stringified dictionary (for example, "{'GroupId': 'sg-…'}"). Creating a launch template from the returned data therefore preserves neither the device names nor the security-group IDs of the source instance.

Return the existing device-map keys and a list of security-group ID strings. The regression test covers one and two devices/groups and verifies that the exported values survive creating and describing a launch template.

The response shapes follow the AWS references for block device mappings and network interface groups.

Validation (Python 3.12, locally mocked AWS):

  • Both parameterized regressions fail on the original device mapping; after fixing that field alone, both still fail on the security-group mapping.
  • pytest -q tests/test_ec2/test_launch_templates.py: 37 passed.
  • pytest -q tests/test_ec2/test_instances.py tests/test_ec2/test_elastic_network_interfaces.py: 157 passed.
  • Ruff 0.14.10 check and format checks pass for both changed files; git diff --check passes.

No live AWS verification was performed. OpenAI Codex assisted with the implementation and local validation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant