From 5b9421f49d389cd00d97b1e85e4fa6c830f3b802 Mon Sep 17 00:00:00 2001 From: Cole-Greer Date: Thu, 11 Jul 2024 12:24:01 -0700 Subject: [PATCH] Configure export to use AWS Batch jobid as export id when available --- .../amazonaws/services/neptune/cluster/CloneCluster.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/amazonaws/services/neptune/cluster/CloneCluster.java b/src/main/java/com/amazonaws/services/neptune/cluster/CloneCluster.java index 6f7c060..4300f3b 100644 --- a/src/main/java/com/amazonaws/services/neptune/cluster/CloneCluster.java +++ b/src/main/java/com/amazonaws/services/neptune/cluster/CloneCluster.java @@ -13,6 +13,7 @@ package com.amazonaws.services.neptune.cluster; import com.amazonaws.services.neptune.AmazonNeptune; +import org.apache.commons.lang.StringUtils; import java.util.UUID; import java.util.function.Supplier; @@ -51,7 +52,11 @@ public Cluster cloneCluster(ConnectionConfig connectionConfig, ConcurrencyConfig } String clusterId = originalClusterMetadata.clusterId(); - String targetClusterId = String.format("neptune-export-cluster-%s", UUID.randomUUID().toString().substring(0, 5)); + String targetClusterIdSuffix = System.getenv("AWS_BATCH_JOB_ID"); // Use AWS Batch job id if running in Neptune Export Service + if (StringUtils.isEmpty(targetClusterIdSuffix)) { + targetClusterIdSuffix = UUID.randomUUID().toString().substring(0, 5); + } + String targetClusterId = String.format("neptune-export-cluster-%s", targetClusterIdSuffix); AddCloneTask addCloneTask = new AddCloneTask( clusterId,