AWS Fargate is a serverless compute engine for containers. It scales automatically. It lets you focus on building applications without managing servers.
Features
- Fargate is not working alone.
- Fargate is compatible with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS).
Task Definition
- Container Info
- Container Name and Image
- Port Mapping
- Task size
- Memory and vCPU
Monitoring and Logging
Events via EventBrige
- Any change in tasks can be sent to EventBrige.
Logging
- Containers can send application logs directly to CloudWatch Logs
- You need to turn on “awslogs” log driver.
- supports “awslogs”, “splunk”, and “awsfirelens” drivers
- You need to configure “logConfiguration” section in the Task definition.
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/fargate-task-definition",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
}
EC2 vs. Fargate
EC2
- You are responsible for underlying operating systems.
- More pricing options – reserved or spot instances
- Good for long-running applications
Fargate
- Fully managed
- No access to operating systems
- Isolated environment
- Good for short-running applications in containers
Fargate vs. Lambda
Fargate
- When you work with dockers
- When you have consistent workloads
Lambda
- When you work can be expressed as a single function
- When you have inconsistent and unpredictable workloads
