From 3b0fffef1a6d61b99de7419d01244a10599d0fa0 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Sun, 18 Jun 2023 09:35:46 +0000 Subject: [PATCH] Add support for RDS snapshot events --- app.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 1f2e5bb..c568d8f 100644 --- a/app.py +++ b/app.py @@ -260,18 +260,19 @@ def handler(event, context): title = "ElastiCache fail over complete" body = "for node {}".format(msg["ElastiCache:FailoverComplete"]) - # RDS events - elif "Event Source" in msg and msg['Event Source'] == "db-instance": + # known RDS events + elif "Event Source" in msg and msg['Event Source'] in ["db-instance", "db-cluster-snapshot", "db-snapshot"]: try: title = msg["Event Message"] try: name = " ({}).".format( - msg["Tags"]["aws:cloudformation:stack-name"]) + msg["Tags"]["Name"]) except (KeyError, IndexError): name = "" - body = "RDS Instance: <{}|{}>{}\n<{}|Event docs>".format( - msg["Identifier Link"], msg["Source ID"], name, msg["Event ID"]) + body = "RDS {}: <{}|{}>{}\n<{}|Event docs>".format(msg["Event Source"].replace("db-", ""), + msg["Identifier Link"], msg["Source ID"], name, msg["Event ID"]) + except KeyError: msg_type = apprise.NotifyType.WARNING body = sns["Message"]