diff --git a/packages/aws-cdk-lib/aws-eks/README.md b/packages/aws-cdk-lib/aws-eks/README.md index bbd31e8987b76..c3377be2b0957 100644 --- a/packages/aws-cdk-lib/aws-eks/README.md +++ b/packages/aws-cdk-lib/aws-eks/README.md @@ -187,7 +187,6 @@ cluster.addNodegroupCapacity('custom-node-group', { instanceTypes: [new ec2.InstanceType('m5.large')], minSize: 4, diskSize: 100, - amiType: eks.NodegroupAmiType.AL2_X86_64_GPU, }); ``` @@ -207,6 +206,24 @@ cluster.addNodegroupCapacity('custom-node-group', { }); ``` +To define the type of the AMI for the node group, you may explicitly define `amiType` according to your requirements, supported amiType could be found [HERE](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts#L562-L565). + +```ts +declare const cluster: eks.Cluster; + +// X86_64 based AMI managed node group +cluster.addNodegroupCapacity('custom-node-group', { + instanceTypes: [new ec2.InstanceType('m5.large')], // NOTE: if amiType is x86_64-based image, the instance types here must be x86_64-based. + amiType: eks.NodegroupAmiType.AL2023_X86_64_STANDARD, +}); + +// ARM_64 based AMI managed node group +cluster.addNodegroupCapacity('custom-node-group', { + instanceTypes: [new ec2.InstanceType('m6g.medium')], // NOTE: if amiType is ARM-based image, the instance types here must be ARM-based. + amiType: eks.NodegroupAmiType.AL2023_ARM_64_STANDARD, +}); +``` + To define the maximum number of instances which can be simultaneously replaced in a node group during a version update you can set `maxUnavailable` or `maxUnavailablePercentage` options. > For more details visit [Updating a managed node group](https://docs.aws.amazon.com/eks/latest/userguide/update-managed-node-group.html) @@ -895,15 +912,30 @@ Amazon Linux 2 AMI for ARM64 will be automatically selected. ```ts declare const cluster: eks.Cluster; -// add a managed ARM64 nodegroup + +// add a managed ARM64 nodegroup with no amiType specified (default: AL2_ARM_64) cluster.addNodegroupCapacity('extra-ng-arm', { instanceTypes: [new ec2.InstanceType('m6g.medium')], minSize: 2, }); -// add a self-managed ARM64 nodegroup +// add a managed ARM64 nodegroup with amiType explicitly set as AL2023_ARM_64_STANDARD +cluster.addNodegroupCapacity('extra-ng-arm-al2023', { + instanceTypes: [new ec2.InstanceType('m6g.medium')], + amiType: eks.NodegroupAmiType.AL2023_ARM_64_STANDARD, + minSize: 2, +}); + +// add a self-managed ARM64 nodegroup with no amiType specified (default: AL2_ARM_64) +cluster.addAutoScalingGroupCapacity('self-ng-arm', { + instanceType: new ec2.InstanceType('m6g.medium'), + minCapacity: 2, +}) + +// add a self-managed ARM64 nodegroup with amiType explicitly set as AL2023_ARM_64_STANDARD cluster.addAutoScalingGroupCapacity('self-ng-arm', { instanceType: new ec2.InstanceType('m6g.medium'), + amiType: eks.NodegroupAmiType.AL2023_ARM_64_STANDARD, minCapacity: 2, }) ```