aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

EKS: `LaunchTemplateSpotOptions` are not supported while create=ing EKS Managed Node Groups with a Launch Template.

Open elamaran11 opened this issue 2 years ago • 5 comments

Describe the bug

Trying to create an EKS Managed Node Group with a Launch Template using CDK EKS/EC2 module with following spot options.

    const launchTemplateSpotOptions: ec2.LaunchTemplateSpotOptions = {
        blockDuration: cdk.Duration.hours(1),
        interruptionBehavior: ec2.SpotInstanceInterruption.STOP,
        maxPrice: 10,
        requestType: ec2.SpotRequestType.ONE_TIME,
        validUntil: cdk.Expiration.after(cdk.Duration.days(90))
    };

EKS Managed Nodegroup creation fails with following error :

7:02:50 PM | CREATE_FAILED        | AWS::EKS::Nodegroup                   | blueprintconstruct...templatengECF74DC1
Resource handler returned message: "Instance market options are not supported with the launch template. (Service: Eks, St
atus Code: 400, Request ID: 2bc085ab-99cd-4486-9f9b-b42153b76d3a)" (RequestToken: a323e32a-614f-6a62-f4ee-01a952674903, H
andlerErrorCode: InvalidRequest)

This clearly shows that NodeGroup creation of EKS wont support Launch template with spot options.

Expected Behavior

EKS Managed Node group creation to support Launch template with Spot options with CDK.

Current Behavior

EKS Managed Nodegroup creation fails with following error :

7:02:50 PM | CREATE_FAILED        | AWS::EKS::Nodegroup                   | blueprintconstruct...templatengECF74DC1
Resource handler returned message: "Instance market options are not supported with the launch template. (Service: Eks, St
atus Code: 400, Request ID: 2bc085ab-99cd-4486-9f9b-b42153b76d3a)" (RequestToken: a323e32a-614f-6a62-f4ee-01a952674903, H
andlerErrorCode: InvalidRequest)

Reproduction Steps

Try to create a Launch template with following options and use the same while creating EKS Node Group.

    const launchTemplateSpotOptions: ec2.LaunchTemplateSpotOptions = {
        blockDuration: cdk.Duration.hours(1),
        interruptionBehavior: ec2.SpotInstanceInterruption.STOP,
        maxPrice: 10,
        requestType: ec2.SpotRequestType.ONE_TIME,
        validUntil: cdk.Expiration.after(cdk.Duration.days(90))
    };

Possible Solution

Adding support for EKS Managed Node group creation to support Launch template with Spot options with CDK.

Additional Information/Context

No response

CDK CLI Version

2.67

Framework Version

No response

Node.js Version

v19.6.1

OS

Mac/Ubuntu

Language

Typescript

Language Version

No response

Other information

No response

elamaran11 avatar Mar 21 '23 19:03 elamaran11

I am afraid this is a limitation from EKS or CFN. Thanks for the report. I will circle back if I have any updates.

pahud avatar Mar 21 '23 19:03 pahud

Hi

According to this document, RequestSpotInstances is not supported in LuanchTemplate so I am afraid it's the limit from EKS rather than CDK.

pahud avatar Mar 22 '23 01:03 pahud

Hi @pahud Thankyou for your response. I understand your pointers. The request is for SpotOptions, Spot Instances does work for us. I do see that EKS Managed Node Groups is not supporting Spot Options though it supports to create MNG with LaunchTemplate having spot reference. We raised this request to check if there is a way to get over this limitation.

elamaran11 avatar Mar 22 '23 14:03 elamaran11

@elamaran11 Thank you for clarification. This seems to be a limitation on CFN side that CDK would probably not be able to work around. I would suggest open an issue on aws/containers-roadmap and link back to this issue. I believe the container team would love to hear customer feedback like this. By the time CFN remove this blocker, CDK would be able to support it I believe.

pahud avatar Mar 24 '23 19:03 pahud

https://github.com/aws/containers-roadmap/issues/1575 @pahud There is already a ticket on Containers Roadmap for this. Should we keep this ticket active until this is resolved.

elamaran11 avatar Mar 25 '23 02:03 elamaran11