-
Notifications
You must be signed in to change notification settings - Fork 320
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
[ECS] Full support for Capacity Providers in CloudFormation. #631
Comments
Related to this, in order to support capacity providers with |
Has there been any progress made on this? Add support for Capacity providers #1 |
We are working on it and will provide updates as soon as more information is available. |
Additionally, when the |
+1 |
When this is implemented, will it be possible to do a rolling update to the launch template under autoscaling and a change to a service in ecs, such that the new tasks run on instances from the new launch template while the old ones stay on the old instances as they roll over? I'm struggling to achieve this with custom resources at the moment, partly as the dependencies are all in funny directions. Would be great to have it all defined declaratively in cfn. |
Cross-linking the resp. request in aws-cloudformation/cloudformation-coverage-roadmap#301 |
Any ETA on this? |
Does this depend on #632? |
I think no. |
Sadly, that's the reason why using CloudFormation is becoming more and more frustrating. |
FWIW, Terraform has supported this since shortly after the API was released: hashicorp/terraform-provider-aws#11151 Of course, it can't delete capacity providers since there's no API: |
I don't want to use, rely on and support third-party software if I have a chance to use the official product. |
any update? |
same here, any updates? |
any update? |
the lack of Cfn support for this 6 months in is really disappointing. This puts the burden on anyone building CI/CD using Cfn to add additional and silly custom cli/sdk pieces to actually tie in capacity providers, which then have to be ripped out once the support that should be part of a point release is in place. |
Have you had a deeper look into Capacity Providers and Cluster Auto Scaling? Does not match with my requirements at all. Does not scale down properly. Does not work with CloudFormation rolling updates for the ASG. So missing CloudFormation support is not the only problem here. :) |
Thanks for the feedback - can you explain more what you mean by "does not scale down properly"? |
coultn: Here's what I think is a common use case: A CI/CD pipeline where services are spun up on an ASG backed EC2 cluster. |
Thanks for the feedback! We are working on full support for capacity providers in CloudFormation, and we definitely understand the need for that. However, I do want to point out that you can actually create a capacity-provider enabled service in CloudFormation today. You can accomplish this by first configuring a default capacity provider strategy for the cluster. This default capacity provider strategy will be used by any service you create that does not specify a launch type. Next, when you create your service in CloudFormation, do not include the LaunchType parameter. The service will use the capacity provider strategy defined by the cluster, and will auto-scale from zero instances if necessary.
Understood. In the first version of ECS cluster auto scaling, we took a more conservative route where instances would not scale in unless no tasks are running on them. We are looking at the idea of automating an "instance drainer" that will automatically find underutilized instances and set them to draining. With ECS cluster auto scaling, those instances would automatically shut down once no tasks are running on them. It's possible to do this already today, but you would need to implement your own Lambda function (or similar) to do the evaluation of the instance and call the ECS API to set the instance to the DRAINING state. |
Really awesome feedback, thank you. As far as the workaround for setting it at Cluster creation, I'll take a look at that..easy enough to implement for QA/Dev..a little trickier for existing prod environments. Trying to avoid custom tooling since...this seems sooo close to being a solid solution. Any timing on better cfn support? I know that's a different, probably very overwhelmed team, but would be nice to see some improvements here. ECS rocks, and once this is dialed in, it's going to really round out the offering. Will keep checking for ECS updates! |
@taylorb-syd I tried out the
|
In my case, the stack after update remains in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS |
@ipmb To be fair. I missed it the first time. It's a little screwy to call the parameter "AutoScalingGroupArn" but accept either the short name or the ARN. |
For the future thousands that will read the property name and whose brain will process away "or short name", please add an additional property that doesn't have "Arn" in the name and properly describe this in the CloudFormation docs. This is such a ridiculous violation of common sense design |
@verbitan
|
@a-zich That's worked nicely for the delete, thank you! However, when I tried to change something in the
So it's getting closer, but still isn't ready for me to use in production. |
When updating the Error: Is there any workaround how I can update the ASG? |
What kind of update are you doing? Are you doing a This is gonna be difficult because you need to "drain" the instances in the old ASG before the So frankly, without some out of band management I can't see a way to do this with replacement updates. Rolling updates should work however, for 2 reasons:
Caveats:
^ As an example, say you have a web service that requires 2 active tasks (i.e. minimum viable running) to serve the traffic you'll get during your outage window, and the minimum in the service auto-scaling policy is 4, and another service where the minimum active tasks to service is 1 and the minimum in the auto-scaling policy is 6. In order to ensure there is not an interruption of service you will need to set the Max Batch size to 2, since that is the maximum number of tasks (and thus instances) you can terminate is 2 without risking putting a service below minimum viable running. |
For an ECS Cluster that already has a manually created Capacity Provider, it is not possible to use the
However, if the Association resource is commented out, it is possible to create a Capacity Provider with CFN that shows as a managed resource for the stack (as expected). But not in the ECS Console for Capacity Providers, or when editing a service to add/change one. Checking the existing Capacity Providers with Without the CFN Association resource though, the Capacity Provider has no CloudWatch metric or alarms for It is even possible to attach an ECS service to the CFN managed CP:
This results in a new ECS Deployment for the service, but no tasks are created (nothing PROVISIONING/PENDING). As it is not possible to unlink a Capacity Provider from an ECS Service, the only option with non-dynamic service names, is to delete the services and redeploy them without a Capacity Provider. See this #838 for not being able to unlink Services/CPs. This has been raised as a support case to AWS. |
@taylorb-syd's answer above was the final piece for me to get everything working! For reference, below is a snippit of my final working template for capacity providers with managed termination protection enabled.
This has been an issue for us for years, so I'm very happy to finally get this one sorted. Special thanks to @a-zich, @anoopkapoor, @coultn and @taylorb-syd for your help. |
Hi, just wanted to point out that this is also failing in CDK. I have an example that's super close to what's in the documentation, but I get the same "Out of retries...." error |
HI @zsimjee, if you could either raise a Support Case with AWS or provide more details here we can investigate and determine if there is an issue with the CDK implementation. Please also provide your CDK version and other details. Thanks! |
Hi,
However, this results in the following error when setting up the service stack's ClusterCapacityProviderAssociations:
Can there only be a single ClusterCapacityProviderAssociations? |
when this will be closed .. waiting for 2+ years. |
The resource as designed currently is an interface for the So yes, there is a 1:1 relationship between an |
This works when creating a new service, but how do you do this for existing services that have a launch type set? Removing the launch type from the cloudformation template makes the service continue to use the existing launch type and not use the capacity provider strategy, and the ECS Service still doesn't have a way to set a capacity provider strategy via CloudFormation, 2 years later. Updating each service manually using
|
…rAssociations. * Add a note about Service dependency, as per aws/containers-roadmap#631 (comment)
…rAssociations. * Add a note about Service dependency, as per aws/containers-roadmap#631 (comment)
Is there progress being made on this? Ticket has been open 4+ years. FWIW I'm eternally grateful to the hardworking engineers who make all this possible |
CloudFormation does not currently have support for capacity providers in any of the ECS resource types. We will be adding this support in the near future.
The text was updated successfully, but these errors were encountered: