Architecture note5 lab guides5 lab guides
ECS · Elastic Container Service
Task definitions, service discovery, and the deployment failures that leave you at half capacity.
Outcome
- Create a cluster via CLI with Container Insights enabled
- Push an image to ECR
- Write a task definition JSON from scratch
- Run a one-off Fargate task and get its public IP
- Read
stoppedReasonandexitCodefrom a failed task
- Create an ALB + target group wired to an ECS service
- Deploy a new task definition revision via
update-service - Explain
minimumHealthyPercentandmaximumPercentin a rolling update - Trigger the deployment circuit breaker and confirm auto-rollback
- Create and assign both the execution role and task role
- Explain exactly what each role does and when it is used
- Inject a Secrets Manager secret as an environment variable
- Diagnose a permissions failure by identifying which role is missing the permission
- Register a scalable target and attach a target tracking policy
- Use
heyto generate load and observe tasks scaling out - Read scaling activity history from Application Auto Scaling
- ECS Exec into a running Fargate task
- Inspect the credential endpoint at
169.254.170.2and identify the Task Role - Explain why ECS Exec is safer than SSH
- Write a Dockerfile with correct layer ordering for cache efficiency
- Explain why
npm ciis used overnpm installin a Dockerfile - Authenticate Docker to ECR and push an image with a git SHA tag
- Explain why
latestis dangerous in production
- Distinguish between the Task Execution Role and the Task Role
- Explain why the Task SG sources from the ALB SG instead of
0.0.0.0/0 - Register a task definition and explain every required field
- Connect an ALB target group to an ECS service and explain what
containerPortmaps to
- Write a workflow that builds, tags with
$GITHUB_SHA: pushes to ECR, and deploys to ECS - Explain why
$GITHUB_SHAis used instead oflatest - Explain why tests must run before the Docker build step
- Store secrets correctly, never hardcode credentials in workflow YAML
- Write a workflow that builds, tags with
- Explain
minimumHealthyPercentandmaximumPercentand their tradeoffs - Perform a manual rollback to a previous task definition revision
- Explain connection draining and tune the deregistration delay
- Identify a stuck deployment (health check loop) from
describe-servicesoutput
- Explain
- Name the four key ALB + ECS metrics to watch post-deployment
- Create alarms for 5xx rate, healthy host count, and CPU with correct thresholds
- Read container logs and identify startup errors
- Distinguish a deployment issue (health check loop) from an application issue (5xx post-deployment)