aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.66k stars 3.92k forks source link

(aws-ecs): Update Fargate service with new image tag using typescript cdk code #15300

Closed revanthalampally closed 2 years ago

revanthalampally commented 3 years ago

I'm trying to update my already created ECS service with a new task definition with typescript cdk But I do not find any ECS.FargateService.Update methods. What is the best way to update my service in this case?

The reason I need to do this is: I m trying to achieve Blue-Green deployment whenever my image tag changes in the service. Whenever I try to do a CDK deploy with a new image tag, I get: Resource handler returned message: "Invalid request provided: UpdateService error: Unable to update task definition on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment. (Service: AmazonECS; Status Code: 4 After some reading, I found that CDK deploy tries to change the same task revision which won't work with the BLUE GREEN controller.

Hence I thought of manually writing my own stack to update service consisting of: 1) Create a new task revision with a new image tag 2) Update service manually to the new task revision Basically, implementing whatever I do from the UI to trigger a Blue-Green Deployment. But I am stuck in completing writing step 2 since there is not an option in the CDK code. Wondering if anyone has done this before?

Environment

revanthalampally commented 3 years ago

@SoManyHs / @uttarasridhar : Can I know if there is any workaround? Or if I am doing anything wrong?

revanthalampally commented 3 years ago

Can anyone please reply to this?

peterwoodworth commented 2 years ago

Sorry no one has replied to this @revanthalampally,

ECS b/g deployments are really tricky for the CDK to handle, since under the hood CloudFormation's blue/green deployments have some limitations. Please read this thread for more info https://github.com/aws/aws-cdk/issues/1559, I'll be closing this issue in favor of that

github-actions[bot] commented 2 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.