aws / aws/aws-cdk

aws-eks: Support `CUSTOM` AMI type on Nodegroups

Open
#30,641 1 comment 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-eks @aws-cdk/aws-eks-v2-alpha effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

CloudFormation supports passing `CUSTOM` as value for `AmiType`: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-amitype

This is not available in CDK, making the use of custom AMIs impossible.

### Use Case

When building custom AMIs for a cluster (e.g. based on the EKS optimized images) you should be able to use them.

### Proposed Solution

Rough idea:
- add the `CUSTOM` type to the enum: https://github.com/aws/aws-cdk/blob/3b95777ee5dae32fd41481d81922d07c804a2c6b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts#L29
- modify https://github.com/aws/aws-cdk/blob/3b95777ee5dae32fd41481d81922d07c804a2c6b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts#L635 to append `CUSTOM` as the last option for all architectures

It looks like this should already be enough, but I didn't actually attempt doing this.

### Other Information

I tried forcing the issue by bypassing TypeScript checks: `amiType: ('CUSTOM' as any)` - internal check rejected it. After investigating a little - the `Nodegroup` constructor tries to do the right thing and validates the value, but completely ignores the existence of `CUSTOM` in CloudFormation.

### Acknowledgements

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

### CDK version used

2.133.0

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

Ubuntu 22.04.4 LTS

Contributor guide

Open the contributing guide

Research direction

Start in packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts, reading the AMI type enum, the architecture mapping around line 635, and the Nodegroup constructor validation. Add support for CUSTOM in the relevant paths, then verify that a node group using a custom AMI type synthesizes successfully for each supported architecture.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.