Overview
What is ECS Express Mode?
Section titled “What is ECS Express Mode?” Express Gateway Service
The aws_ecs_express_gateway_service Terraform resource that provisions an ECS service with managed ALB, auto scaling, and simplified configuration for HTTP/HTTPS web applications and APIs. is a
simplified deployment model for Amazon ECS. It lets you deploy stateless
HTTP/HTTPS containers without provisioning separate ALB, target group, listener,
or auto scaling resources.
Your entire service infrastructure becomes one Terraform resource:
resource "aws_ecs_express_gateway_service" "this" { service_name = "my-service" cluster = aws_ecs_cluster.this.arn task_definition = aws_ecs_task_definition.this.arn infrastructure_role_arn = aws_iam_role.infrastructure.arn
primary_container { container_name = "app" container_port = 8000 health_check_path = "/health" }
network_configuration { subnets = aws_subnet.public[*].id security_groups = [aws_security_group.web.id] access_type = "PUBLIC" }
scaling_target { auto_scaling_metric = "CPU" auto_scaling_target_value = 70 min_task_count = 1 max_task_count = 4 }}That’s it. No ALB resource, no target group, no listener rules, no scaling policies.
The demo application
Section titled “The demo application”This walkthrough documents a working project: a Bedrock
AWS fully managed service providing foundation models for generative AI applications. -powered image analysis API that:
- Runs a FastAPI container with a
/healthendpoint and Swagger UI at/docs - Accepts image uploads and returns AI-generated descriptions via Foundation Model
A pre-trained large language or multimodal model available through Amazon Bedrock. - Deploys to a public HTTPS endpoint with auto scaling and health-check-driven rollback
- Uses a single
terraform applyto provision the entire stack
What Terraform manages
Section titled “What Terraform manages”| Resource | Purpose | File |
|---|---|---|
aws_ecs_express_gateway_service | Service with managed ALB, scaling, health checks | main.tf |
aws_ecs_cluster | Fargate-backed cluster | main.tf |
aws_ecs_task_definition | Container image, port, environment | main.tf |
| Network with public subnets and IGW | main.tf |
aws_security_group | VPC CIDR ingress on container port | main.tf |
| Task execution, infrastructure, task roles | main.tf |
What this walkthrough covers
Section titled “What this walkthrough covers”| Section | Content |
|---|---|
| ECS Express Mode | Concepts, Express Gateway Service resource, auto scaling, health checks |
| IAM Roles | Three-role model, trust policies, Bedrock permissions |
| Networking | VPC layout, security groups, public subnets, ingress configuration |
| Deployment | Terraform apply, verifying health, accessing the web UI |
| Troubleshooting | Rollback loops, health check failures, common root causes |