Search code examples
amazon-web-servicesamazon-rdsamazon-cloudwatchaws-event-bridge

Where to find AWS Serverless database creation events in AWS EventBridge?


The closest I've gotten to an example was from ChatGPT so far:

{
  "version": "0",
  "id": "12345678-1234-1234-1234-123456789012",
  "detail-type": "RDS Cluster Instance Creation Event",
  "source": "aws.rds",
  "account": "<ARN-ID>",
  "time": "2022-03-03T10:00:00Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:rds:us-east-1:<ARN-ID>:cluster:dashboard-db-cluster-vegamx",
    "arn:aws:rds:us-east-1:<ARN-ID>:db:dashboard-db-cluster-vegamx-instance"
  ],
  "detail": {
    "Event": "created",
    "DBInstanceIdentifier": "dashboard-db-cluster-vegamx-instance",
    "DBClusterIdentifier": "dashboard-db-cluster-vegamx",
    "Engine": "aurora-postgresql",
    "EngineVersion": "14.6",
    "InstanceClass": "db.serverless",
    "AvailabilityZone": "us-east-1a",
    "Status": "creating",
    "MultiAZ": false
  }
}

This is my Rule's Event Pattern that I'm trying to trigger:

{
  "source": ["aws.rds"],
  "detail-type": ["RDS Cluster Instance Creation Event"],
  "detail": {
    "Event": ["created"],
    "DBInstanceIdentifier": [
      {
        "prefix": "dashboard-db-cluster"
        }
      ]
  }
}

I am able to test the event pattern in Event Bridge, However I am not able to see the actual event trigger the targeted lambda or anything under CloudWatch Logs.

AWS EventBridge Rule Pattern Tester


Solution

  • The reason why you are not seeing anything in the logs or lambda being triggered is because the event didn't match.

    I understand that during your testing of the event it matches, however the actual events are very different to what you have been testing.

    For Example:

    RDS DB Cluster Event

    {
      "version": "0",
      "id": "844e2571-85d4-695f-b930-0153b71dcb42",
      "detail-type": "RDS DB Cluster Event",
      "source": "aws.rds",
      "account": "123456789012",
      "time": "2018-10-06T12:26:13Z",
      "region": "us-east-1",
      "resources": ["arn:aws:rds:us-east-1:123456789012:db:mysql-instance-2018-10-06-12-24"],
      "detail": {
        "EventCategories": ["notification"],
        "SourceType": "CLUSTER",
        "SourceArn": "arn:aws:rds:us-east-1:123456789012:db:mysql-instance-2018-10-06-12-24",
        "Date": "2018-10-06T12:26:13.882Z",
        "SourceIdentifier": "rds:mysql-instance-2018-10-06-12-24",
        "Message": "Database cluster has been patched"
      }
    }
    

    Event Pattern

    {
      "source": ["aws.rds"],
      "detail-type": ["RDS DB Cluster Event"]
    }
    

    This is the actual event that gets logged under CloudTrail, so if you need anything specific or more, I recommend turning on CloudTrail and check out the event that gets generated and then use that event to create the EventBridge rule