Fargate (on-demand)
Guaranteed capacity. Best for production workloads, latency-sensitive services, and tasks that cannot tolerate interruption.
Fargate Spot
Up to 70% cheaper. Best for batch jobs, non-critical background processing, and fault-tolerant workloads that can restart on interruption.
You cannot mix EC2-based capacity providers with Fargate capacity providers on the same cluster. Choose one compute family per cluster.
Creating a cluster with Fargate capacity providers
1
Define the cluster module
Use the
cluster sub-module and specify which Fargate capacity providers to enable. Both FARGATE and FARGATE_SPOT are AWS-managed names — you reference them directly rather than creating them.2
Understand weight and base
The
default_capacity_provider_strategy controls how tasks are distributed:base— the minimum number of tasks to always place on this provider before weight applies. In the example above, the first 20 tasks always go toFARGATE.weight— a relative proportion used to distribute tasks beyond thebase. Equal weights (50/50) split tasks evenly. A 60/40 split would send 60% to one provider and 40% to the other.
3
Deploy a service onto the cluster
Point the service module at your cluster and define container definitions. The service defaults to
FARGATE launch type and awsvpc networking.- Fargate (on-demand)
- Fargate Spot
Networking with awsvpc
Fargate requiresawsvpc network mode, which is the default for this module. Each task gets its own elastic network interface (ENI) with a private IP from your VPC subnets.
You must provide subnet_ids for the service. The module creates a security group automatically and lets you define ingress and egress rules:
Adding a FireLens sidecar
The Fargate example uses a FluentBit sidecar for log forwarding. Add thefluent-bit container definition alongside your application container and configure awsfirelens as the log driver:

