AWS Event Structure

AWS services like Lambda, EventBridge, and SNS use JSON-formatted events. Here’s a general structure and example:

Basic Event Structure

{
  "version": "0",
  "id": "unique-event-id",
  "detail-type": "Event Type Name",
  "source": "aws.service",
  "account": "123456789012",
  "time": "2023-11-15T12:00:00Z",
  "region": "us-east-1",
  "resources": ["arn:aws:service:region:account:resource"],
  "detail": {
    // Event-specific information
  }
}

Example: S3 Object Created Event

{
  "version": "0",
  "id": "89d1a02d-5ec7-412e-9b10-db1a88731dc3",
  "detail-type": "Object Created",
  "source": "aws.s3",
  "account": "123456789012",
  "time": "2023-11-15T12:34:56Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:s3:::my-bucket"
  ],
  "detail": {
    "bucket": {
      "name": "my-bucket"
    },
    "object": {
      "key": "uploads/document.pdf",
      "size": 1024,
      "etag": "a1b2c3d4e5f6g7h8i9j0",
      "sequencer": "00617F08299329D651"
    },
    "request-id": "C3D13FE58DE4C810",
    "requester": "123456789012"
  }
}

Explanation:

  • version: Event format version
  • id: Unique identifier for the event
  • detail-type: Describes what happened
  • source: AWS service that generated the event
  • account: AWS account ID
  • time: When the event occurred
  • region: AWS region
  • resources: ARNs of affected resources
  • detail: Service-specific information about the event