The CloudWatch Exporter is a Java-based Prometheus exporter that collects metrics from AWS CloudWatch and exposes them in Prometheus format. It runs as a standalone web server with an embedded Jetty server, periodically polling AWS CloudWatch APIs based on YAML configuration. The architecture features clear separation of concerns with distinct components for configuration management, AWS API interaction, dimension caching, and metric collection. Key entry points include the WebServer main method which takes port and config file arguments, and the CloudWatchCollector which handles the core metrics collection logic. The exporter supports both GetMetricStatistics and GetMetricData APIs, includes special handling for services like DynamoDB, and provides configuration reload via SIGHUP or HTTP endpoint. External dependencies include AWS SDK, Prometheus Java client, Jetty, Caffeine for caching, and Snakeyaml for YAML parsing.
This Terraform module provisions an AWS SNS topic and a Lambda function (Python 3.13) that forwards SNS notifications to a Slack channel via webhook. The Lambda function parses and formats various AWS event types—CloudWatch alarms, GuardDuty findings, Security Hub findings, AWS Health events, AWS Backup notifications, and generic messages—into structured Slack attachments. It supports encrypted webhook URLs via KMS, custom Lambda functions, VPC configuration, and SNS subscription filtering. The module is part of the terraform-aws-modules ecosystem and follows standard Terraform module conventions with comprehensive CI/CD, pre-commit hooks, and semantic release. The Python code includes unit tests with snapshot testing, linting, and type checking, demonstrating solid engineering practices.