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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则