Get AWS Batch cluster name CDK

644 views Asked by At

I'm trying to create an alarm by using memory utilization in AWS Batch. However, the metric related to this service is under the ECS Cluster that is automatically created when creating a compute environment. I'm trying to provide this cluster name to the alarm dimension, but I'm unable to access the cluster name using CDK. I've researched in the CDK API and it doesn't seem to be possible. Does anybody now how this can be done?

1

There are 1 answers

2
kylevoyto On

I don't know whether you can find the ECS Cluster created by Batch using CDK. Batch hides the details about the work that it does on the backend (i.e. creating an ECS Cluster).

My only guess is that you can write custom code to list the ECS Clusters in your account and match one of the clusters with the name you expect to see. I think Batch initializes the cluster when you initialize the Batch Compute Environment, but I'm not sure whether there is a lag in the timing.