-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Describe the feature
Managed EC compute environments allow specifying a tags attribute in ComputeResource (see https://docs.aws.amazon.com/batch/latest/APIReference/API_ComputeResource.html) to apply specific tags to EC2 instances launched by Batch/ECS. These are used e.g. for cost allocation.
The CloudFormation resource does support providing tags in ComputeResource: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-batch-computeenvironment-computeresources.html
The functionality seems to be available in aws_cdk.aws_batch.CfnComputeEnvironment via CfnComputeEnvironment.ComputeResourcesProperty's tags kwarg/property, but not exposed to the L2 construct.
I could hack my way around this using an escape hatch, but as there seems to be no reason not to expose the ComputeResource tags to the L2 construct, could this be provided directly by CDK?
Use Case
I need to use an escape hatch to provide necessary tags to managed EC2 environment compute resources in order to e.g. allocate costs correctly and get the Name tag set properly to be able to identify Batch EC2 instances in the EC2 console
Proposed Solution
Add a property/keyword argument (excuse my Python vocabulary) to the L2 construct ManagedEc2EcsComputeEnvironment. Based on my limited understanding of the construct code, in https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-batch/lib/managed-compute-environment.ts add a property computeResourceTags to ManagedEc2EcsComputeEnvironmentProps and use it instead of/in addition to this.tags.renderedTags in
| tags: this.tags.renderedTags as any, |
| tags: this.tags.renderedTags as any, |
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS CDK Library version (aws-cdk-lib)
2.225.0 (Python package version)
AWS CDK CLI version
2.1033.0 (build 1ec3310)
Environment details (OS name and version, etc.)
macOS Sequoia 15.7.1