-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws-cdk/aws-batch: Skip use of optimal instance type with graviton instances #31148
Description
Describe the bug
I'm attempting to create an EC2 ECS compute environment using the AWS Batch constructs that makes use of only Graviton instances. When I deploy the stack I get the following error:
Error executing request, Exception : arm-based instance type cannot be used with other instance types.Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
When encountering a know arm-based instance class, the construct should not append optimal as it's not supported for arm based instances
Current Behavior
When deploying a EC2 ECS Compute Environment, the error below is thrown.
14:57:17 | CREATE_FAILED | AWS::Batch::ComputeEnvironment | MyECSComputeEnvironment6A03089C
Resource handler returned message: "Error executing request, Exception : arm-based instance type cannot be used with other instance types., RequestId: 167a0e5
f-0376-4ad4-a0b6-34a85a940cb7 (Service: Batch, Status Code: 400, Request ID: 167a0e5f-0376-4ad4-a0b6-34a85a940cb7)" (RequestToken: d266edf5-f5cd-d61f-866f-5e5
ecefa478c, HandlerErrorCode: InvalidRequest)Reproduction Steps
I'm declaring my compute environment as follows:
const computeEnvironment = new ManagedEc2EcsComputeEnvironment(this, 'MyECSComputeEnvironment', {
vpc,
minvCpus: 0,
maxvCpus: 8,
instanceClasses: [InstanceClass.M6G],
})When deploying there is an error:
14:57:17 | CREATE_FAILED | AWS::Batch::ComputeEnvironment | MyECSComputeEnvironment6A03089C
Resource handler returned message: "Error executing request, Exception : arm-based instance type cannot be used with other instance types., RequestId: 167a0e5
f-0376-4ad4-a0b6-34a85a940cb7 (Service: Batch, Status Code: 400, Request ID: 167a0e5f-0376-4ad4-a0b6-34a85a940cb7)" (RequestToken: d266edf5-f5cd-d61f-866f-5e5
ecefa478c, HandlerErrorCode: InvalidRequest)Possible Solution
When I inspect the synthesized CloudFormation Stack I can see that optimal has been appended to the InstanceTypes list:
Possible solution would be to fix logic in renderInstances to take into account the types of instances (Arm vs AMD).
Additional Information/Context
Workaround
I've found workaround by setting the useOptimalInstanceClasses to false but this is not expected behavior because I've explicitly set the types of instances I want.
const computeEnvironment = new ManagedEc2EcsComputeEnvironment(this, 'MyECSComputeEnvironment', {
vpc,
minvCpus: 0,
maxvCpus: 8,
instanceClasses: [InstanceClass.M6G],
useOptimalInstanceClasses: false
})CDK CLI Version
2.152.0 (build faa7d79)
Framework Version
No response
Node.js Version
v20.14.0
OS
ubuntu
Language
TypeScript
Language Version
No response
Other information
No response
