Skip to content

aws_batch_alpha: FargateComputeEnvironment compute_environment_name not being respected #25794

@roketworks

Description

@roketworks

Describe the bug

When creating a FargateComputeEnvironment using the construct and passing in compute_environment_name the resulting cloudformatation does not have the ComputeEnvironmentName property set.

Expected Behavior

ComputeEnvironmentName property set on the resulting AWS::Batch::ComputeEnvironment resource in the outputted CloudFormation.

Current Behavior

ComputeEnvironmentName property is not set on the resulting AWS::Batch::ComputeEnvironment resource in the outputted CloudFormation.

This only seems to affect the FargateComputeEnvironment construct and not others.

Reproduction Steps

# Resulting CloudFormation will not have ComputeEnvironmentName set
self.fargate_compute_env = batch.FargateComputeEnvironment(
    self, 'FargateComputeEnv',
    compute_environment_name='fargate',
    enabled=True,
    vpc=vpc,
)

# Resulting CloudFormation will have ComputeEnvironmentName set
self.gpu_compute_env = batch.ManagedEc2EcsComputeEnvironment(
    self, 'GPUComputeEnv',
    compute_environment_name='gpu',
    enabled=True,
    maxv_cpus=196,
    vpc=vpc,
    instance_types=[
        ec2.InstanceType.of(ec2.InstanceClass.G5, ec2.InstanceSize.XLARGE2),
        ec2.InstanceType.of(ec2.InstanceClass.G4DN, ec2.InstanceSize.XLARGE4)
    ],
)

Possible Solution

No response

Additional Information/Context

  FargateComputeEnv155F00A9:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      Type: managed
      ComputeResources:
        MaxvCpus: 256
        SecurityGroupIds:
          - Fn::GetAtt:
              - FargateComputeEnvSecurityGroup914E8A54
              - GroupId
        Subnets:
          - Ref: VpcIsolatedSubnet1SubnetE48C5737
          - Ref: VpcIsolatedSubnet2Subnet16364B91
        Type: FARGATE
        UpdateToLatestImageVersion: true
      ReplaceComputeEnvironment: false
      State: ENABLED
      UpdatePolicy: {}
    Metadata:
      aws:cdk:path: IdentificationTrainingInfra/FargateComputeEnv/Resource
.......
  TrainingComputeEnvEDCE302F:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      Type: managed
      ComputeEnvironmentName:training-gpu
      ComputeResources:
        AllocationStrategy: BEST_FIT_PROGRESSIVE
        InstanceRole:
          Fn::GetAtt:
            - TrainingComputeEnvInstanceProfile93AE79CA
            - Arn
        InstanceTypes:
          - g5.2xlarge
          - g4dn.4xlarge
          - optimal
        MaxvCpus: 196
        MinvCpus: 0
        SecurityGroupIds:
          - Fn::GetAtt:
              - TrainingComputeEnvSecurityGroup0C7AEB8B
              - GroupId
        Subnets:
          - Ref: VpcIsolatedSubnet1SubnetE48C5737
          - Ref: VpcIsolatedSubnet2Subnet16364B91
        Type: EC2
        UpdateToLatestImageVersion: true
      ReplaceComputeEnvironment: false
      State: ENABLED
      UpdatePolicy: {}
    Metadata:
      aws:cdk:path: IdentificationTrainingInfra/TrainingComputeEnv/Resource

CDK CLI Version

2.81.0

Framework Version

No response

Node.js Version

19.8.1

OS

Mac OS 12

Language

Python

Language Version

3.11

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-batchRelated to AWS BatchbugThis issue is a bug.effort/smallSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions