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 réponse
1
Réponse acceptée

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

répondu il y a 9 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions