This repository provides a comprehensive GitHub Actions workflow template for deploying applications to AWS ECS (Elastic Container Service). It includes support for Blue/Green deployments through AWS CodeDeploy and automated task definition updates.
- 🚀 Automated AWS ECS service deployment
- 🔄 Blue/Green deployment support via CodeDeploy
- 🔧 Automatic Task Definition updates
- 📊 Deployment status monitoring
- 🔐 Secure AWS authentication using STS assume role
- 🐳 Multi-container support with sidecar patterns
- 🏗️ Flexible build and deployment configurations
- AWS Account with appropriate permissions
- GitHub repository with GitHub Actions enabled
- Docker for local development and testing
-
Fork this repository or use it as a template
-
Create Identity Provider. in AWS: [Guide]
-
Create IAM Role in your AWS Account:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::<ACCOUNT-ID-HERE>:oidc-provider/token.actions.githubusercontent.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" }, "StringLike": { "token.actions.githubusercontent.com:sub": "repo:<ORG-OR-USER-NAME-HERE>/*" } } } ] }
-
Copy the
.github/workflows/example-workflow.yaml
to your project -
Customize the workflow configuration for your needs
-
Push your changes to trigger the workflow
build.yaml
: Handles Docker image building and pushing to ECRdeploy.yaml
: Manages ECS service deployment and updatesdeploy_lambda.yaml
: Optional Lambda function deploymentcancel.yaml
: Workflow cancellation handlingrun-credential-searcher.yaml
: Security scanning for credentials
The repository includes two Dockerfile templates:
server.Dockerfile
: Main application containersidecar.Dockerfile
: Sidecar container for additional services
⚠️ Important: Do not useAWS_ACCESS_KEY
andAWS_SECRET_ACCESS_KEY
for GitHub Actions AWS Authentication. Usests-assume-role
instead.- Regular security scanning for exposed credentials
- Secure secret management through GitHub Secrets
We welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the existing issues
- Create a new issue using our issue templates
- Review our documentation
- AWS ECS Team
- GitHub Actions Team
- All contributors and users of this template