-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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_stepfunctions_tasks: cannot add capacity provider when using EcsEc2LaunchTarget #30171
Comments
This error generally indicates that your ECS cluster does not have any container instance registered into the cluster.
The container instances are essentially the ec2 instances from your AsgCapacityProvider which uses your provided ASG as its AutoscalingGroup. And I can't see how you create your ASG from your snippet: capacity_provider = ecs.AsgCapacityProvider(
self,
"CapacityProvider",
auto_scaling_group=autoscaling_group,
spot_instance_draining=True,
) It is very important if you use AsgCapacityProvider, it's your responsibility to specify your own ASG with ecs-compatible machine image as described in the doc here and make sure at least one container instance is registered into the cluster. In most cases, you should just use Can you check your ecs cluster and see if at least one cluster instance has been registered? You may list the container instances using AWS CLI as below:
|
The cluster has an autoscaling group capacity provider. I skipped some of my code in what I shared because it's a very complicated autoscaling group.
The weird thing is that when I make a cluster in the console and give it a default capacity provider strategy like I'm doing in cdk, I don't need to specify the capacity provider strategy in the run task parameters. But for some reason I do, and that is why I'm asking you to let us add it. |
Are you able to see any instance running in your cluster like this? Because as I mentioned above, the error message means there's no valid instance in your cluster. I am guessing your ASG may not correctly launch any ECS instances that register to the cluster.
|
Yes, it does. |
But apart from my problem, it would be really helpful for people to specify capacity provider strategies, which is why boto3 offers that option. |
Describe the bug
The example code provided in https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_stepfunctions_tasks/EcsEc2LaunchTarget.html is not functional. Although adding a default asg capacity provider works in the console, doing it in cdk returns an error if the capacity provider is not specified in the EcsRunTask parameters. I currently cannot find any way to add the capacity provider to the parameters.
Expected Behavior
My state machine to successfully execute an aws_stepfunctions_tasks.EcsRunTask with the EcsEc2LaunchTarget when I have defined a default capacity provider strategy for my cluster.
Current Behavior
The task receives an error from the cluster and cannot be started.
Reproduction Steps
Possible Solution
It would be helpful if it could be passed to the launch target in the same manner as placement constraints and placement strategies.
Additional Information/Context
No response
CDK CLI Version
cdk@2.110.1
Framework Version
No response
Node.js Version
18
OS
ubuntu-latest
Language
Python
Language Version
3.11
Other information
No response
The text was updated successfully, but these errors were encountered: