Add support for RDS snapshot events
ZeroDownTime/sns-alert-hub/pipeline/head This commit looks good Details
ZeroDownTime/sns-alert-hub/pipeline/tag This commit looks good Details

This commit is contained in:
Stefan Reimer 2023-06-18 09:35:46 +00:00
parent 3831ee7774
commit 3b0fffef1a
1 changed files with 6 additions and 5 deletions

11
app.py
View File

@ -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"]