IaC Bazaar
AWSLive-tested

CloudWatch Logs, Alarm & Dashboard

A self-contained CloudWatch observability bundle - an encrypted log group with retention, a metric alarm, and a dashboard - that stands up from just a name and points at any real metric.

terraformAWS#aws

Part of: AWS Production Landing Zone, AWS Container Platform (EKS)

aws-cloudwatchterraform v1.7

Verification

Live-tested

Really deployed to a cloud sandbox, verified against its outputs and assertions, then destroyed - with the teardown confirmed.

Conformance

  • Static validation (fmt · validate · tflint)
  • Security scan clean (Checkov)
  • Plan test superseded by live test

Provenance

Functional

  • Live-tested - applied, verified, destroyed

Last verified 2026-06-30 · how we verify

Verify this download

cosign · sha-256

Don't take our word for it. Every release is signed with cosign - check the bytes against our pinned public key before you trust them.

# 1. Our pinned public key - fetch once, trust out-of-band
curl -O https://www.iac-bazaar.com/cosign.pub

# 2. This module's Sigstore bundle
curl -o aws-cloudwatch-1.0.0.sigstore.json \
  https://www.iac-bazaar.com/api/artifacts/aws-cloudwatch/signature

# 3. Verify the tarball you downloaded
cosign verify-blob \
  --key cosign.pub \
  --bundle aws-cloudwatch-1.0.0.sigstore.json \
  aws-cloudwatch-1.0.0.tar.gz
# → Verified OK

# 4. (optional) confirm the checksum too
echo "5d7ef7d7543ee2cc95d63550d5095a921a84106b681b2de058c6a513b053fb87  aws-cloudwatch-1.0.0.tar.gz" | sha256sum -c

Use it from the registry

terraform · opentofu
module "cloudwatch" {
  source  = "www.iac-bazaar.com/iac-bazaar/aws-cloudwatch/aws"
  version = "1.0.0"
}

Paid module — needs a purchase (or a subscription that covers it) plus a registry token from /account/tokens. Full setup: registry docs.

Inputs & outputs

Create a free account to read this module's contract

The declared contract — every input name, type, default and description, plus every output — is shown to signed-in accounts, not to anonymous visitors.

A free account sees the contract of every Free module. This one is Professional, so its contract unlocks when you buy it.

Documentation

aws-cloudwatch

A self-contained CloudWatch observability bundle: a log group (retention + optional CMK encryption), a metric alarm, and a dashboard. Works with Terraform and OpenTofu (>= 1.6), AWS provider >= 6.0, < 7.0.

Out of the box the alarm and the dashboard target the log group itself (AWS/Logs / IncomingLogEvents), so the module stands up with nothing but a name and costs nothing to run. Point alarm_namespace / alarm_metric_name / alarm_dimensions at any real metric (EC2 CPUUtilization, ALB 5XX, a custom namespace, ...) when you wire it to a workload.

Secure / cost-aware defaults:

  • Log group is encrypted at rest (AWS-owned key by default; set kms_key_id for a customer-managed key — the key policy must allow logs.<region>.amazonaws.com)
  • Retention defaults to 7 days (never use 0 / never-expire unless you accept unbounded log storage cost)
  • Alarm treat_missing_data = "notBreaching" avoids false alarms when no data is flowing
  • Dashboards are free for the first three per account

Security notes

  • For regulated workloads set kms_key_id to a customer-managed KMS key so logs are encrypted with a key you control and audit; ensure its key policy grants logs.<region>.amazonaws.com the usual kms:Encrypt*/Decrypt/GenerateDataKey* permissions scoped by kms:EncryptionContext:aws:logs:arn.
  • Keep retention_in_days finite — 0 (never expire) accumulates cost and expands the data-retention surface indefinitely.
  • Send alarm_actions to an SNS topic with confirmed subscribers so alarms are actually actionable.

Requirements

  • Terraform or OpenTofu >= 1.6
  • hashicorp/aws >= 6.0, < 7.0

License

Commercial — IaC Bazaar EULA. © IaC Bazaar. Original work (not derived from a third-party module).

Usage code & full reference unlock after purchase

The complete copy-paste usage, the full input/output reference, and operational notes ship with your licence - shown here and bundled in the download.

  • Usage
  • Inputs
  • Outputs