AWS Lambda vs Fargate vs App Runner
- AWS offers multiple serverless/managed compute options for running application code without managing servers.
- Lambda is for event-driven functions, Fargate is for containerized workloads, and App Runner is for web applications and APIs with zero configuration.
- All three eliminate server management but differ in execution model, duration limits, and use cases.
Lambda vs Fargate vs App Runner Comparison
| Feature |
Lambda |
Fargate |
App Runner |
| Execution Model |
Event-driven functions |
Long-running containers |
Always-running web service |
| Max Duration |
15 minutes |
Unlimited |
Unlimited |
| Scale to Zero |
Yes (no charge when idle) |
No (minimum 1 task running) |
Yes (pause instances when no traffic) |
| Cold Start |
Yes (mitigated with Provisioned Concurrency) |
Container startup time (seconds) |
Minimal (keeps warm instances) |
| Memory |
128MB – 10GB |
512MB – 120GB |
512MB – 12GB |
| vCPU |
Proportional to memory (up to 6 vCPU) |
0.25 – 16 vCPU |
0.25 – 4 vCPU |
| Deployment |
ZIP or container image |
Container image |
Source code (GitHub) or container image |
| Auto Scaling |
Automatic per-request concurrency |
Task-level with ECS/EKS Auto Scaling |
Automatic based on concurrent requests |
| Networking |
Optional VPC access |
Full VPC integration |
VPC Connector (optional) |
| Pricing |
Per request + per GB-second |
Per vCPU/hour + per GB/hour |
Per vCPU/hour + per GB/hour (pause charge lower) |
| Configuration |
Moderate (triggers, IAM, layers) |
High (task definitions, clusters, services) |
Minimal (source → running service) |
| Load Balancer |
Not needed (API Gateway or Function URL) |
ALB/NLB required |
Built-in (managed HTTPS endpoint) |
| Custom Runtime |
Yes (custom runtime or container) |
Any container |
Limited runtimes (Python, Node, Java, Go, .NET, Ruby) or container |
AWS Lambda
- Event-driven, function-as-a-service – runs code in response to events (S3, API Gateway, SQS, DynamoDB, etc.).
- Scales automatically to thousands of concurrent executions per second.
- Pay only for execution time – billed per millisecond with a generous free tier (1M requests/month).
- 15-minute maximum execution – not suitable for long-running processes.
- Supports Provisioned Concurrency to eliminate cold starts for latency-sensitive workloads.
- Lambda@Edge and CloudFront Functions for edge computing.
- Best for: event processing, API backends, data transformations, scheduled tasks, and glue logic.
AWS Fargate
- Serverless compute for containers – runs Docker containers without managing EC2 instances.
- Works with ECS or EKS as the orchestration layer.
- No duration limit – suitable for long-running services, background workers, batch jobs.
- Full VPC networking – each task gets its own ENI with security group control.
- Supports persistent storage via EFS for shared file systems.
- Fargate Spot for up to 70% savings on fault-tolerant workloads.
- Best for: microservices, APIs needing persistent connections, background processing, and containerized applications.
AWS App Runner
- Fully managed service – goes from source code or container to running web service in minutes.
- Zero infrastructure configuration – no load balancer, no cluster, no task definition to manage.
- Provides a managed HTTPS endpoint with automatic TLS certificate.
- Auto-deploys from GitHub repository or ECR on code push.
- Can pause instances when no traffic – lower cost than Fargate minimum.
- VPC Connector for private resource access (RDS, ElastiCache, etc.).
- Best for: web applications, REST APIs, and teams that want the simplest deployment experience.
When to Choose Which
- Choose Lambda – Short-lived event processing (<15 min), API backends with variable traffic, integrations between AWS services, cost optimization for sporadic workloads.
- Choose Fargate – Long-running containers, persistent connections (WebSocket, gRPC), complex multi-container applications, need full ECS/EKS ecosystem.
- Choose App Runner – Simple web apps/APIs, want fastest time-to-deploy, team unfamiliar with containers/orchestration, predictable HTTP request-response workloads.
AWS Certification Exam Practice Questions
- A startup needs to deploy a REST API that handles unpredictable traffic spikes (0 to thousands of requests per second) and they want to pay nothing during idle periods. Which service is most cost-effective?
- App Runner
- Fargate with ECS
- Lambda with API Gateway
- EC2 with Auto Scaling
- A team needs to run a containerized web application that maintains WebSocket connections and requires persistent EFS storage. Which compute option supports this?
- Lambda
- Fargate with ECS
- App Runner
- Lambda with container image
- A developer wants to deploy a Python web application directly from a GitHub repository with automatic HTTPS, auto-scaling, and zero infrastructure management. Which service requires the least configuration?
- Lambda with API Gateway
- Fargate with ALB
- App Runner
- Elastic Beanstalk
Related Posts
References
AWS Lambda Developer Guide
AWS Fargate Documentation
AWS App Runner Developer Guide