Build CodePipeline to implement two approach of deployment on AWS CDK.
-
ECS Blue/Green deployment with CodeDeploy
- Leverage @cloudcomponents/cdk-blue-green-container-deployment CDK construct to create CodeDeploy Deployment Group
Notice: This project is not CDK Construct which is CDK App for lab
Include three stacks
-
ApiNetwork - Vpc, Alb, Subnet and so on...
-
ApiApp - ECS cluster, ECS Service, ECS Task Definitions, ECR and so on...
-
ApiPipeline - CodePipeline, CodeBuild
Web App for ECS
Support two approach of deployment
- Two valid value of Deployment.type is
RollingUpdate
orBlueGreen
E2E testing when choosing BlueGreen deployment
- Use newman (postman cli) to test on BeforeAllowTraffic of AppSpec 'hooks' section
- Specify postman api-key and collection uid in configs/lab.yml
Modify configs/lab.yml to configure ECS.
The most important property is desiredCount
which determines how many ECS Tasks should be run.
⚠️ Notice: desiredCount should be set 0 when first cdk deploy because ECR container image of ECS task hasn't be created yet.
Two demo configurations
-
ecs-private-ip-through-nat.yml use private subnet on ECS Service and use NAT Gateway to connect internet.
-
ecs-public-ip.yml use public subnet on ECS and assign public ip to connect internet directly.
Both the two configurations accept traffic from ALB.