Skip to content

FargateProfile

Source: src/AWS/EKS/FargateProfile.ts

An Amazon EKS Fargate profile — declares which pods (by namespace + labels) run on AWS Fargate serverless compute instead of on EC2 nodes.

Fargate profiles are immutable except for tags: any change to selectors, the pod execution role, or subnets forces a replacement. Create and delete are asynchronous (CREATINGACTIVE, DELETING → gone, ~1–2 min each) and the provider waits for the terminal state. EKS allows only one Fargate profile per cluster to be creating or deleting at a time, so the provider retries the ResourceInUseException that surfaces when a peer profile operation is in flight.

Fargate pods must run in private subnets — pass private subnet IDs only.

Run the default Namespace on Fargate

const profile = yield* FargateProfile("DefaultFargate", {
clusterName: cluster.clusterName,
podExecutionRoleArn: podRole.roleArn,
subnets: network.privateSubnetIds,
selectors: [{ namespace: "default" }],
});

Select Pods by Namespace and Labels

const profile = yield* FargateProfile("BatchFargate", {
clusterName: cluster.clusterName,
podExecutionRoleArn: podRole.roleArn,
subnets: network.privateSubnetIds,
selectors: [
{ namespace: "batch", labels: { compute: "fargate" } },
],
});