Skip to content

Troubleshooting

Use this table to identify the likely cause of your deployment issue:

SymptomLikely CauseWhere to Look
Service spinning / rollback loops

New tasks fail ALB health checks repeatedly, triggering RollbackAlarm
A CloudWatch metric alarm created by Express Mode that triggers automatic deployment rollback when new tasks fail ALB health checks.

EC2 → Target Groups → Targets tab (health reason)

503 errors from Application URL
The unique Express-provisioned HTTPS URL on *.ecs.<region>.on.aws used for all normal application traffic.

No healthy targets registered in the target groupEC2 → Target Groups → Targets tab
Private DNS resolution failure

VPC
Virtual Private Cloud — an isolated virtual network within AWS where resources are deployed.
DNS support or hostnames not enabled

VPC settings: enable_dns_support, enable_dns_hostnames

Health status “Unknown” on Tasks tab

Normal and expected — Express Mode does not define container-level healthCheck

No action needed (see explanation below)
Target group unhealthy

Security Group
A virtual firewall for EC2 instances and other resources that controls inbound and outbound traffic.
missing ingress, container crash, wrong health path, or port mismatch

EC2 → Target Groups → health reason column
Deployment rollback

ALB health checks fail within the deregistration delay, RollbackAlarm fires

ECS → Service → Events/Timeline, CloudWatch Alarms

When a deployment fails, 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.
follows a predictable rollback cycle:

  1. New tasks start with the updated task definition
  2. The Shared ALB
    The Application Load Balancer shared by up to 25 Express services in the same VPC using Host header routing rules.
    health checks the new targets on the configured health_check_path
  3. Health checks fail (target returns non-200 or connection refused)
  4. The RollbackAlarm
    A CloudWatch metric alarm created by Express Mode that triggers automatic deployment rollback when new tasks fail ALB health checks.
    fires after the evaluation period
  5. Express Mode rolls back to the previous stable deployment
  6. The cycle repeats on the next deployment attempt until the root cause is fixed

PLACEHOLDER: ECS Timeline showing rollback events

When your service fails to deploy, follow this order to find the root cause quickly:

Navigate to EC2 → Target Groups → your target group → Targets tab. The health reason column tells you exactly why targets are unhealthy:

  • Request timeout — container is not responding on the expected port
  • Health checks failed — container responded with non-200 status
  • Target not in service — task was deregistered or stopped

PLACEHOLDER: EC2 Target Groups → Targets (unhealthy) with reason

Check the ECS task log group for container startup errors. Look for:

  • Application crash stack traces
  • Missing environment variables
  • Port binding failures
  • Permission denied errors

PLACEHOLDER: CloudWatch Logs showing container startup error

Step 3: ECS stopped task reason and exit code

Section titled “Step 3: ECS stopped task reason and exit code”

In the ECS console, go to Cluster → Service → Tasks (stopped) and check:

  • Stopped reason — why ECS stopped the task
  • Exit code — the container’s exit code (non-zero indicates a crash)
    • Exit code 1 — application error
    • Exit code 137 — killed by OOM (out of memory)
    • Exit code 139 — segmentation fault

From a resource within the same VPC
Virtual Private Cloud — an isolated virtual network within AWS where resources are deployed.
, curl the health check path directly:

Terminal window
curl -v http://<task-private-ip>:<container-port>/health

This confirms whether the container is actually serving traffic on the expected port and path.

These are the most frequent reasons for Express Mode health check failures:

The task Security Group
A virtual firewall for EC2 instances and other resources that controls inbound and outbound traffic.
must allow inbound traffic on the container port from the VPC
Virtual Private Cloud — an isolated virtual network within AWS where resources are deployed.
CIDR block. The Shared ALB
The Application Load Balancer shared by up to 25 Express services in the same VPC using Host header routing rules.
lives within the same VPC and routes health check probes to task IPs.

main.tf
ingress {
from_port = var.container_port
to_port = var.container_port
protocol = "tcp"
cidr_blocks = [aws_vpc.this.cidr_block]
}

The container crashes before it can respond to health checks. Common causes:

  • Missing required environment variables
  • Database or dependency connection failures
  • Incorrect entrypoint command
  • Insufficient memory allocation

The health_check_path in the 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.
configuration must match an endpoint that returns HTTP 200. If your application uses /healthz but the config says /health, checks will fail with 404.

The container_port in the task definition must match the port your application actually listens on. If the app binds to port 8080 but container_port is set to 3000, the ALB cannot reach it.

When viewing the ECS Tasks tab, you may see Health status: Unknown for your Express Mode tasks. This is normal and expected behavior.

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.
does not define a container-level healthCheck in the task definition. Instead, it relies entirely on ALB target group health checks to determine whether tasks are healthy. The “Unknown” status simply means ECS has no container-level health information — it does not indicate a problem.

To confirm your service is healthy:

  1. Navigate to EC2 → Target Groups → Targets
  2. Verify targets show status healthy
  3. The Application URL
    The unique Express-provisioned HTTPS URL on *.ecs.<region>.on.aws used for all normal application traffic.
    is accessible and returns expected responses