aws-cdk-lib.aws_eks.FargateProfile

class FargateProfile (construct)

LanguageType name
.NETAmazon.CDK.AWS.EKS.FargateProfile
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awseks#FargateProfile
Javasoftware.amazon.awscdk.services.eks.FargateProfile
Pythonaws_cdk.aws_eks.FargateProfile
TypeScript (source)aws-cdk-lib » aws_eks » FargateProfile

Implements IConstruct, IDependable, ITaggable

Fargate profiles allows an administrator to declare which pods run on Fargate.

This declaration is done through the profile’s selectors. Each profile can have up to five selectors that contain a namespace and optional labels. You must define a namespace for every selector. The label field consists of multiple optional key-value pairs. Pods that match a selector (by matching a namespace for the selector and all of the labels specified in the selector) are scheduled on Fargate. If a namespace selector is defined without any labels, Amazon EKS will attempt to schedule all pods that run in that namespace onto Fargate using the profile. If a to-be-scheduled pod matches any of the selectors in the Fargate profile, then that pod is scheduled on Fargate.

If a pod matches multiple Fargate profiles, Amazon EKS picks one of the matches at random. In this case, you can specify which profile a pod should use by adding the following Kubernetes label to the pod specification: eks.amazonaws.com/fargate-profile: profile_name. However, the pod must still match a selector in that profile in order to be scheduled onto Fargate.

Example

declare const cluster: eks.Cluster;
new eks.FargateProfile(this, 'MyProfile', {
  cluster,
  selectors: [ { namespace: 'default' } ],
});

Initializer

new FargateProfile(scope: Construct, id: string, props: FargateProfileProps)

Parameters

  • scope Construct
  • id string
  • props FargateProfileProps

Construct Props

NameTypeDescription
clusterClusterThe EKS cluster to apply the Fargate profile to.
selectorsSelector[]The selectors to match for pods to use this Fargate profile.
fargateProfileName?stringThe name of the Fargate profile.
podExecutionRole?IRoleThe pod execution role to use for pods that match the selectors in the Fargate profile.
subnetSelection?SubnetSelectionSelect which subnets to launch your pods into.
vpc?IVpcThe VPC from which to select subnets to launch your pods into.

cluster

Type: Cluster

The EKS cluster to apply the Fargate profile to.

[disable-awslint:ref-via-interface]


selectors

Type: Selector[]

The selectors to match for pods to use this Fargate profile.

Each selector must have an associated namespace. Optionally, you can also specify labels for a namespace.

At least one selector is required and you may specify up to five selectors.


fargateProfileName?

Type: string (optional, default: generated)

The name of the Fargate profile.


podExecutionRole?

Type: IRole (optional, default: a role will be automatically created)

The pod execution role to use for pods that match the selectors in the Fargate profile.

The pod execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories.

See also: https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html


subnetSelection?

Type: SubnetSelection (optional, default: all private subnets of the VPC are selected.)

Select which subnets to launch your pods into.

At this time, pods running on Fargate are not assigned public IP addresses, so only private subnets (with no direct route to an Internet Gateway) are allowed.

You must specify the VPC to customize the subnet selection


vpc?

Type: IVpc (optional, default: all private subnets used by the EKS cluster)

The VPC from which to select subnets to launch your pods into.

By default, all private subnets are selected. You can customize this using subnetSelection.

Properties

NameTypeDescription
fargateProfileArnstringThe full Amazon Resource Name (ARN) of the Fargate profile.
fargateProfileNamestringThe name of the Fargate profile.
nodeNodeThe tree node.
podExecutionRoleIRoleThe pod execution role to use for pods that match the selectors in the Fargate profile.
tagsTagManagerResource tags.

fargateProfileArn

Type: string

The full Amazon Resource Name (ARN) of the Fargate profile.


fargateProfileName

Type: string

The name of the Fargate profile.


node

Type: Node

The tree node.


podExecutionRole

Type: IRole

The pod execution role to use for pods that match the selectors in the Fargate profile.

The pod execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories.


tags

Type: TagManager

Resource tags.

Methods

NameDescription
toString()Returns a string representation of this construct.

toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.