thesuavehog / aws-sns-to-google-chat-space

Transform CloudWatch Alarm messages into Google Chat Cards v2 messages and send them to a Google Chat Space
MIT License
0 stars 0 forks source link

add support for Database Migration Service (DMS) notification messages #18

Open thesuavehog opened 1 week ago

thesuavehog commented 1 week ago

Add support for detecting and formatting notification messages from the Database Migration Service (DMS).

Example format:

{
  "Type" : "Notification",
  "MessageId" : "972ce4b4-b836-5097-98ab-ba5f1cdb3aa2",
  "TopicArn" : "arn:aws:sns:us-west-1:123456789012:TOPIC_NAME",
  "Subject" : "DMS Notification Message",
  "Message" : "{\"Event Source\":\"replication-task\",\"Event Time\":\"2024-06-18 15:07:22.563\",\"Identifier Link\":\"[https://console.aws.amazon.com/dms/v2/home?region=us-west-1#taskDetails/TASK_NAME \](https://console.aws.amazon.com/dms/v2/home?region=us-west-1#taskDetails/TASK_NAME%20\)",\"SourceId\":\"TASK_NAME\",\"Event ID\":\"[http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html#DMS-EVENT-0078 \](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html#DMS-EVENT-0078%20\)",\"Event Message\":\"Replication task has failed.\\nReason: Last Error  Network error has occurred Stop Reason RECOVERABLE_ERROR Error Level RECOVERABLE.\"}",
  "Timestamp" : "2024-06-18T15:07:25.544Z",
  "SignatureVersion" : "1",
  "Signature" : "...",
  "SigningCertURL" : "...",
  "UnsubscribeURL" : "..."
}
thesuavehog commented 1 week ago

The issue with this message type is that the Message body JSON uses keys with spaces in them. The EventBridge Pipes Input Transformer uses references like <$.body.key> and doesn't seem to support key with spaces in it.

I'm not sure this task can be completed without an extra Enrichment Function to reformat the message JSON to lowercase and remove spaces.