From 785f42901f34aaf356f316c691e3f56138c8608d Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 20 Jun 2025 13:55:54 -0500 Subject: initial commit --- sections/route53.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sections/route53.py (limited to 'sections/route53.py') diff --git a/sections/route53.py b/sections/route53.py new file mode 100644 index 0000000..d2da7cf --- /dev/null +++ b/sections/route53.py @@ -0,0 +1,40 @@ +# route53.py +import boto3 +from tabulate import tabulate + + +def get_section(config): + profile = config["aws"].get("profile") + region = config["aws"]["region"] # Not used by Route53, but kept for consistency + + session = boto3.Session(profile_name=profile if profile else None) + client = session.client("route53") + + health_checks = client.list_health_checks()["HealthChecks"] + rows = [] + + for hc in health_checks: + hc_id = hc["Id"] + name = hc.get("HealthCheckConfig", {}).get( + "FullyQualifiedDomainName", "Unnamed" + ) + status = client.get_health_check_status(HealthCheckId=hc_id) + status_summary = status["HealthCheckObservations"] + healthy = all( + obs["StatusReport"]["Status"].startswith("Success") + for obs in status_summary + ) + state = "HEALTHY" if healthy else "UNHEALTHY" + rows.append([name, state]) + + if not rows: + return "Route 53 Health Checks:\nNo health checks configured." + + table = tabulate(rows, headers=["Domain", "Status"], tablefmt="simple_grid") + lines = [ + "Route 53 Health Checks:", + f"[https://{config['aws'].get('region')}.console.aws.amazon.com/route53/v2/healthchecks/home]", + table, + ] + + return "\n".join(lines) -- cgit v1.2.3-70-g09d2