Serverless Containers: AWS ECS Fargate vs. Azure Container Apps vs. Google Cloud Run
A practical comparison of AWS ECS Fargate, Azure Container Apps, and Google Cloud Run for deploying serverless containerized applications. Explore features, scaling, networking, pricing, and use cases.
· 13 min read
Containers Without Servers
Containers made applications much easier to package and deploy, but someone still had to manage the virtual machines, operating systems, patching, and scaling underneath. Serverless container platforms take that job away: you hand over a container image, and the cloud provider runs it.
The three main options are Amazon Web Services’ Elastic Container Service (ECS) with the Fargate launch type, Microsoft’s Azure Container Apps (ACA), and Google Cloud Run. All three deploy containerized applications, scale them with demand, and hide the virtual machines.
Their architectures, features, and operating models differ a lot, though, and the differences affect cost, performance, and how productive your developers are. This post compares the three: their core concepts, how they handle deployment, scaling, networking, observability, security, tooling, microservices, and pricing, and which workloads suit each.
Under the Hood
First, the building blocks of each platform.
AWS ECS with Fargate
AWS Elastic Container Service (ECS) is a mature container orchestration service. While it offers the EC2 launch type (where you manage the underlying instances), the Fargate launch type provides the serverless experience.
- Task Definition: A blueprint for your application, akin to a
docker-compose.ymlor Kubernetes Pod spec. It defines the container image(s) to use, CPU/Memory requirements, networking configuration, IAM roles, environment variables, and more. This is the core unit of deployment. - Task: A running instance of a Task Definition. It represents one or more containers running together on infrastructure managed entirely by AWS Fargate.
- Service: Maintains a specified number (desired count) of Tasks running continuously. It handles task health checks, restarts failed tasks, and integrates with load balancers (like ALB/NLB) and service discovery (Cloud Map).
- Cluster: A logical grouping of Tasks or Services. With Fargate, a cluster doesn’t represent physical servers you manage but rather a namespace and boundary for your resources.
- Fargate Launch Type: Instructs ECS to run your tasks on AWS-managed infrastructure instead of EC2 instances you provision and manage.
awsvpcNetworking Mode: Fargate tasks run withawsvpcnetwork mode, meaning each task gets its own Elastic Network Interface (ENI) within your specified VPC and subnets. Each task is isolated on the network and sits directly in your VPC.
Azure Container Apps (ACA)
Azure Container Apps is a newer service. It runs on Kubernetes (with KEDA, Dapr, and Envoy) but hides Kubernetes behind a higher-level, application-centric model designed for microservices and web apps.
- Container App: The primary resource, representing your application or microservice. It’s defined by a container image and configuration settings.
- Environment: A secure boundary around a group of related Container Apps. Environments provide a dedicated Kubernetes namespace, shared VNet integration, and shared configuration.
- Revision: A specific, immutable version of a Container App deployment. Enables versioning, A/B testing, and blue/green deployments.
- KEDA Integration: Event-driven autoscaling from many sources, including HTTP traffic, queues, Service Bus topics, and cron schedules.
- Dapr Integration: An optional built-in distributed application runtime that handles common microservice needs such as service discovery, state management, and pub/sub.
- Managed Identity: ACA works with Azure Active Directory (Azure AD) Managed Identities, so apps can reach other Azure resources without credentials in code.
Google Cloud Run
Google Cloud Run is Google Cloud’s fully managed platform for running stateless HTTP containers. It hides all of the infrastructure; developers supply a standard container image and nothing else.
- Service: The primary resource in Cloud Run, representing your logical application or microservice. You deploy container images to a service.
- Revision: Similar to ACA, a Revision is an immutable snapshot of the code and configuration for a service at a particular point in time. Each deployment creates a new revision. Cloud Run manages routing traffic to these revisions.
- Knative-Based: Built on the open-source Knative project, Cloud Run provides a standard serving API, promoting portability and reducing vendor lock-in for the container workload itself.
- Container Focus: Takes a standard OCI container image as input (or builds one from source). Supports any language, binary, or library that can run in a Linux container.
- Managed Infrastructure: Google manages all underlying infrastructure (nodes, clusters, OS patching). You don’t interact with VMs or Kubernetes clusters directly.
- Scaling: Automatically scales based on incoming HTTP(S), gRPC, or WebSocket requests. Can scale down to zero instances when idle, which keeps costs low for variable workloads. Supports configurable concurrency (multiple requests per instance).
Platform Showdown: ECS Fargate vs. Azure Container Apps vs. Cloud Run
Here is how the three compare on the things that usually decide the choice.
1. Deployment Experience
- ECS Fargate: Relies heavily on detailed Task Definitions (JSON/IaC), offering fine-grained control. AWS Copilot simplifies common patterns.
- ACA: Configuration via ARM/Bicep/YAML/CLI/Portal. More application-centric with revisions for rollbacks/traffic splitting.
- Cloud Run: Deployment primarily via
gcloudCLI or IaC. Very simple source-to-URL or container-to-URL workflow. Configuration focuses on service/revision settings (env vars, CPU/memory, concurrency). - Verdict: Cloud Run often offers the simplest deployment for standard HTTP containers. ACA is simple for web apps with good revision management. ECS provides the most granular control.
2. Scaling
- ECS Fargate: Uses ECS Service Auto Scaling (CPU/Memory/SQS). Less diverse triggers out-of-the-box.
- ACA: Leverages integrated KEDA scalers (HTTP, queues, topics, many others). Rich event-driven scaling. Scales to zero.
- Cloud Run: Scales automatically based on concurrent requests (HTTP/gRPC/WebSockets). Scales down to zero instances when idle. Configurable concurrency per instance. Less diverse event triggers than ACA directly, but integrates with Eventarc for broader eventing.
- Verdict: ACA (with KEDA) provides the most flexible event-driven scaling triggers. Cloud Run offers excellent request-based scaling and efficient scale-to-zero. ECS handles CPU- and memory-based scaling well.
3. Networking
- ECS Fargate: Task ENI in your VPC. Full VPC integration (Security Groups, ACLs). Requires ALB/NLB for exposure.
- ACA: Runs in an ACA Environment (isolated network, optional VNet integration). Built-in HTTPS Ingress (Envoy). Simpler initial setup for web apps.
- Cloud Run: Provides managed HTTPS endpoint automatically. Supports custom domains with managed TLS. Can integrate with VPC Connector for private network access. Simple built-in ingress.
- Verdict: ECS Fargate offers the deepest VPC integration. Cloud Run provides the simplest managed ingress. ACA strikes a balance with its environment concept and built-in ingress.
4. Observability
- ECS Fargate: Integrates with AWS CloudWatch (Logs, Metrics, Container Insights) and X-Ray. Requires some setup (e.g., agent sidecar).
- ACA: Integrates with Azure Monitor (Log Analytics, Application Insights). Often streamlined setup.
- Cloud Run: Integrates tightly with Google Cloud’s operations suite (formerly Stackdriver): Cloud Logging, Cloud Monitoring, Cloud Trace. Generally straightforward setup.
- Verdict: All three offer strong observability within their ecosystems. ACA and Cloud Run often feel slightly more integrated out-of-the-box than ECS Fargate.
5. Security
- ECS Fargate: IAM Roles for Tasks. Security Groups at task level. Secrets from Secrets Manager/Parameter Store.
- ACA: Azure AD Managed Identities. Network policies within Environment/NSGs. Secrets managed in ACA or Key Vault.
- Cloud Run: Uses IAM Service Accounts for identity and permissions. VPC Service Controls for network perimeter. Secrets from Secret Manager.
- Verdict: All three have strong security built on their own cloud’s identity system. Pick based on whether your team knows IAM (AWS/GCP) or Azure AD better.
6. Developer Experience & Tooling
- ECS Fargate: Supported by CDK, Terraform, CloudFormation, AWS CLI. AWS Copilot simplifies workflows.
- ACA: Supported by Azure CLI, Bicep/ARM, Terraform. VS Code/GitHub Actions integration. Built-in Dapr is a plus for microservices.
- Cloud Run: Very simple
gcloud run deployexperience. Supported by Terraform, Pulumi. Cloud Code plugins for IDEs. Source-to-URL builds simplify workflow. Language-agnostic. - Verdict: Cloud Run offers arguably the simplest core deployment experience. ACA’s Dapr integration is a specific advantage for microservices. ECS has mature tooling and Copilot.
7. Microservices Enablement (Platform Specifics)
- ECS Fargate: Requires manual setup or tools like App Mesh for advanced patterns.
- ACA: Optional Dapr integration simplifies service invocation, state, pub/sub, etc.
- Cloud Run: No built-in Dapr equivalent. Relies on standard container communication (HTTP/gRPC) and integrates with Pub/Sub, Tasks, etc., for eventing and async work. Simplicity is the focus.
- Verdict: ACA with Dapr is explicitly designed for simplifying microservices. Cloud Run focuses on simple, stateless HTTP/gRPC services, integrating with other GCP services for patterns. ECS requires more manual configuration.
8. Pricing
- ECS Fargate: Per-second billing based on requested vCPU/Memory.
- ACA: Consumption plan: free tier, per-second usage billing (vCPU/Memory/requests), scales to zero. Workload Profiles plan: dedicated resources.
- Cloud Run: Per-second billing based on vCPU/Memory usage only while processing requests. Request billing. Generous free tier. Scales to zero.
- Verdict: Cloud Run and ACA Consumption plan are very cost-effective for variable/idle workloads due to scale-to-zero and usage-based billing. Fargate is predictable based on resource requests.
Code Snippets & Examples
The snippets below are simplified to keep them short.
ECS Fargate: Minimal Task Definition (JSON)
{ "family": "my-app-task", "networkMode": "awsvpc", "requiresCompatibilities": ["FARGATE"], "cpu": "256", // 0.25 vCPU "memory": "512", // 512 MiB "executionRoleArn": "arn:aws:iam::ACCOUNT_ID:role/ecsTaskExecutionRole", "taskRoleArn": "arn:aws:iam::ACCOUNT_ID:role/myAppTaskRole", // Optional: For app permissions "containerDefinitions": [ { "name": "my-app-container", "image": "nginx:latest", // Replace with your image "portMappings": [ { "containerPort": 80, "hostPort": 80, "protocol": "tcp" } ], "essential": true, "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "/ecs/my-app-task", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "ecs" } } } ]}ECS Fargate: Deploy Service (AWS CLI - simplified)
# Assumes VPC, Subnets, Security Group, Cluster, Task Definition existaws ecs create-service \ --cluster my-ecs-cluster \ --service-name my-fargate-service \ --task-definition my-app-task:1 \ --desired-count 2 \ --launch-type FARGATE \ --network-configuration "awsvpcConfiguration={subnets=[subnet-xxxxxxxx,subnet-yyyyyyyy],securityGroups=[sg-zzzzzzzz]}" \ --platform-version LATESTAzure Container Apps: Minimal Bicep Configuration
param location string = resourceGroup().locationparam environmentName string = 'my-aca-environment'param appName string = 'my-container-app'param containerImage string = 'nginx:latest' // Replace with your image
resource environment 'Microsoft.App/managedEnvironments@2022-03-01' = { name: environmentName location: location sku: { name: 'Consumption' } properties: {}}
resource containerApp 'Microsoft.App/containerApps@2022-03-01' = { name: appName location: location properties: { managedEnvironmentId: environment.id configuration: { ingress: { external: true targetPort: 80 } } template: { containers: [ { name: appName image: containerImage resources: { cpu: 0.25 memory: '0.5Gi' } } ] scale: { minReplicas: 1 maxReplicas: 3 rules: [ { name: 'http-scaling-rule' http: { metadata: { concurrentRequests: '50' // Scale up if 50 concurrent requests } } } ] } } }}
output fqdn string = containerApp.properties.configuration.ingress.fqdnAzure Container Apps: Deploy App (Azure CLI - simplified)
# Assumes Resource Group and ACA Environment existaz containerapp create \ --name my-container-app \ --resource-group my-resource-group \ --environment my-aca-environment \ --image nginx:latest \ --target-port 80 \ --ingress external \ --min-replicas 1 \ --max-replicas 3 \ --cpu 0.25 \ --memory 0.5GiGoogle Cloud Run: Deploy Container (gcloud CLI - simplified)
# Deploying a pre-built public image (nginx)gcloud run deploy my-cloudrun-service \ --image nginx:latest \ --platform managed \ --region us-central1 \ --allow-unauthenticated # Allow public access for this example
# Deploying from source code in current directory (requires Dockerfile)# gcloud builds submit --tag gcr.io/PROJECT_ID/my-app-image# gcloud run deploy my-cloudrun-service \# --image gcr.io/PROJECT_ID/my-app-image \# --platform managed \# --region us-central1Use Cases & Recommendations
Each platform fits some situations better than others.
Choose AWS ECS Fargate when
- You are heavily invested in the AWS ecosystem and prefer deep VPC integration.
- You need fine-grained control over task definitions and networking (e.g., specific ENI configurations, complex routing with ALBs/NLBs).
- Your scaling needs are primarily driven by CPU/Memory utilization or basic SQS queue depth.
- You are migrating existing ECS workloads from EC2 launch type to serverless.
- You require specific AWS service integrations that might be more mature or straightforward with ECS (though this gap is often closing).
- Predictable resource-based pricing is preferred over usage-based pricing.
Choose Azure Container Apps when
- You are building modern web applications or microservices, especially event-driven ones.
- You want simplified deployment, built-in ingress, and managed certificates.
- You need sophisticated, event-driven autoscaling (scaling based on queues, topics, HTTP traffic, cron schedules, etc.) and scale-to-zero capabilities.
- You want to leverage Dapr for building distributed applications without managing Dapr components yourself.
- You prefer a higher-level abstraction over container orchestration details.
- You are looking for potentially lower costs for applications with variable or low traffic via the Consumption plan’s free tier and usage-based billing.
- You are primarily within the Azure ecosystem or building cross-platform apps leveraging Dapr.
Choose Google Cloud Run when
- You need the simplest way to run stateless HTTP containers in the cloud.
- Fast, request-based autoscaling (including scale-to-zero) is critical.
- You prefer a pay-only-for-what-you-use model tied directly to request processing.
- You want to build from source or deploy standard OCI containers without vendor lock-in at the container level.
- You are primarily within the Google Cloud ecosystem or value Knative compatibility.
- Your microservices are primarily synchronous request/response or integrate via standard GCP services like Pub/Sub or Tasks.
Conclusion
AWS ECS with Fargate, Azure Container Apps, and Google Cloud Run all take infrastructure management off your hands so developers can focus on the application. Which one fits best depends on your requirements, the cloud you already use, and your architecture. The decision tree below summarizes the trade-offs.
- ECS Fargate is mature, tightly integrated with AWS, gives fine-grained control, and uses the familiar VPC networking model. It suits organizations already invested in AWS or that need that level of network control.
- Azure Container Apps is application-centric, has the most flexible event-driven scaling (via KEDA), includes Dapr for microservices, and its Consumption plan with scale-to-zero can be cheap. It suits new microservice projects, event-driven architectures, and teams that want those capabilities built in.
- Cloud Run is the simplest way to deploy and scale stateless HTTP containers: fast deployment, automatic request-based scaling down to zero, pay-per-use pricing, and Knative underneath for portability. It suits web APIs, microservices, and backends with variable traffic where simplicity and cost matter most.
To decide, weigh your application’s deployment complexity, scaling triggers, networking requirements, microservice patterns, existing cloud, and cost sensitivity against the comparisons above.