• Home
  • Health
  • Software
  • Blog
  • event-bridge

    Example Event Payloads

    I found it difficult to find example payloads, so I'm saving them here.


    Batch Job State Change:

    {
        "version": "0",
        "id": "c8f9c4b5-76e5-d76a-f980-7011e206042b",
        "detail-type": "Batch Job State Change",
        "source": "aws.batch",
        "account": "123456789012",
        "time": "2022-01-11T23:36:40Z",
        "region": "us-east-1",
        "resources": [
            "arn:aws:batch:us-east-1:123456789012:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8"
        ],
        "detail": {
            "jobArn": "arn:aws:batch:us-east-1:123456789012:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8",
            "jobName": "event-test",
            "jobId": "4c7599ae-0a82-49aa-ba5a-4727fcce14a8",
            "jobQueue": "arn:aws:batch:us-east-1:123456789012:job-queue/PexjEHappyPathCanary2JobQueue",
            "status": "RUNNABLE",
            "attempts": [],
            "createdAt": 1641944200058,
            "retryStrategy": {
                "attempts": 2,
                "evaluateOnExit": []
            },
            "dependsOn": [],
            "jobDefinition": "arn:aws:batch:us-east-1:123456789012:job-definition/first-run-job-definition:1",
            "parameters": {},
            "container": {
                "image": "137112412989.dkr.ecr.us-east-1.amazonaws.com/amazonlinux:latest",
                "command": [
                    "sleep",
                    "600"
                ],
                "volumes": [],
                "environment": [],
                "mountPoints": [],
                "ulimits": [],
                "networkInterfaces": [],
                "resourceRequirements": [
                    {
                        "value": "2",
                        "type": "VCPU"
                    }, {
                        "value": "256",
                        "type": "MEMORY"
                    }
                ],
                "secrets": []
            },
            "tags": {
                "resourceArn": "arn:aws:batch:us-east-1:123456789012:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8"
            },
            "propagateTags": false,
            "platformCapabilities": []
        }
    }
    


    EC2 Shutdown event:

    {
      "version": "0",
      "id": "6a7e8feb-b491-4cf7-a9f1-bf3703467718",
      "detail-type": "EC2 Instance State-change Notification",
      "source": "aws.ec2",
      "account": "111122223333",
      "time": "2017-12-22T18:43:48Z",
      "region": "us-west-1",
      "resources": [
        "arn:aws:ec2:us-west-1:123456789012:instance/i-1234567890abcdef0"
      ],
      "detail": {
        "instance-id": " i-1234567890abcdef0",
        "state": "terminated"
      }
    }
    

    This event pattern filters for the above:

    {
      "source": ["aws.ec2"],
      "detail-type": ["EC2 Instance State-change Notification"],
      "detail": {
        "state": ["terminated"]
      }
    }
    


    EC2 AutoScaling event:

    {
      "version": "0",
      "id": "3e3c153a-8339-4e30-8c35-687ebef853fe",
      "detail-type": "EC2 Instance Launch Successful",
      "source": "aws.autoscaling",
      "account": "123456789012",
      "time": "2015-11-11T21:31:47Z",
      "region": "us-east-1",
      "resources": [],
      "detail": {
        "eventVersion": "",
        "responseElements": null
      }
    }
    

    Amazon gives this example to filter the above:

    {
      "source": ["aws.autoscaling"],
      "detail-type": ["EC2 Instance Launch Successful"],
      "detail": {
       "responseElements": [null]
      }
    }
    


    Filtering Prefixes

    {
      "time": [ { "prefix": "2017-10-02" } ]
    }
    

    Notice the object syntax above, prefix is a special filter type, along with suffix, anything-but, numeric, cidr, exists, and equals-ignore-case. These can be combined with $or as well:

    https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-content-based-filtering.html