Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
217 views
in Technique[技术] by (71.8m points)

amazon cloudformation - How to update AWS Fargate service outside AWS code deploy in order to change desired task count

When set up AWS code deploy to deploy an AWS service we have to provide 2 target groups lets say TargetGroupBlue and TargetGroupGreen.

In the cloudformation template we use the TargetGroupBlue when linking the Service to Loadbalancer. TargetGroupGreen is created only to be used by AWS during code deploy.

Step 1 : We executed create stack command in order to create the service and loadbalancer. We have a workable service now. Traffic is routed via TargetGroupBlue.

Step 2 : Then use code deploy to do another deploy which will the swap the target group to TargetGroupGreen once done.

enter image description here

Step 3 : Now we need to update the desired task count in service so use cloudformation update stack command. This fails because the targetgroup is TargetGroupGreen (as Code deploy changed it in step 2) and out cloud formation templates has used TargetGroupBlue for linking the service to Loadbalancer.

The workaround could be do all service related updates outside code deploy in a even numbered release (so always have to do code deploy twice so that we know traffic is always routed TargetGroupBlue)

Is this the way we should work with service updates via cloudformation and Code Deploy? Please help to get this figured out.

question from:https://stackoverflow.com/questions/65920225/how-to-update-aws-fargate-service-outside-aws-code-deploy-in-order-to-change-des

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Even though AWS provides many cool ways to work with when it comes to BlueGreen deploys with CodeDeploy or CloudFormation it really sucks.

The work around they suggested was to use Custom Resources in cloudformation which will actually trigger a lambda function to get the services updated cheating the cloudformation stack updates. Sample. But there are no proper samples to do that so it would take lot of time to get it to work the way you need.

Furthermore, the cloudforamtion with hooks does not really work for bigger projects as the LBs cannot be shared.

So here is the open ticket, please help to put a thumbs up so the AWS will prioritize this in their roadmap. https://github.com/aws-cloudformation/aws-cloudformation-coverage-roadmap/issues/483


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...