aws / aws/aws-cdk

aws-ec2: CapacityReservationSpecification parameter missing in LaunchTemplate construct

Open
#34,921 5 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ec2 effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
71

Description

### Describe the feature

Hello,

I am using AWS Batch to run some GPU-intensive tasks on an EC2-based compute environment that uses p4d.24xlarge instances. Because p4d.24xlarge instances have poor on-demand availability, my team has an on-demand capacity reservation for p4d.24xlarge instances.

However, we define all of our infrastructure using CDK, and we found that the CDK [`LaunchTemplate` construct](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.LaunchTemplate.html) does not contain the [`CapacityReservationSpecification` parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-ec2-launchtemplate-capacityreservationspecification.html) that is part of the EC2 launch template specification. Therefore, we are unable to use our capacity reservation for our AWS Batch jobs, and this results in frequent job failures due to failure in provisioning on-demand p4d.24xlarge instances.

In its current state, it appears that the CDK `LaunchTemplate` construct is not at parity with the CloudFormation specification. When can we expect this to be resolved? And is there a way we can work around the missing CDK parameter?

Thank you

### Use Case

In its current state, the `LaunchTemplate` CDK construct does not match its CloudFormation specification. Without the `CapacityReservationSpecification` parameter, we are unable to use our capacity reservations with our CDK-defined infrastructure. For instance types like p4d that have poor on-demand availability, this results in frequent job failures due to inability to provision instances.

### Proposed Solution

Add `CapacityReservationSpecification` parameter to `LaunchTemplate` construct, in accordance with AWS CloudFormation specification.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS CDK Library version (aws-cdk-lib)

2.204.0

### AWS CDK CLI version

n/a

### Environment details (OS name and version, etc.)

n/a

Contributor guide

Open the contributing guide

Research direction

Start at the AWS CDK aws_ec2 LaunchTemplate construct and compare its parameters with the linked CloudFormation CapacityReservationSpecification specification. Confirm the construct can synthesize the capacity reservation configuration for AWS Batch use; the issue does not name a specific test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.