FargateClusterProps

class aws_cdk.aws_eks.FargateClusterProps(*, cluster_name=None, output_cluster_name=None, output_config_command=None, role=None, security_group=None, version, vpc=None, vpc_subnets=None, alb_controller=None, cluster_handler_environment=None, cluster_handler_security_group=None, core_dns_compute_type=None, endpoint_access=None, kubectl_environment=None, kubectl_layer=None, kubectl_memory=None, masters_role=None, on_event_layer=None, output_masters_role_arn=None, place_cluster_handler_in_vpc=None, prune=None, secrets_encryption_key=None, service_ipv4_cidr=None, default_profile=None)

Bases: aws_cdk.aws_eks.ClusterOptions

Configuration props for EKS Fargate.

Parameters
  • cluster_name (Optional[str]) – Name for the cluster. Default: - Automatically generated name

  • output_cluster_name (Optional[bool]) – Determines whether a CloudFormation output with the name of the cluster will be synthesized. Default: false

  • output_config_command (Optional[bool]) – Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized. This command will include the cluster name and, if applicable, the ARN of the masters IAM role. Default: true

  • role (Optional[IRole]) – 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

  • security_group (Optional[ISecurityGroup]) – Security Group to use for Control Plane ENIs. Default: - A security group is automatically created

  • version (KubernetesVersion) – The Kubernetes version to run in the cluster.

  • vpc (Optional[IVpc]) – The VPC in which to create the Cluster. Default: - a VPC with default configuration will be created and can be accessed through cluster.vpc.

  • vpc_subnets (Optional[Sequence[SubnetSelection]]) – 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: vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE }] Default: - All public and private subnets

  • alb_controller (Optional[AlbControllerOptions]) – Install the AWS Load Balancer Controller onto the cluster. Default: - The controller is not installed.

  • cluster_handler_environment (Optional[Mapping[str, str]]) – Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle. Default: - No environment variables.

  • cluster_handler_security_group (Optional[ISecurityGroup]) – A security group to associate with the Cluster Handler’s Lambdas. The Cluster Handler’s Lambdas are responsible for calling AWS’s EKS API. Requires placeClusterHandlerInVpc to be set to true. Default: - No security group.

  • core_dns_compute_type (Optional[CoreDnsComputeType]) – Controls the “eks.amazonaws.com/compute-type” annotation in the CoreDNS configuration on your cluster to determine which compute type to use for CoreDNS. Default: CoreDnsComputeType.EC2 (for FargateCluster the default is FARGATE)

  • endpoint_access (Optional[EndpointAccess]) – Configure access to the Kubernetes API server endpoint.. Default: EndpointAccess.PUBLIC_AND_PRIVATE

  • kubectl_environment (Optional[Mapping[str, str]]) – Environment variables for the kubectl execution. Only relevant for kubectl enabled clusters. Default: - No environment variables.

  • kubectl_layer (Optional[ILayerVersion]) – An AWS Lambda Layer which includes kubectl, Helm and the AWS CLI. By default, the provider will use the layer included in the “aws-lambda-layer-kubectl” SAR application which is available in all commercial regions. To deploy the layer locally, visit https://github.com/aws-samples/aws-lambda-layer-kubectl/blob/master/cdk/README.md for instructions on how to prepare the .zip file and then define it in your app as follows:: const layer = new lambda.LayerVersion(this, ‘kubectl-layer’, { code: lambda.Code.fromAsset(${__dirname}/layer.zip), compatibleRuntimes: [lambda.Runtime.PROVIDED], }); Default: - the layer provided by the aws-lambda-layer-kubectl SAR app.

  • kubectl_memory (Optional[Size]) – Amount of memory to allocate to the provider’s lambda function. Default: Size.gibibytes(1)

  • masters_role (Optional[IRole]) – An IAM role that will be added to the system:masters Kubernetes RBAC group. Default: - a role that assumable by anyone with permissions in the same account will automatically be defined

  • on_event_layer (Optional[ILayerVersion]) – An AWS Lambda Layer which includes the NPM dependency proxy-agent. This layer is used by the onEvent handler to route AWS SDK requests through a proxy. By default, the provider will use the layer included in the “aws-lambda-layer-node-proxy-agent” SAR application which is available in all commercial regions. To deploy the layer locally define it in your app as follows:: const layer = new lambda.LayerVersion(this, ‘proxy-agent-layer’, { code: lambda.Code.fromAsset(${__dirname}/layer.zip), compatibleRuntimes: [lambda.Runtime.NODEJS_12_X], }); Default: - a layer bundled with this module.

  • output_masters_role_arn (Optional[bool]) – Determines whether a CloudFormation output with the ARN of the “masters” IAM role will be synthesized (if mastersRole is specified). Default: false

  • place_cluster_handler_in_vpc (Optional[bool]) – If set to true, the cluster handler functions will be placed in the private subnets of the cluster vpc, subject to the vpcSubnets selection strategy. Default: false

  • prune (Optional[bool]) – Indicates whether Kubernetes resources added through addManifest() can be automatically pruned. When this is enabled (default), prune labels will be allocated and injected to each resource. These labels will then be used when issuing the kubectl apply operation with the --prune switch. Default: true

  • secrets_encryption_key (Optional[IKey]) – KMS secret for envelope encryption for Kubernetes secrets. Default: - By default, Kubernetes stores all secret object data within etcd and all etcd volumes used by Amazon EKS are encrypted at the disk-level using AWS-Managed encryption keys.

  • service_ipv4_cidr (Optional[str]) – The CIDR block to assign Kubernetes service IP addresses from. Default: - Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks

  • default_profile (Optional[FargateProfileOptions]) – Fargate Profile to create along with the cluster. Default: - A profile called “default” with ‘default’ and ‘kube-system’ selectors will be created if this is left undefined.

