-
Notifications
You must be signed in to change notification settings - Fork 4k
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 Cluster.addCapacity does not set autoscalingGroup property #5893
Comments
Looking into the code for this I think there is a slightly deeper problem. The I think design wise we need to create a new property which is a list of the different capacities in the cluster, ideally at the same time that we add support for multiple capacity providers. |
Is it currently possible at all to create an auto-scaling cluster using the CDK or CloudFormation? The following code, in TypeScript CDK 1.23.0, fails to attach the ASG to the cluster. When trying to attach it manually through the UI, I get an error because the ASG doesn't have "instance protection from scale in" enabled. That's required because the default (and desired) behavior is to enable "managed termination protection" on the capacity provider. Neither of these parameters appear to be customizable through CDK or Cfn.
|
Nevermind, I see how this is working under the hood, and it's not using capacity providers at all. My problem is that my instance wasn't using the ECS-optimized AMI, and therefore couldn't add itself to the cluster. |
@bf-sodle Correct, we are still working on adding full support for ECS capacity providers in CloudFormation. Once that support is in CloudFormation we can add it to CDK as well. You can watch this issue for updates on the CFN work: aws/containers-roadmap#631 |
The
|
My question is not really about the issue, but is kinda' related. |
As far as I understand it, |
Yeah! |
With ASG Capacity Provider support now merged, these methods are now deprecated. Closing. |
|
When calling the ECS Cluster.addCapacity() method it does not actually set the "autoscalingGroup" property as expected:
Reproduction Steps
Expectation
According to the docs the expected output from the above code sample would be the construct for the autoscaling group that was created by addCapacity(): https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ecs.Cluster.html#autoscalinggroup
However instead you just see "undefined". This is because the getter for
autoscalingGroup
property uses an internal property which is only set in one place in the constructor: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-ecs/lib/cluster.ts#L116If you do not specify capacity options at constructor time and instead choose to subsequently use the
addCapacity()
method then this property is never set within theaddAutoscalingGroup()
method, therefore the reference to the autoscaling group is not retrievable via the getter method as expectedWorkarounds
You can specify capacity options as part of the constructor to get around this issue, instead of using
addCapacity()
. However, we should fix this so thataddCapacity()
sets the property correctly, as expected.Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: