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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인