Missing Share Identifier: EventBridge Rule unable to trigger AWS Batch job

0

Use Case

Configured an AWS EventBridge Rule to schedule an AWS Batch Job with the provided inputs (Please refer to the the image below):

  1. Job Definition ARN
  2. Job Name
  3. Job Queue ARN

Enter image description here

Issue

The invocation of the job fails with the exception that shareidentifier is required as shown in the CloudTrail logs below:

{
    "eventTime": "2023-08-18T23:50:14Z",
    "eventSource": "batch.amazonaws.com",
    "eventName": "SubmitJob",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "events.amazonaws.com",
    "userAgent": "events.amazonaws.com",
    "errorCode": "BadRequestException",
    "requestParameters": {
        "jobName": "job-name",
        "jobQueue": "job-queue-arn",
        "jobDefinition": "job-definition-arn"
    },
    "responseElements": {
        "message": "shareIdentifier is required.",
        "__type": "ClientException"
    }
}

As evident from the EventBridge console, there is no way to provide a Share Identifier during rule creation.

Question

How to pass a share identifier while submitting an AWS Batch job from EventBridge?

1 個回答
1
已接受的答案

You can pass the share identifier by creating a step function and pass the aws batch job as a task where the task specifies the following parameters as follows

  • JobName: The name of the AWS Batch job
  • JobDefinition: The ARN of the AWS Batch job definition
  • JobQueue: The ARN of the AWS Batch Job Queue
  • ShareIdentifier: The Share Identifier

Then create the EventBridge that triggers the Step Function. For Example, Check out this EventBridge rule that triggers a stepFunction that submits an AWS Batch job with the shared identifier passed as a parameter

{ "Name": "MyEventBridgeRule", "EventPattern": { "source": "batch.amazonaws.com" }, "Targets": [ { "Arn": "arn:aws:states:::states:startExecution", "Id": "MyStepFunction", "Input": { "Parameters" : { "JobName": "job-name", "JobDefinition": "job-definition-arn", "JobQueue": "job-queue-arn", "ShareIdentifier":"my-share-identifier" } } } ] }

Once you have created the EventBridge rule and stepFunction, you can test them by creating an batch event that matches the event pattern in the EventBridge rule

已回答 9 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南