This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/aws-eks

AWS Elastic Container Service for Kubernetes (EKS) Construct Library

This construct library allows you to define and create Amazon Elastic Container Service for Kubernetes (EKS) clusters programmatically.

Example

The following example shows how to start an EKS cluster and how to add worker nodes to it:

const vpc = new ec2.VpcNetwork(this, 'VPC');

const cluster = new eks.Cluster(this, 'EKSCluster', {
  vpc
});

cluster.addCapacity('Nodes', {
  instanceType: new ec2.InstanceType('t2.medium'),
  desiredCapacity: 1,  // Raise this number to add more nodes
});

After deploying the previous CDK app you still need to configure kubectl and manually add the nodes to your cluster, as described in the EKS user guide.

SSH into your nodes

If you want to be able to SSH into your worker nodes, you must already have an SSH key in the region you’re connecting to and pass it, and you must be able to connect to the hosts (meaning they must have a public IP and you should be allowed to connect to them on port 22):

const asg = cluster.addCapacity('Nodes', {
  instanceType: new ec2.InstanceType('t2.medium'),
  vpcPlacement: { subnetsToUse: ec2.SubnetType.Public },
  keyName: 'my-key-name',
});

// Replace with desired IP
asg.connections.allowFrom(new ec2.CidrIPv4('1.2.3.4/32'), new ec2.TcpPort(22));

If you want to SSH into nodes in a private subnet, you should set up a bastion host in a public subnet. That setup is recommended, but is unfortunately beyond the scope of this documentation.

Roadmap

  • [ ] Add ability to start tasks on clusters using CDK (similar to ECS’s “Service” concept).
  • [ ] Describe how to set up AutoScaling (how to combine EC2 and Kubernetes scaling)

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK.AWS.EKS" Version="0.25.3" />

dotnet:

dotnet add package Amazon.CDK.AWS.EKS --version 0.25.3

packages.config:

<package id="Amazon.CDK.AWS.EKS" version="0.25.3" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:eks:jar:0.25.3'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="eks" rev="0.25.3"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>eks</artifactId>
  <version>0.25.3</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:eks:0.25.3'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='eks', version='0.25.3')
)

View in NPM

npm:

$ npm i @aws-cdk/aws-eks@0.25.3

package.json:

