https://aws.amazon.com/tw/about-aws/whats-new/2019/12/amazon-ecs-capacity-providers-now-available/
dependency https://github.com/aws/containers-roadmap/issues/631
This is a :rocket: Feature Request
What is the likelihood of this being added to cfn?
Capacity Providers were just added to Cfn: https://github.com/aws/aws-cdk/commit/4ce27f4195c70bd9e365ec0e0df5c0ede863bc8a#diff-4a4e15a081904ee16b4d84e2f5cf5aee
FYI: @SoManyHs
const ondemandCapacity = cluster.addCapacity("OnDemandCapacity",{
instanceType: new InstanceType(instanceType),
minCapacity: 1,
maxCapacity: 2,
vpcSubnets: {
subnets: vpc.privateSubnets
}
})
const ondemandCapacityProvider = new CfnCapacityProvider(this, "OnDemandCapacityProvider", {
name: "ondemandCapacityProvider",
autoScalingGroupProvider: {
autoScalingGroupArn: ondemandCapacity.autoScalingGroupArn,
managedScaling: {
maximumScalingStepSize: 10,
minimumScalingStepSize: 1,
status: "ENABLED",
targetCapacity: 85
}
}
})
This keeps on giving error
Invalid request provided: CreateCapacityProvider error: The specified Auto Scaling group ARN is invalid. Specify a valid ARN and try again.
See here about some issues with the current implementation:
https://github.com/aws/containers-roadmap/issues/631
These are items that still planned to be implemented:
Ability to reference the ASG name in the AWS::ECS::CapacityProvider resource
Ability to specify a custom capacity provider strategy in the AWS::ECS::Service resource
Ability to enable scale-in protection in the AWS::AutoScaling::AutoScalingGroup resource
const ondemandCapacity = cluster.addCapacity("OnDemandCapacity",{ instanceType: new InstanceType(instanceType), minCapacity: 1, maxCapacity: 2, vpcSubnets: { subnets: vpc.privateSubnets } }) const ondemandCapacityProvider = new CfnCapacityProvider(this, "OnDemandCapacityProvider", { name: "ondemandCapacityProvider", autoScalingGroupProvider: { autoScalingGroupArn: ondemandCapacity.autoScalingGroupArn, managedScaling: { maximumScalingStepSize: 10, minimumScalingStepSize: 1, status: "ENABLED", targetCapacity: 85 } } })
This keeps on giving error
Invalid request provided: CreateCapacityProvider error: The specified Auto Scaling group ARN is invalid. Specify a valid ARN and try again.
got the same issue in v1.53 :(
@gandroz did you try putting asg name in the autoScalingGroupArn
field? they added this option recently.
@gandroz did you try putting asg name in the
autoScalingGroupArn
field? they added this option recently.
hmmm good catch @mb-dev, using asg.autoScalingGroupName
as the autoScalinGroupArn
option does not raise an error, however I can see the capacity provider in the CloudFormation template but not in the ECS console....
How to link the capacity provider to the cluster ?
Hi folks,
I am working on the PR today and seems working fine in my integ test.
See: https://twitter.com/pahudnet/status/1285440342045515777
Will create a PR draft shortly.
We'll hold this issue because there are some feature gaps for CFN Capacity Provider to be narrowed. For example, the cyclic dependency that is already discussed here. Even if we try to break the cyclic dependency by using the hard code cluster name, we'll still have problems when deleting resources. Hence, we decided to hold this issue and wait for CFN update on Capacity Provider before we support it in CDK.
@iamhopaul123 I believe this may have been unblocked recently?
I'm not sure if it only applies to Fargate and whether it can work with EC2 as well.
Hi @andreialecu thank you so much for bringing this great news to us! We'll take a look at it to see if it could fit in fixing this issue.
Hello @andreialecu, looks like number 4 and 5 of https://github.com/aws/containers-roadmap/issues/631#issuecomment-702580141 are still waiting to be fixed. Unfortunately though CFN support could simplify the CDK support for quite a lot, without fixing the circular dependency problem there is not much we could do. We'll keep waiting until there are more updates on this.
Most helpful comment
This keeps on giving error
Invalid request provided: CreateCapacityProvider error: The specified Auto Scaling group ARN is invalid. Specify a valid ARN and try again.