aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code

Home Page:https://aws.amazon.com/cdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Artemigos opened this issue · comments

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:

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

  • 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

@Artemigos Yes we should support that.

  1. when CUSTOM is provided, a launch template has to be provided as well.
  2. we probably should add CUSTOM to possibleAmiTypes here:

possibleAmiTypes = getPossibleAmiTypes(instanceTypes);

Feel free to submit a PR for it. Thank you.