Skip to content
v2.274.0

CommonClusterOptions Struct ​

Options for configuring an EKS cluster.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_eks as eks } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';

declare const kubernetesVersion: eks.KubernetesVersion;
declare const role: iam.Role;
declare const securityGroup: ec2.SecurityGroup;
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const commonClusterOptions: eks.CommonClusterOptions = {
  version: kubernetesVersion,

  // the properties below are optional
  clusterName: 'clusterName',
  outputClusterName: false,
  outputConfigCommand: false,
  role: role,
  securityGroup: securityGroup,
  vpc: vpc,
  vpcSubnets: [{
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  }],
};

Properties ​

clusterNameoptionalstringcluster_nameoptionalstrclusterNameoptionalStringClusterNameoptionalstringClusterNameoptional*string#
Name for the cluster.

Default: Automatically generated name

outputClusterNameoptionalbooleanoutput_cluster_nameoptionalbooloutputClusterNameoptionalBooleanOutputClusterNameoptionalboolOutputClusterNameoptional*bool= false#
Determines whether a CloudFormation output with the name of the cluster will be synthesized.
outputConfigCommandoptionalbooleanoutput_config_commandoptionalbooloutputConfigCommandoptionalBooleanOutputConfigCommandoptionalboolOutputConfigCommandoptional*bool= true#
Determines whether a CloudFormation output with the `aws eks update-kubeconfig` command will be synthesized.

This command will include the cluster name and the ARN of the masters IAM role.

Note: If mastersRole is not specified, this property will be ignored and no config command will be emitted.

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

Default: A role is automatically created for you

securityGroupoptionalISecurityGroupsecurity_groupoptionalISecurityGroupsecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroup#
Security Group to use for Control Plane ENIs.

Default: A security group is automatically created

The Kubernetes version to run in the cluster.
vpcoptionalIVpcvpcoptionalIVpcvpcoptionalIVpcVpcoptionalIVpcVpcoptionalIVpc#
The VPC in which to create the Cluster.

Default: a VPC with default configuration will be created and can be accessed through cluster.vpc.

vpcSubnetsoptionalSubnetSelection[]vpc_subnetsoptionaltyping.List[SubnetSelection]vpcSubnetsoptionalList<SubnetSelection>VpcSubnetsoptionalSubnetSelection[]VpcSubnetsoptional*[]SubnetSelection#
Where to place EKS Control Plane ENIs.

Default: All public and private subnets

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

vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]