Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
210 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...