Skip to content

Generic Cluster Provider: Unable to use custom AMI on custom launch template #1206

@Falco152

Description

@Falco152

Describe the bug

Using the generic cluster provider, when provided with specified a launch template with a custom AMI, it is not possible to deploy due to error You cannot specify on AMI Type other than CUSTOM, when specifying an image id in your launch template

Expected Behavior

Able to successfully deploy node groups with the specified AMI

Current Behavior

CloudFormation failed status with error You cannot specify on AMI Type other than CUSTOM, when specifying an image id in your launch template

Reproduction Steps

  • Create a new launch template and specify an image id
  • Configure generic cluster provider using managedNodeGroups with launchTemplateSpec that reference the launch template

Possible Solution

Workround: Use 1.17.2

Additional Information/Context

Identified cause -

addManagedNodeGroup(cluster: eks.Cluster, nodeGroup: ManagedNodeGroup): eks.Nodegroup {
const capacityType = nodeGroup.nodeGroupCapacityType;
const releaseVersion = nodeGroup.amiReleaseVersion;
const instanceTypeContext = utils.valueFromContext(cluster, constants.INSTANCE_TYPE_KEY, constants.DEFAULT_INSTANCE_TYPE);
const instanceTypes = nodeGroup.instanceTypes ?? ([typeof instanceTypeContext === 'string' ? new ec2.InstanceType(instanceTypeContext) : instanceTypeContext]);
const amiType = nodeGroup.amiType ?? constants.DEFAULT_AMI;
const minSize = nodeGroup.minSize ?? utils.valueFromContext(cluster, constants.MIN_SIZE_KEY, constants.DEFAULT_NG_MINSIZE);
const maxSize = nodeGroup.maxSize ?? utils.valueFromContext(cluster, constants.MAX_SIZE_KEY, constants.DEFAULT_NG_MAXSIZE);
const desiredSize = nodeGroup.desiredSize ?? utils.valueFromContext(cluster, constants.DESIRED_SIZE_KEY, minSize);
// Create a managed node group.
const nodegroupOptions: utils.Writeable<eks.NodegroupOptions> = {
...nodeGroup,
...{
nodegroupName: nodeGroup.nodegroupName ?? nodeGroup.id,
capacityType,
instanceTypes,
amiType,
minSize,
maxSize,
desiredSize,
releaseVersion,
subnets: nodeGroup.nodeGroupSubnets
}
};

amiType when undefined would implicitly default the AMI type to CUSTOM?
amiType, now defaults to AL2023_X86_64_STANDARD

CDK CLI Version

2.1031.0

EKS Blueprints Version

1.17.3

Node.js Version

v24.11.0

Environment details (OS name and version, etc.)

macOS 15.7.1

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions