Amazon Elastic Kubernetes Service
API Reference (API Version 2017-11-01)

CreateNodegroup

Creates a managed worker node group for an Amazon EKS cluster. You can only create a node group for your cluster that is equal to the current Kubernetes version for the cluster. All node groups are created with the latest AMI release version for the respective minor Kubernetes version of the cluster.

An Amazon EKS managed node group is an Amazon EC2 Auto Scaling group and associated Amazon EC2 instances that are managed by AWS for an Amazon EKS cluster. Each node group uses a version of the Amazon EKS-optimized Amazon Linux 2 AMI. For more information, see Managed Node Groups in the Amazon EKS User Guide.

Request Syntax

POST /clusters/name/node-groups HTTP/1.1 Content-type: application/json { "amiType": "string", "clientRequestToken": "string", "diskSize": number, "instanceTypes": [ "string" ], "labels": { "string" : "string" }, "nodegroupName": "string", "nodeRole": "string", "releaseVersion": "string", "remoteAccess": { "ec2SshKey": "string", "sourceSecurityGroups": [ "string" ] }, "scalingConfig": { "desiredSize": number, "maxSize": number, "minSize": number }, "subnets": [ "string" ], "tags": { "string" : "string" }, "version": "string" }

URI Request Parameters

The request requires the following URI parameters.

name

The name of the cluster to create the node group in.

Request Body

The request accepts the following data in JSON format.

amiType

The AMI type for your node group. GPU instance types should use the AL2_x86_64_GPU AMI type, which uses the Amazon EKS-optimized Linux AMI with GPU support. Non-GPU instances should use the AL2_x86_64 AMI type, which uses the Amazon EKS-optimized Linux AMI.

Type: String

Valid Values: AL2_x86_64 | AL2_x86_64_GPU

Required: No

clientRequestToken

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Type: String

Required: No

diskSize

The root device disk size (in GiB) for your node group instances. The default disk size is 20 GiB.

Type: Integer

Required: No

instanceTypes

The instance type to use for your node group. Currently, you can specify a single instance type for a node group. The default value for this parameter is t3.medium. If you choose a GPU instance type, be sure to specify the AL2_x86_64_GPU with the amiType parameter.

Type: Array of strings

Required: No

labels

The Kubernetes labels to be applied to the nodes in the node group when they are created.

Type: String to string map

Key Length Constraints: Minimum length of 1. Maximum length of 63.

Value Length Constraints: Minimum length of 1. Maximum length of 253.

Required: No

nodegroupName

The unique name to give your node group.

Type: String

Required: Yes

nodeRole

The IAM role associated with your node group. The Amazon EKS worker node kubelet daemon makes calls to AWS APIs on your behalf. Worker nodes receive permissions for these API calls through an IAM instance profile and associated policies. Before you can launch worker nodes and register them into a cluster, you must create an IAM role for those worker nodes to use when they are launched. For more information, see Amazon EKS Worker Node IAM Role in the Amazon EKS User Guide .

Type: String

Required: Yes

releaseVersion

The AMI version of the Amazon EKS-optimized AMI to use with your node group. By default, the latest available AMI version for the node group's current Kubernetes version is used. For more information, see Amazon EKS-Optimized Linux AMI Versions in the Amazon EKS User Guide.

Type: String

Required: No

remoteAccess

The remote access (SSH) configuration to use with your node group.

Type: RemoteAccessConfig object

Required: No

scalingConfig

The scaling configuration details for the Auto Scaling group that is created for your node group.

Type: NodegroupScalingConfig object

Required: No

subnets

The subnets to use for the Auto Scaling group that is created for your node group. These subnets must have the tag key kubernetes.io/cluster/CLUSTER_NAME with a value of shared, where CLUSTER_NAME is replaced with the name of your cluster.

Type: Array of strings

Required: Yes

tags

The metadata to apply to the node group to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Node group tags do not propagate to any other resources associated with the node group, such as the Amazon EC2 instances or subnets.

Type: String to string map

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Value Length Constraints: Maximum length of 256.

Required: No

version

The Kubernetes version to use for your managed nodes. By default, the Kubernetes version of the cluster is used, and this is the only accepted specified value.

Type: String

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "nodegroup": { "amiType": "string", "clusterName": "string", "createdAt": number, "diskSize": number, "health": { "issues": [ { "code": "string", "message": "string", "resourceIds": [ "string" ] } ] }, "instanceTypes": [ "string" ], "labels": { "string" : "string" }, "modifiedAt": number, "nodegroupArn": "string", "nodegroupName": "string", "nodeRole": "string", "releaseVersion": "string", "remoteAccess": { "ec2SshKey": "string", "sourceSecurityGroups": [ "string" ] }, "resources": { "autoScalingGroups": [ { "name": "string" } ], "remoteAccessSecurityGroup": "string" }, "scalingConfig": { "desiredSize": number, "maxSize": number, "minSize": number }, "status": "string", "subnets": [ "string" ], "tags": { "string" : "string" }, "version": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

nodegroup

The full description of your new node group.

Type: Nodegroup object

Errors

For information about the errors that are common to all actions, see Common Errors.

ClientException

These errors are usually caused by a client action. Actions can include using an action or resource on behalf of a user that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.

HTTP Status Code: 400

InvalidParameterException

The specified parameter is invalid. Review the available parameters for the API request.

HTTP Status Code: 400

InvalidRequestException

The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.

HTTP Status Code: 400

ResourceInUseException

The specified resource is in use.

HTTP Status Code: 409

ResourceLimitExceededException

You have encountered a service limit on the specified resource.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server-side issue.

HTTP Status Code: 500

ServiceUnavailableException

The service is unavailable. Back off and retry the operation.

HTTP Status Code: 503

Example

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the AWS General Reference.

You need to learn how to sign HTTP requests only if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you with the access key that you specify when you configure the tools. When you use these tools, you don't need to learn how to sign requests yourself.

Example

This example creates a managed node group with the Amazon EKS-optimized AMI with GPU support on p2.xlarge instances.

Sample Request

POST /clusters/prod/node-groups HTTP/1.1 Host: eks.us-west-2.amazonaws.com Accept-Encoding: identity User-Agent: aws-cli/1.16.275 Python/3.7.4 Darwin/18.7.0 botocore/1.13.11 X-Amz-Date: 20191111T182808Z Authorization: AUTHPARAMS Content-Length: 454 { "nodegroupName": "gpu", "scalingConfig": { "minSize": 1, "desiredSize": 2, "maxSize": 3 }, "subnets": [ "subnet-04751110b066869aa", "subnet-00d64f80bf7da767c", "subnet-0c1843cbc9803368c" ], "instanceTypes": [ "p2.xlarge" ], "amiType": "AL2_x86_64_GPU", "remoteAccess": { "ec2SshKey": "id_rsa" }, "nodeRole": "arn:aws:iam::012345678910:role/managed-NodeInstanceRole-1V94UAUPQY7GS", "version": "1.14", "clientRequestToken": "3009f919-f0a2-4dfa-badc-66a6502b7dd6" }

Sample Response

HTTP/1.1 200 OK Date: Mon, 11 Nov 2019 18:28:10 GMT Content-Type: application/json Content-Length: 951 x-amzn-RequestId: d369e009-bc96-4dd5-861a-6effe5aaf0a5 x-amz-apigw-id: DAc5BGsWvHcF_bw= X-Amzn-Trace-Id: Root=1-5dc9a839-294790909d31f4845b62b150 Connection: keep-alive { "nodegroup": { "nodegroupName": "gpu", "nodegroupArn": "arn:aws:eks:us-west-2:012345678910:nodegroup/prod/gpu/6cb72ddc-909f-9a70-98f2-7b5f70a58f4a", "clusterName": "prod", "version": "1.14", "releaseVersion": "1.14.7-20190927", "createdAt": 1573496890.842, "modifiedAt": 1573496890.842, "status": "CREATING", "scalingConfig": { "minSize": 1, "maxSize": 3, "desiredSize": 2 }, "instanceTypes": [ "p2.xlarge" ], "subnets": [ "subnet-04751110b066869aa", "subnet-00d64f80bf7da767c", "subnet-0c1843cbc9803368c" ], "remoteAccess": { "ec2SshKey": "id_rsa", "sourceSecurityGroups": null }, "amiType": "AL2_x86_64_GPU", "nodeRole": "arn:aws:iam::012345678910:role/managed-NodeInstanceRole-1V94UAUPQY7GS", "labels": null, "resources": null, "diskSize": 20, "health": { "issues": [] }, "tags": {} } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: