Blue/Green Deployments for AWS ECS
Problem to solve
As a developer deploying to AWS ECS, I want to deploy using blue/green deployment method.
User experience goal
The user should be able to switch between blue/green environments directly from GitLab and be able to visually see both environments and know which production is currently being used by the users.
Leverage existing AWS infrastructure to accomplish this
- 2 target groups exist in the EC2 console - blue and green (can be created via AWS console or API).
- The target groups are configured to the autoscaling groups.
- There is a deployment group configured
- There is a listener rule - forward to
greencreated for each of the target groups
We need to add support to:
- Build and push blue/green container images to the GitLab's package repository
- Tag the images
- ECS service for blue/green deployments
Option one - use forwarding rules:
- Change the listener forwarding rule using the
When a user presses the Changes the weights of the deployments - the listener rule should be updated to the other environment
When the user uses quick action
/switch the listener rule should be updated
Option two: -Swap the container images
- Update Task Definition revision using green container image
- Replace the Image with the secondary image (v2) URI
- Update ECS service to use new Task Definition revision and trigger a new deployment
The user needs to know which environment/URL is currently blue and which is green
Description Replaces the specified properties of the specified rule. Any properties that you do not specify are unchanged.
To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action.
modify-rule --rule-arn <value> [--conditions <value>] [--actions <value>] [--cli-input-json <value>] [--generate-cli-skeleton <value>]
Permissions and Security
Only users who have permission to deploy to production can switch environments
Availability & Testing
What does success look like, and how can we measure that?
What is the type of buyer?
Is this a cross-stage feature?
Links / references