{
  "@aws-cdk/aws-eks": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-eks@0.25.3

View in NPM

npm:

$ npm i @aws-cdk/aws-eks@0.25.3

package.json:

{
  "@aws-cdk/aws-eks": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-eks@0.25.3

AddAutoScalingGroupOptions (interface)

class @aws-cdk/aws-eks.AddAutoScalingGroupOptions

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.AddAutoScalingGroupOptions;
// AddAutoScalingGroupOptions is an interface
import { AddAutoScalingGroupOptions } from '@aws-cdk/aws-eks';

Options for adding an AutoScalingGroup as capacity

maxPods

How many pods to allow on this instance.

Should be at most equal to the maximum number of IP addresses available to

the instance type less one.

Type:number

AddWorkerNodesOptions (interface)

class @aws-cdk/aws-eks.AddWorkerNodesOptions

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.AddWorkerNodesOptions;
// AddWorkerNodesOptions is an interface
import { AddWorkerNodesOptions } from '@aws-cdk/aws-eks';

Options for adding worker nodes

Extends:@aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps
instanceType

Instance type of the instances to start

Type:@aws-cdk/aws-ec2.InstanceType
allowAllOutbound

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Whether the instances can initiate connections to anywhere by default

Type:boolean (optional)
Default:true
associatePublicIpAddress

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Whether instances in the Auto Scaling Group should have public

IP addresses associated with them.

Type:boolean (optional)
Default:Use subnet setting
cooldownSeconds

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Default scaling cooldown for this AutoScalingGroup

Type:number (optional)
Default:300 (5 minutes)
desiredCapacity

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Initial amount of instances in the fleet

Type:number (optional)
Default:1
ignoreUnmodifiedSizeProperties

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

If the ASG has scheduled actions, don’t reset unchanged group sizes

Only used if the ASG has scheduled actions (which may scale your ASG up

or down regardless of cdk deployments). If true, the size of the group

will only be reset if it has been changed in the CDK app. If false, the

sizes will always be changed back to what they were in the CDK app

on deployment.

Type:boolean (optional)
Default:true
keyName

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Name of SSH keypair to grant access to instances

Type:string (optional)
Default:No SSH access will be possible
maxCapacity

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Maximum number of instances in the fleet

Type:number (optional)
Default:desiredCapacity
minCapacity

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Minimum number of instances in the fleet

Type:number (optional)
Default:1
notificationsTopic

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

SNS topic to send notifications about fleet changes

Type:@aws-cdk/aws-sns.ITopic (optional)
Default:No fleet change notifications will be sent.
replacingUpdateMinSuccessfulInstancesPercent

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Configuration for replacing updates.

Only used if updateType == UpdateType.ReplacingUpdate. Specifies how

many instances must signal success for the update to succeed.

Type:number (optional)
resourceSignalCount

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

How many ResourceSignal calls CloudFormation expects before the resource is considered created

Type:number (optional)
Default:1
resourceSignalTimeoutSec

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

The length of time to wait for the resourceSignalCount

The maximum value is 43200 (12 hours).

Type:number (optional)
Default:300 (5 minutes)
rollingUpdateConfiguration

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Configuration for rolling updates

Only used if updateType == UpdateType.RollingUpdate.

Type:@aws-cdk/aws-autoscaling.RollingUpdateConfiguration (optional)
updateType

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

What to do when an AutoScalingGroup’s instance configuration is changed

This is applied when any of the settings on the ASG are changed that

affect how the instances should be created (VPC, instance type, startup

scripts, etc.). It indicates how the existing instances should be

replaced with new instances matching the new config. By default, nothing

is done and only new instances are launched with the new config.

Type:@aws-cdk/aws-autoscaling.UpdateType (optional)
Default:UpdateType.None
vpcPlacement

Inherited from @aws-cdk/aws-autoscaling.CommonAutoScalingGroupProps

Where to place instances within the VPC

Type:@aws-cdk/aws-ec2.VpcPlacementStrategy (optional)

CfnCluster

class @aws-cdk/aws-eks.CfnCluster(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.CfnCluster;
const { CfnCluster } = require('@aws-cdk/aws-eks');
import { CfnCluster } from '@aws-cdk/aws-eks';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
clusterArn
Type:string (readonly)
clusterCertificateAuthorityData
Type:string (readonly)
clusterEndpoint
Type:string (readonly)
clusterName
Type:string (readonly)
propertyOverrides
Type:CfnClusterProps (readonly)
class ResourcesVpcConfigProperty

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.CfnCluster.ResourcesVpcConfigProperty;
// CfnCluster.ResourcesVpcConfigProperty is an interface
import { CfnCluster.ResourcesVpcConfigProperty } from '@aws-cdk/aws-eks';
subnetIds

CfnCluster.ResourcesVpcConfigProperty.SubnetIds

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-cluster-resourcesvpcconfig.html#cfn-eks-cluster-resourcesvpcconfig-subnetids

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[]
securityGroupIds

CfnCluster.ResourcesVpcConfigProperty.SecurityGroupIds

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-cluster-resourcesvpcconfig.html#cfn-eks-cluster-resourcesvpcconfig-securitygroupids

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnClusterProps (interface)

class @aws-cdk/aws-eks.CfnClusterProps

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.CfnClusterProps;
// CfnClusterProps is an interface
import { CfnClusterProps } from '@aws-cdk/aws-eks';
resourcesVpcConfig

AWS::EKS::Cluster.ResourcesVpcConfig

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-resourcesvpcconfig

Type:ResourcesVpcConfigProperty or @aws-cdk/cdk.Token
roleArn

AWS::EKS::Cluster.RoleArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-rolearn

Type:string
name

AWS::EKS::Cluster.Name

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-name

Type:string (optional)
version

AWS::EKS::Cluster.Version

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-version

Type:string (optional)

Cluster

class @aws-cdk/aws-eks.Cluster(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.Cluster;
const { Cluster } = require('@aws-cdk/aws-eks');
import { Cluster } from '@aws-cdk/aws-eks';

A Cluster represents a managed Kubernetes Service (EKS)

This is a fully managed cluster of API Servers (control-plane)

The user is still required to create the worker nodes.

Extends:

ClusterBase

Parameters:
static import(scope, id, props) → @aws-cdk/aws-eks.ICluster

Import an existing cluster

Parameters:
  • scope (@aws-cdk/cdk.Construct) – the construct scope, in most cases ‘this’
  • id (string) – the id or name to import as
  • props (ClusterImportProps) – the cluster properties to use for importing information
Return type:

ICluster

addAutoScalingGroup(autoScalingGroup, options)

Add compute capacity to this EKS cluster in the form of an AutoScalingGroup

The AutoScalingGroup must be running an EKS-optimized AMI containing the

/etc/eks/bootstrap.sh script. This method will configure Security Groups,

add the right policies to the instance role, apply the right tags, and add

the required user data to the instance’s launch configuration.

Prefer to use addCapacity if possible, it will automatically configure

the right AMI and the maxPods number based on your instance type.

Parameters:
addCapacity(id, options) → @aws-cdk/aws-autoscaling.AutoScalingGroup

Add nodes to this EKS cluster

The nodes will automatically be configured with the right VPC and AMI

for the instance type and Kubernetes version.

Parameters:
Return type:

@aws-cdk/aws-autoscaling.AutoScalingGroup

clusterArn

Implements @aws-cdk/aws-eks.ClusterBase.clusterArn()

The AWS generated ARN for the Cluster resource

Type:string (readonly)
clusterCertificateAuthorityData

Implements @aws-cdk/aws-eks.ClusterBase.clusterCertificateAuthorityData()

The certificate-authority-data for your cluster.

Type:string (readonly)
clusterEndpoint

Implements @aws-cdk/aws-eks.ClusterBase.clusterEndpoint()

The endpoint URL for the Cluster

This is the URL inside the kubeconfig file to use with kubectl

Type:string (readonly)
clusterName

Implements @aws-cdk/aws-eks.ClusterBase.clusterName()

The Name of the created EKS Cluster

Type:string (readonly)
connections

Implements @aws-cdk/aws-eks.ClusterBase.connections()

Manages connection rules (Security Group Rules) for the cluster

Type:@aws-cdk/aws-ec2.Connections (readonly)
role

IAM role assumed by the EKS Control Plane

Type:@aws-cdk/aws-iam.IRole (readonly)
vpc

Implements @aws-cdk/aws-eks.ClusterBase.vpc()

The VPC in which this Cluster was created

Type:@aws-cdk/aws-ec2.IVpcNetwork (readonly)
export() → @aws-cdk/aws-eks.ClusterImportProps

Inherited from @aws-cdk/aws-eks.ClusterBase

Export cluster references to use in other stacks

Return type:ClusterImportProps
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

ClusterBase

class @aws-cdk/aws-eks.ClusterBase(scope, id)

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.ClusterBase;
const { ClusterBase } = require('@aws-cdk/aws-eks');
import { ClusterBase } from '@aws-cdk/aws-eks';

A SecurityGroup Reference, object not created with this template.

Extends:

@aws-cdk/cdk.Construct

Implements:

ICluster

Abstract:

Yes

Parameters:
  • scope (@aws-cdk/cdk.Construct) – The scope in which to define this construct
  • id (string) – The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (/), then it will be replaced by double dash .
export() → @aws-cdk/aws-eks.ClusterImportProps

Implements @aws-cdk/aws-eks.ICluster.export()

Export cluster references to use in other stacks

Return type:ClusterImportProps
clusterArn

Implements @aws-cdk/aws-eks.ICluster.clusterArn()

The unique ARN assigned to the service by AWS

in the form of arn:aws:eks:

Type:string (readonly) (abstract)
clusterCertificateAuthorityData

Implements @aws-cdk/aws-eks.ICluster.clusterCertificateAuthorityData()

The certificate-authority-data for your cluster.

Type:string (readonly) (abstract)
clusterEndpoint

Implements @aws-cdk/aws-eks.ICluster.clusterEndpoint()

The API Server endpoint URL

Type:string (readonly) (abstract)
clusterName

Implements @aws-cdk/aws-eks.ICluster.clusterName()

The physical name of the Cluster

Type:string (readonly) (abstract)
connections

Implements @aws-cdk/aws-ec2.IConnectable.connections()

Type:@aws-cdk/aws-ec2.Connections (readonly) (abstract)
vpc

Implements @aws-cdk/aws-eks.ICluster.vpc()

The VPC in which this Cluster was created

Type:@aws-cdk/aws-ec2.IVpcNetwork (readonly) (abstract)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

ClusterImportProps (interface)

class @aws-cdk/aws-eks.ClusterImportProps

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.ClusterImportProps;
// ClusterImportProps is an interface
import { ClusterImportProps } from '@aws-cdk/aws-eks';
clusterArn

The unique ARN assigned to the service by AWS

in the form of arn:aws:eks:

Type:string (readonly)
clusterCertificateAuthorityData

The certificate-authority-data for your cluster.

Type:string (readonly)
clusterEndpoint

The API Server endpoint URL

Type:string (readonly)
clusterName

The physical name of the Cluster

Type:string (readonly)
securityGroups
Type:@aws-cdk/aws-ec2.SecurityGroupImportProps[] (readonly)
vpc

The VPC in which this Cluster was created

Type:@aws-cdk/aws-ec2.VpcNetworkImportProps (readonly)

ClusterProps (interface)

class @aws-cdk/aws-eks.ClusterProps

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.ClusterProps;
// ClusterProps is an interface
import { ClusterProps } from '@aws-cdk/aws-eks';

Properties to instantiate the Cluster

vpc

The VPC in which to create the Cluster

Type:@aws-cdk/aws-ec2.IVpcNetwork
clusterName

Name for the cluster.

Type:string (optional)
Default:Automatically generated name
role

Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.

Type:@aws-cdk/aws-iam.IRole (optional)
Default:A role is automatically created for you
securityGroup

Security Group to use for Control Plane ENIs

Type:@aws-cdk/aws-ec2.ISecurityGroup (optional)
Default:A security group is automatically created
version

The Kubernetes version to run in the cluster

Type:string (optional)
Default:If not supplied, will use Amazon default version
vpcPlacements

Where to place EKS Control Plane ENIs

If you want to create public load balancers, this must include public subnets.

For example, to only select private subnets, supply the following:

```

  • vpcPlacements: [
  • { subnetsToUse: ec2.SubnetType.Private }
  • ]
  • ```
Type:@aws-cdk/aws-ec2.VpcPlacementStrategy[] (optional)
Default:All public and private subnets

EksOptimizedAmi

class @aws-cdk/aws-eks.EksOptimizedAmi([props])

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.EksOptimizedAmi;
const { EksOptimizedAmi } = require('@aws-cdk/aws-eks');
import { EksOptimizedAmi } from '@aws-cdk/aws-eks';

Source for EKS optimized AMIs

Extends:@aws-cdk/aws-ec2.GenericLinuxImage
Implements:@aws-cdk/aws-ec2.IMachineImageSource
Parameters:props (EksOptimizedAmiProps (optional)) –
getImage(scope) → @aws-cdk/aws-ec2.MachineImage

Inherited from @aws-cdk/aws-ec2.GenericLinuxImage

Return the image to use in the given context

Parameters:scope (@aws-cdk/cdk.Construct) –
Return type:@aws-cdk/aws-ec2.MachineImage
amiMap

Inherited from @aws-cdk/aws-ec2.GenericLinuxImage

Type:string => string (readonly)

EksOptimizedAmiProps (interface)

class @aws-cdk/aws-eks.EksOptimizedAmiProps

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.EksOptimizedAmiProps;
// EksOptimizedAmiProps is an interface
import { EksOptimizedAmiProps } from '@aws-cdk/aws-eks';

Properties for EksOptimizedAmi

kubernetesVersion

The Kubernetes version to use

Type:string (optional)
Default:The latest version
nodeType

What instance type to retrieve the image for (normal or GPU-optimized)

Type:NodeType (optional)
Default:Normal

ICluster (interface)

class @aws-cdk/aws-eks.ICluster

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.ICluster;
// ICluster is an interface
import { ICluster } from '@aws-cdk/aws-eks';

An EKS cluster

Extends:@aws-cdk/cdk.IConstruct
Extends:@aws-cdk/aws-ec2.IConnectable
clusterArn

The unique ARN assigned to the service by AWS

in the form of arn:aws:eks:

Type:string (readonly)
clusterCertificateAuthorityData

The certificate-authority-data for your cluster.

Type:string (readonly)
clusterEndpoint

The API Server endpoint URL

Type:string (readonly)
clusterName

The physical name of the Cluster

Type:string (readonly)
vpc

The VPC in which this Cluster was created

Type:@aws-cdk/aws-ec2.IVpcNetwork (readonly)
export() → @aws-cdk/aws-eks.ClusterImportProps

Export cluster references to use in other stacks

Return type:ClusterImportProps
Abstract:Yes
connections

Inherited from @aws-cdk/aws-ec2.IConnectable

Type:@aws-cdk/aws-ec2.Connections (readonly)
node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

NodeType (enum)

class @aws-cdk/aws-eks.NodeType

Language-specific names:

using Amazon.CDK.AWS.EKS;
import software.amazon.awscdk.services.eks.NodeType;
const { NodeType } = require('@aws-cdk/aws-eks');
import { NodeType } from '@aws-cdk/aws-eks';

Whether the worker nodes should support GPU or just normal instances

Normal

Normal instances

GPU

GPU instances