Deploying a container to AWS ECS Fargate from CI involves several precise steps: authenticating to ECR, building and tagging an image, pushing it, and registering a new task definition revision. This generator produces a complete GitHub Actions workflow that does all of that using OIDC role assumption, so no static AWS keys live in your repository.
How it works
The workflow uses the official AWS actions in a fixed order:
aws-actions/configure-aws-credentialsassumes your IAM role via GitHub’s OIDC token — short-lived credentials, no stored keys.aws-actions/amazon-ecr-loginauthenticates Docker to your private ECR registry.docker buildanddocker pushcreate and upload the image tagged with the commit SHA.aws-actions/amazon-ecs-render-task-definitioninjects the new image into your task definition JSON.aws-actions/amazon-ecs-deploy-task-definitionregisters the revision and updates the service, waiting for stability.
Tips and notes
- Grant the IAM role only
ecr:*on the repository plus the ECS and IAM PassRole permissions it needs — least privilege. - Tagging by commit SHA makes rollbacks trivial: re-deploy a prior task definition revision pointing at the old SHA.
- Set
wait-for-service-stability: trueso the job fails if the new tasks never reach a healthy steady state. - Keep a base task definition JSON file in your repo so the render step has something to patch.