Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EC2 Launch Template: Vpc Subnets support #14494

Open
raimohanska opened this issue May 3, 2021 · 6 comments · May be fixed by #29875
Open

EC2 Launch Template: Vpc Subnets support #14494

raimohanska opened this issue May 3, 2021 · 6 comments · May be fixed by #29875
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/medium Medium work item – several days of effort feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs feature-request A feature should be added or improved. p2

Comments

@raimohanska
Copy link

Would be great to be able to specify network interfaces for a LaunchTemplate.

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 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.

Thanks for your great work!


This is a 🚀 Feature Request

@raimohanska raimohanska added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 3, 2021
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label May 3, 2021
@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p1 labels May 10, 2021
@rix0rrr rix0rrr removed their assignment May 10, 2021
@NGL321 NGL321 added feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs and removed needs-triage This issue or PR still needs to be triaged. labels Jun 2, 2021
@NGL321
Copy link
Contributor

NGL321 commented Jun 2, 2021

Hey @raimohanska,

Thank you for making the request. This seems like a totally reasonable addition to the EC2 Construct Library. After a little digging I found that the feature you want exists in the L1 for EC2 through the LaunchTemplateDataProperty construct (which is a prop of CfnLaunchTemplate), but was never added to the L2. If this is a vital feature, I recommend just using the L1 for the moment.

If you feel comfortable adding this yourself, that will be the fastest way to get it added, otherwise someone from the dev team will take a look as time permits.

😸 😷

@raimohanska
Copy link
Author

Thanks Noah! Good to get some validation for my idea. Unfortunately I cannot promise to be able to make time for implementing this myself, as it would most likely take quite a while to get up to speed with CDK development. It would for sure be an interesting challenge!

I have patched this omission in the CDK by setting subnetId for the instance when creating it using the AWS SDK RunInstances. That's not the ideal solution as it requires an extra call during instance launch, but it does the trick for me for the time being.

@mday-ntirety
Copy link

Bump.

I'm trying to create a launch template through CDK and immediately noticed the l2 constructs were missing the most vital feature that you can do through the AWS console : specify network interfaces.

I see this ticket is not assigned to anyone. Any chance of prioritizing it?

@mhtrinhLIC
Copy link

Anybody kind enough to give me an example on how to specify subnet using LaunchTemplateDataProperty pretty please ?

@MrArnoldPalmer MrArnoldPalmer added p2 and removed p1 labels Jan 27, 2023
@belzano
Copy link

belzano commented Feb 3, 2023

Still no love for that lacking field?
It prevents any kind of automation on launch templates created from the L2 CDK.

@pharindoko
Copy link

Argh still no solution for this ?
This hinders me from creating windows ec2s with fast launch option :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/medium Medium work item – several days of effort feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants