Deploy a containerized web app to AWS App Runner from an ECR image or GitHub repo with auto-scaling and HTTPS out of the box.
App Runner is the easiest way to deploy containerized apps on AWS. You give it a container image (from ECR) or a source code repo (from GitHub), and it handles provisioning, load balancing, auto-scaling, TLS, and health checks. No ECS task definitions, no ALB configuration, no ASG tuning.
# Create repository
aws ecr create-repository --repository-name my-ai-app
# Get your account ID
ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
REGION=us-east-1
REPO=$ACCOUNT.dkr.ecr.$REGION.amazonaws.com/my-ai-app
# Authenticate Docker to ECR
aws ecr get-login-password | docker login --username AWS --password-stdin $REPO
# Build and push
docker build -t my-ai-app .
docker tag my-ai-app:latest $REPO:latest
docker push $REPO:latest{
"ServiceName": "my-ai-app",
"SourceConfiguration": {
"ImageRepository": {
"ImageIdentifier": "123456789.dkr.ecr.us-east-1.amazonaws.com/my-ai-app:latest",
"ImageRepositoryType": "ECR",
"ImageConfiguration": {
"Port": "3000",
"RuntimeEnvironmentVariables": {
"NODE_ENV": "production",
"ANTHROPIC_API_KEY": "{{resolve:secretsmanager:prod/anthropic-key}}"
}
}
},
"AutoDeploymentsEnabled": true
},
"InstanceConfiguration": {
"Cpu": "1 vCPU",
"Memory": "2 GB"
},
"HealthCheckConfiguration": {
"Protocol": "HTTP",
"Path": "/health",
"Interval": 10,
"Timeout": 5,
"HealthyThreshold": 2,
"UnhealthyThreshold": 3
}
}aws apprunner create-service --cli-input-json file://apprunner.json
# Check status
aws apprunner list-services
# Get service URL
aws apprunner describe-service --service-arn arn:aws:apprunner:us-east-1:123456:service/my-ai-app/abc --query 'Service.ServiceUrl' --output textapp.get('/health', (req, res) => {
res.json({
status: 'ok',
timestamp: new Date().toISOString(),
version: process.env.npm_package_version
});
});/health endpoint to your app if you don't have one