amazon-web-servicesamazon-rdssnapshotamazon-cloudtrailamazon-cloudwatch-events

AWS Automated DBSnapshot (System) in CloudTrail event


I'm looking at triggering a lambda when a new automated DB Snapshot is available in RDS (System ones instead of Manual ones). Although after digging in CloudTrail, I don't see any events marked as follow (AWS Sample):

{
  "version": "0",
  "id": "844e2571-85d4-695f-b930-0153b71dcb42",
  "detail-type": "RDS DB Snapshot 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": ["creation"],
    "SourceType": "SNAPSHOT",
    "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": "Automated snapshot created"
  }
}

Thanks again if you know which AWS Events I should lookup for :)

Oli


Solution

  • Cloudtrail won't give you such information. I would go with the flow highlighted bellow

    RDS (event notification) -> SNS -> Lambda

    You need to have an SNS topic as source of your lambda, because RDS fans out its events to this service

    Check what RDS document states

    Amazon RDS uses the Amazon Simple Notification Service (Amazon SNS) to provide notification when an Amazon RDS event occurs

    Regarding the notification itself, I could see that the DB snapshot event event bellow might be the one that you're looking for

    Category RDS event ID Description
    creation RDS-EVENT-0091 An automated DB snapshot is being created.