Skip to content

ec2: Add support for security groups from NetworkInterfaces in RunInstances#145

Open
nik-localstack wants to merge 1 commit intolocalstack:localstackfrom
nik-localstack:unc-383-bug-ec2-instances-created-from-launch-templates-with
Open

ec2: Add support for security groups from NetworkInterfaces in RunInstances#145
nik-localstack wants to merge 1 commit intolocalstack:localstackfrom
nik-localstack:unc-383-bug-ec2-instances-created-from-launch-templates-with

Conversation

@nik-localstack
Copy link

When launching an instance using a launch template that specifies security groups via NetworkInterfaces[].Groups (as tools like Karpenter do), the resulting instance's SecurityGroups field was always empty in DescribeInstances. This is because run_instances only copied SecurityGroupIds from the launch template, not the groups embedded in network interfaces.

The same issue affected NetworkInterfaces passed directly in a RunInstances request.

This PR fixes both cases by collecting security groups from NetworkInterfaces[].Groups when no top-level SecurityGroupIds are present.

@nik-localstack nik-localstack self-assigned this Mar 25, 2026
@nik-localstack nik-localstack force-pushed the unc-383-bug-ec2-instances-created-from-launch-templates-with branch 2 times, most recently from 4643b6c to cc5fd0c Compare March 25, 2026 21:34
@nik-localstack nik-localstack force-pushed the unc-383-bug-ec2-instances-created-from-launch-templates-with branch from cc5fd0c to 9756b45 Compare March 25, 2026 21:41
@nik-localstack nik-localstack marked this pull request as ready for review March 25, 2026 22:02
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