Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-ecs: FargateServiceProps Missing Field forceNewDeployment? #27762

Open
saidkharboutli opened this issue Oct 30, 2023 · 6 comments
Open

aws-ecs: FargateServiceProps Missing Field forceNewDeployment? #27762

saidkharboutli opened this issue Oct 30, 2023 · 6 comments
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p2

Comments

@saidkharboutli
Copy link

Describe the bug

Hello,

I just noticed that my CDK script has been doing every step of my NodeJS backend deployment except for restarting my ECS service upon ECR image update. There seems to be numerous threads on this specific issue, and the common answer is to use forceNewDeployment, which can be set from the CLI as well as within the Fargate service definition.

Currently, I am able to go into the AWS dashboard and manually check forceNewDeployment but that isn't the programmatic solution I am looking for. Also, once AWS spins up the new service and removes the old one, I have to check the option again for the next deployment.

The real underlying issue is that, for some reason, the FargateServiceProps interface has no mention of this specific option. I am really not sure why, given that this issue of updating the ECS service after an ECR update is pretty wide-spread.

Expected Behavior

I should be able to set the forceNewDeployment to true for the service when it is first built and thereafter. I really just want the ECS service to restart without downtime when the ECR image updates. If there is another way to do this that I have missed, please do let me know.

Current Behavior

forceNewDeployment is not included as an option when creating an ECS service with CDK. Even checking it manually in the console does not stick, as the current service will spin down after the new one (that has the option set to False by default) is spun up.

Reproduction Steps

Not certain if there are reproduction steps--it moreso a lack of an important field within the service definition.

Possible Solution

Allow forceNewDeployment to be set to true for the creation of every service, forcing new ECS services to take the place of old ones when a new image is pushed to ECR.

Additional Information/Context

No response

CDK CLI Version

2.103.1

Framework Version

No response

Node.js Version

20.9.0

OS

Ubuntu

Language

TypeScript

Language Version

No response

Other information

No response

@saidkharboutli saidkharboutli added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 30, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Oct 30, 2023
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 30, 2023
@khushail khushail self-assigned this Oct 30, 2023
@daschaa
Copy link
Contributor

daschaa commented Oct 31, 2023

@saidkharboutli Can you add a source on where you found the property forceNewDeployment ?
I had a look at the CloudFormation documentation, but I could not find it: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html

@saidkharboutli
Copy link
Author

@daschaa Upon further investigation, you do seem to be right--it's only a property in Terraform, and it's under another name (not camelCase).

Though regardless of its availability in CDK/Terraform now, if it's an option available in the AWS console, should we not be able to set it programmatically? There may be a reason it's not available, but it would be useful for the many people that have posted about this exact issue.

@daschaa
Copy link
Contributor

daschaa commented Nov 1, 2023

@saidkharboutli I totally agree with you that the goal should be to cover the functionalities which you also have in the AWS console. However, if the field is not available in CloudFormation, we need to wait until CloudFormation implemented this.
I guess you could technically also implement a workaround with a custom resource and the AWS SDK, but I think the maintainers of the CDK are hesitant to implement new custom resources.

I would suggest to put a flag needs-cfn to this issue and leave it open.

@khushail
Copy link
Contributor

Thanks @saidkharboutli for reporting this.
Thanks @daschaa for your investigation.

It is not supported by cloudformation yet. However one can submit a FR for this to be added on the Cloudformation coverage roadmap.

@khushail khushail added p2 feature-request A feature should be added or improved. effort/medium Medium work item – several days of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. effort/small Small work item – less than a day of effort and removed bug This issue is a bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. effort/medium Medium work item – several days of effort labels Nov 10, 2023
@khushail khushail removed their assignment Nov 10, 2023
@saidkharboutli
Copy link
Author

@daschaa I appreciate your time on this endeavor greatly! I will likely take this over to the Cfn team then, and then perhaps once it is ready, this can be my first PR on the CDK project.

Thanks @khushail, I'll make that FR before I leave work today.

@rgoltz
Copy link

rgoltz commented Jan 13, 2024

I'm adding the reference for the FR on CFN-github repo here: aws-cloudformation/cloudformation-coverage-roadmap#1776 - Please up-vote this linked issue, to make CFN team aware of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p2
Projects
None yet
Development

No branches or pull requests

4 participants