
Amazon ECS on AWS Fargate blue/green with Amazon VPC Lattice test and production listener rules, an AWS Lambda test hook and an Amazon CloudWatch alarm for rollback.
x-environment: test) and a production rule, and two IP target groups that ECS registers tasks into.NONE, so any client in the associated VPC can call it. For production, use auth type AWS_IAM with an auth policy.git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/ecs-vpc-lattice/typescript/cdknpm installREGION=${AWS_REGION:-$(aws configure get region)}PL=$(aws ec2 describe-managed-prefix-lists --region $REGION --filters "Name=prefix-list-name,Values=com.amazonaws.$REGION.vpc-lattice" --query "PrefixLists[0].PrefixListId" --output text)npx cdk deploy --parameters LatticePrefixListId=$PLnpx cdk deploy --parameters LatticePrefixListId=$PL -c appVersion=v2, with PL set as in the deployment steps (look it up again if you opened a new shell).aws ecs list-service-deployments and aws ecs describe-service-deployments, the production listener rule weights with aws vpc-lattice get-rule, and the hook Lambda logs with aws logs filter-log-events. The hook log shows the test listener returning the new version before production traffic shifts.npx cdk destroy.