aws / aws/aws-cdk

EC2 Launch Template: Vpc Subnets support

Open
#14,494 9 comments 35 reactions 0 assignees View on GitHub
@aws-cdk/aws-ec2 effort/medium feature-request feature/coverage-gap p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

Would be great to be able to specify network interfaces for a [LaunchTemplate](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.LaunchTemplate.html).

### Use Case

We are building an application where EC2 instances need to be launched/autoscaled in the application logic and the best abstraction for this would be to have a launch template that contains all the necessary details for launching an instance, without having to worry about things like subnets.

### Proposed Solution

Include the [vpcSubnets](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Instance.html#vpcsubnets) fields in LaunchTemplate, similarly to what you can do with an Instance.

### Other

I'm not super deep into CDK/CloudFormation/EC2 details, so my proposed change may have the wrong abstractions. Still, being able to specify the networking configuration in a LaunchTemplate would be awesome. Just for reference, I've done the same thing earlierly with Terraform, which does support Network Interfaces in launch tempalates, as described in [here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template).

Thanks for your great work!

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Research direction

Begin with the LaunchTemplate and Instance APIs, then compare their vpcSubnets behavior with the AWS CloudFormation and EC2 Launch Template capabilities referenced in the issue. Confirm that the requested networking configuration can be represented in a launch template and that the proposed abstraction supports the stated autoscaling use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.