aboutsummaryrefslogtreecommitdiff
path: root/sections/route53.py
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2025-06-20 13:55:54 -0500
committerChristian Cleberg <hello@cleberg.net>2025-06-20 13:55:54 -0500
commit785f42901f34aaf356f316c691e3f56138c8608d (patch)
tree5b8f7a6e33a6af410e511137fdd51b6fa60d0f83 /sections/route53.py
downloadaws-summary-report-785f42901f34aaf356f316c691e3f56138c8608d.tar.gz
aws-summary-report-785f42901f34aaf356f316c691e3f56138c8608d.tar.bz2
aws-summary-report-785f42901f34aaf356f316c691e3f56138c8608d.zip
initial commit
Diffstat (limited to 'sections/route53.py')
-rw-r--r--sections/route53.py40
1 files changed, 40 insertions, 0 deletions
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)