Example:

cluster = eks.FargateCluster(self, "MyCluster",
    version=eks.KubernetesVersion.V1_21
)

Attributes

alb_controller

Install the AWS Load Balancer Controller onto the cluster.

Default
  • The controller is not installed.

See

https://kubernetes-sigs.github.io/aws-load-balancer-controller

Return type

Optional[AlbControllerOptions]

cluster_handler_environment

Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle.

Default
  • No environment variables.

Return type

Optional[Mapping[str, str]]

cluster_handler_security_group

A security group to associate with the Cluster Handler’s Lambdas.

The Cluster Handler’s Lambdas are responsible for calling AWS’s EKS API.

Requires placeClusterHandlerInVpc to be set to true.

Default
  • No security group.

Return type

Optional[ISecurityGroup]

cluster_name

Name for the cluster.

Default
  • Automatically generated name

Return type

Optional[str]

core_dns_compute_type

Controls the “eks.amazonaws.com/compute-type” annotation in the CoreDNS configuration on your cluster to determine which compute type to use for CoreDNS.

Default

CoreDnsComputeType.EC2 (for FargateCluster the default is FARGATE)

Return type

Optional[CoreDnsComputeType]

default_profile

Fargate Profile to create along with the cluster.

Default

  • A profile called “default” with ‘default’ and ‘kube-system’

selectors will be created if this is left undefined.

Return type

Optional[FargateProfileOptions]

endpoint_access

Configure access to the Kubernetes API server endpoint..

Default

EndpointAccess.PUBLIC_AND_PRIVATE

See

https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html

Return type

Optional[EndpointAccess]

kubectl_environment

Environment variables for the kubectl execution.

Only relevant for kubectl enabled clusters.

Default
  • No environment variables.

Return type

Optional[Mapping[str, str]]

kubectl_layer

An AWS Lambda Layer which includes kubectl, Helm and the AWS CLI.

By default, the provider will use the layer included in the “aws-lambda-layer-kubectl” SAR application which is available in all commercial regions.

To deploy the layer locally, visit https://github.com/aws-samples/aws-lambda-layer-kubectl/blob/master/cdk/README.md for instructions on how to prepare the .zip file and then define it in your app as follows:

layer = lambda_.LayerVersion(self, "kubectl-layer",
    code=lambda_.Code.from_asset(f"{__dirname}/layer.zip"),
    compatible_runtimes=[lambda_.Runtime.PROVIDED]
)
Default
  • the layer provided by the aws-lambda-layer-kubectl SAR app.

See

https://github.com/aws-samples/aws-lambda-layer-kubectl

Return type

Optional[ILayerVersion]

kubectl_memory

Amount of memory to allocate to the provider’s lambda function.

Default

Size.gibibytes(1)

Return type

Optional[Size]

masters_role

An IAM role that will be added to the system:masters Kubernetes RBAC group.

Default

  • a role that assumable by anyone with permissions in the same

account will automatically be defined

See

https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings

Return type

Optional[IRole]

on_event_layer

An AWS Lambda Layer which includes the NPM dependency proxy-agent.

This layer is used by the onEvent handler to route AWS SDK requests through a proxy.

By default, the provider will use the layer included in the “aws-lambda-layer-node-proxy-agent” SAR application which is available in all commercial regions.

To deploy the layer locally define it in your app as follows:

layer = lambda_.LayerVersion(self, "proxy-agent-layer",
    code=lambda_.Code.from_asset(f"{__dirname}/layer.zip"),
    compatible_runtimes=[lambda_.Runtime.NODEJS_12_X]
)
Default
  • a layer bundled with this module.

Return type

Optional[ILayerVersion]

output_cluster_name

Determines whether a CloudFormation output with the name of the cluster will be synthesized.

Default

false

Return type

Optional[bool]

output_config_command

Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized.

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

Default

true

Return type

Optional[bool]

output_masters_role_arn

Determines whether a CloudFormation output with the ARN of the “masters” IAM role will be synthesized (if mastersRole is specified).

Default

false

Return type

Optional[bool]

place_cluster_handler_in_vpc

If set to true, the cluster handler functions will be placed in the private subnets of the cluster vpc, subject to the vpcSubnets selection strategy.

Default

false

Return type

Optional[bool]

prune

Indicates whether Kubernetes resources added through addManifest() can be automatically pruned.

When this is enabled (default), prune labels will be allocated and injected to each resource. These labels will then be used when issuing the kubectl apply operation with the --prune switch.

Default

true

Return type

Optional[bool]

role

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

Return type

Optional[IRole]

secrets_encryption_key

KMS secret for envelope encryption for Kubernetes secrets.

Default

  • By default, Kubernetes stores all secret object data within etcd and

all etcd volumes used by Amazon EKS are encrypted at the disk-level using AWS-Managed encryption keys.

Return type

Optional[IKey]

security_group

Security Group to use for Control Plane ENIs.

Default
  • A security group is automatically created

Return type

Optional[ISecurityGroup]

service_ipv4_cidr

The CIDR block to assign Kubernetes service IP addresses from.

Default

  • Kubernetes assigns addresses from either the

10.100.0.0/16 or 172.20.0.0/16 CIDR blocks

See

https://docs.aws.amazon.com/eks/latest/APIReference/API_KubernetesNetworkConfigRequest.html#AmazonEKS-Type-KubernetesNetworkConfigRequest-serviceIpv4Cidr

Return type

Optional[str]

version

The Kubernetes version to run in the cluster.

Return type

KubernetesVersion

vpc

The VPC in which to create the Cluster.

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

Return type

Optional[IVpc]

vpc_subnets

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:

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

Default
  • All public and private subnets

Return type

Optional[List[SubnetSelection]]