Editing the details of an EventBridge rule

256 Views Asked by At

I'm trying to do my first EventBridge rule, one which will catch updates from a certain Batch queue, and trigger a Lambda function to process them. I followed advice to go through a creation process, and incorporated a Sample pattern. Now I look to edit the event, and I can see an event pattern:

{
  "source": ["aws.batch"],
  "detail-type": ["Batch Job State Change"]
}

In the creation process I saw the sample pattern with much more extensive JSON code (shown below). It then generated and showed me the event pattern shown above. Much shorter, and very different. The Edit button doesn't give me a place to edit that. And I need to go in and tell it which batch queue I am watching. What is the relationship between these two pieces of JSON code, where does the long one live, and what do I need to be doing?

{
  "version": "0",
  "id": "c8f9c4b5-76e5-d76a-f980-7011e206042b",
  "detail-type": "Batch Job State Change",
  "source": "aws.batch",
  "account": "aws_account_id",
  "time": "2017-10-23T17:56:03Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:batch:us-east-1:aws_account_id:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8"
  ],
  "detail": {
    "jobName": "event-test",
    "jobId": "4c7599ae-0a82-49aa-ba5a-4727fcce14a8",
    "jobQueue": "arn:aws:batch:us-east-1:aws_account_id:job-queue/HighPriority",
    "status": "RUNNABLE",
    "attempts": [],
    "createdAt": 1508781340401,
    "retryStrategy": {
      "attempts": 1
    },
    "dependsOn": [],
    "jobDefinition": "arn:aws:batch:us-east-1:aws_account_id:job-definition/first-run-job-definition:1",
    "parameters": {},
    "container": {
      "image": "busybox",
      "vcpus": 2,
      "memory": 2000,
      "command": [
        "echo",
        "'hello world'"
      ],
      "volumes": [],
      "environment": [],
      "mountPoints": [],
      "ulimits": []
    }
  }
}
1

There are 1 best solutions below

0
On

To edit the rule pattern in the EventBridge console to select a specific job queue:

  1. From the Build event pattern form, in the Creation method section, choose Custom pattern (JSON editor)
  2. In the Event pattern section, enter the following:
{
  "source": ["aws.batch"],
  "detail-type": ["Batch Job State Change"],
  "detail": {
    "jobQueue": [{
      "suffix": "job-queue/HighPriority"
    }]
  }
}