Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add sharedIdentifier to aws event bridge rule for scheduled execution of aws batch job

I configured aws bridge event rule (via web gui) for running aws batch job - rule is triggered but a I am getting following error after invocation:

shareIdentifier must be specified. (Service: AWSBatch; Status Code: 400; Error Code: ClientException; Request ID: 07da124b-bf1d-4103-892c-2af2af4e5496; Proxy: null)

My job is using scheduling policy and needs shareIdentifier to be set but I don`t know how to set it. Here is screenshot from configuration of rule:

enter image description here

There are no additional settings for subsequent arguments/parameters of job, the only thing I can configure is retries. I also checked aws-cli command for putting rule (https://awscli.amazonaws.com/v2/documentation/api/latest/reference/events/put-rule.html) but it doesn`t seem to have any additional settings. Any suggestions how to solve it? Or working examples?

Edited:

I ended up using java sdk for aws batch: https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-batch. I have a scheduled method that periodically spawns jobs with following peace of code:

AWSBatch client = AWSBatchClientBuilder.standard().withRegion("eu-central-1").build();

SubmitJobRequest request = new SubmitJobRequest()
    .withJobName("example-test-job-java-sdk")
    .withJobQueue("job-queue")
    .withShareIdentifier("default")
    .withJobDefinition("job-type");

SubmitJobResult response = client.submitJob(request);

log.info("job spawn response: {}", response);
like image 953
Patrik Avatar asked Feb 03 '26 11:02

Patrik


1 Answers

Have you tried to provide additional settings to your target via the input transformer as referenced in the AWS docs AWS Batch Jobs as EventBridge Targets ?

FWIW I'm running into the same problem.

like image 71
Yass Avatar answered Feb 06 '26 05:02

Yass