Production-ready Hello World for Amazon ECS: FastAPI, health checks
77
A production-ready Hello World container for Amazon ECS. Deploy it to verify your cluster, service, load balancer and health checks end to end, before shipping your real application.

/health (liveness) and /ready (readiness)python -m app.healthcheck/api/infoSIGTERM, so ECS deployments drain cleanlydocker run --rm -p 8080:8080 hiremostafa/aws-ecs-helloworld:latest
| Path | Description |
|---|---|
/ | HTML home page |
/health | Liveness check. Use for ALB and container health |
/ready | Readiness check. Returns 503 during startup/shutdown |
/api/info | App, runtime and ECS task metadata as JSON |
/docs | OpenAPI documentation |
hiremostafa/aws-ecs-helloworld:1.0.08080HTTP, port 8080, target type ip, health check path /health"healthCheck": {
"command": ["CMD", "python", "-m", "app.healthcheck"],
"interval": 30,
"timeout": 5,
"retries": 3,
"startPeriod": 10
}
The container listens on 8080 because it runs as a non-root user.
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | HTTP port |
MESSAGE | Your Amazon ECS app is live | Headline on the home page |
APP_NAME | aws-ecs-helloworld | Application name |
LOG_LEVEL | info | debug, info, warning, error |
LOG_HEALTH_CHECKS | false | Log /health and /ready requests |
ECS_METADATA_TIMEOUT | 2 | ECS metadata request timeout (s) |
GRACEFUL_SHUTDOWN_TIMEOUT | 20 | Seconds to finish in-flight requests |
| Tag | Platform |
|---|---|
latest | linux/amd64 |
1.0.0 | linux/amd64 |
GitHub: https://github.com/code4mk/aws-ecs-helloworld
Crafted with ♥ by code4mk. Questions, ideas or work inquiries: [email protected]
Sample application. Not affiliated with or endorsed by Amazon Web Services.
Content type
Image
Digest
sha256:065ff2c74…
Size
52.9 MB
Last updated
4 days ago
docker pull hiremostafa/aws-ecs-helloworld