{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Monitoring log group",

  "Parameters": {
    "LogGroupName": {
      "Type": "String",
      "Description": "The log group name"
    },
    "RetentionInDays": {
      "Type": "Number",
      "Description": "Number of days logs should be kept before being deleted."
    }
  },

  "Resources": {
    "LogGroup": {
      "Type": "AWS::Logs::LogGroup",
      "Properties": {
        "LogGroupName": {"Ref": "LogGroupName"},
        "RetentionInDays": {"Ref": "RetentionInDays"}
      }
    }
  },

  "Outputs": {
    "LogGroupName": {
      "Description": "Log group",
      "Value": {"Ref": "LogGroup"}
    }
  }
}

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Monitoring log group",

  "Parameters": {
    "LogGroupName": {
      "Type": "String",
      "Description": "The log group name"
    },
    "RetentionInDays": {
      "Type": "Number",
      "Description": "Number of days logs should be kept before being deleted."
    }
  },

  "Resources": {
    "LogGroup": {
      "Type": "AWS::Logs::LogGroup",
      "Properties": {
        "LogGroupName": {"Ref": "LogGroupName"},
        "RetentionInDays": {"Ref": "RetentionInDays"}
      }
    },

    "RDSSNSTopic": {
      "Type": "AWS::SNS::Topic",
      "Properties": {
        "DisplayName": "RDSEvents",
        "Subscription": [
          {
            "Protocol": "email",
            "Endpoint": "support@digitalmarketplace.service.gov.uk"
          }
        ]
      }
    },

    "RDSEventSubscription": {
      "Type": "AWS::RDS::EventSubscription",
      "Properties": {
        "Enabled": true,
        "EventCategories": ["deletion"],
        "SnsTopicArn": {"Ref": "RDSSNSTopic"},
        "SourceType": "db-instance"
      }
    }
  },

  "Outputs": {
    "LogGroupName": {
      "Description": "Log group",
      "Value": {"Ref": "LogGroup"}
    }
  }
}

Add RDS event subscription to monitoring stack
Add RDS event subscription to monitoring stack

This listens for all deletion events and emails them to the support
email.
