FargateService trying to update ECS service when CODE_DEPLOY used
See original GitHub issueThe FargateService class is trying to update the ECS Service when a new task definition is provided to the service when DeploymentControllerType.CODE_DEPLOY
is specified. When using Blue/Green deployment strategy powered by CodeDeploy in a Fargate Service, only the desired count, deployment configuration, and health check grace period can be updated using the update-service
. Otherwise a new CodeDeploy deployment should be created.
So I haven’t been able to do any deploy on production environment with CDK since I use CODE_DEPLOY.
Reproduction Steps
new FargateService(
this,
"FargateService",
FargateServiceProps
.builder()
.cluster(this.props.cluster)
.serviceName(this.getPrefixResourceName())
.assignPublicIp(false)
.desiredCount(this.props.desiredCount)
.healthCheckGracePeriod(Duration.seconds(60))
.minHealthyPercent(100)
.maxHealthyPercent(200)
.taskDefinition(this.taskDefinition)
.securityGroup(this.securityGroup)
.vpcSubnets(this.privateSubnets)
.deploymentController(
DeploymentController
.builder()
.type(DeploymentControllerType.CODE_DEPLOY)
.build()
)
.cloudMapOptions(
CloudMapOptions
.builder()
.name(this.getPrefixResourceName())
.cloudMapNamespace(this.props.serviceDiscoveryNamespace)
.dnsRecordType(DnsRecordType.A)
.dnsTtl(Duration.seconds(60))
.build()
)
.build()
);
Error Log
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: 400; Error Code: InvalidParameterException; Request ID: 83f32eb8-4ed5-4263-b944-9df4d7fa3a62)
Environment
- **CLI Version 😗*1.30.0
- **Framework Version:**1.30.0
- **OS 😗*MacOS Mojave
- **Language 😗*Java
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Updating a service using the classic console
Amazon ECS has provided a new console experience for updating a service. For more information, see . You can update an existing service...
Read more >How to update AWS Fargate service outside AWS code ...
Step 1 : We executed create stack command in order to create the service and loadbalancer. We have a workable service now. Traffic...
Read more >update-service — AWS CLI 2.9.9 Command Reference
Modifies the parameters of a service. For services using the rolling update ( ECS ) you can update the desired count, deployment configuration, ......
Read more >What I learned using AWS ECS Fargate Blue/Green ... - Medium
We had chosen the ECS Fargate service because our web ... changing this to use the CodeDeploy Blue/Green type if you want to...
Read more >How to update ECS service automatically with the latest task ...
I am using aws ECS with Farget and I have workflow on GitHub that changes my ESC task-definition when there are changes in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a workaround to be able to maintain new task definition revisions with CDK and use Code Deploy with an external CLI command.
Explanation: Cloudformation would always try to update the current task definition which would lead to an immediate update of the ecs service. This is not possible (currently) when using
DeploymentControllerType.CODE_DEPLOY
. By adding a new task definition logical resource in the stack but giving it the same task family, Cloudformation will create a new task definition revision. The revision that is active in the ecs service must not be changed anymore. Unfortunately Cloudformation will remove old revisions. There theupdateReplacePolicy
needs to be set toretain
.For automating it the newly created task definition revision can be retrieved from the updated stack which can then be used in a cli call like:
Hey there, I’m consolidating the issues around ecs blue/green deployment support into https://github.com/aws/aws-cdk/issues/1559. If you think this is a separate issue feel free to reopen.