Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconcodegen
file-type-iconexamples
file-type-iconcloudtrail
file-type-iconcloudwatch-logs-metric-filters
file-type-iconterraform
file-type-iconterragrunt
file-type-iconREADME.md
file-type-iconterragrunt.hcl
file-type-iconcross-account-iam-roles
file-type-iconcustom-iam-entity
file-type-iconiam-groups
file-type-iconiam-password-policy
file-type-iconsaml-iam-roles
file-type-iconsecurityhub
file-type-iconmodules
file-type-iconrfcs
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconCONTRIBUTING.md
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
file-type-iconsetup.cfg

Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconcodegen
file-type-iconexamples
file-type-iconcloudtrail
file-type-iconcloudwatch-logs-metric-filters
file-type-iconterraform
file-type-iconterragrunt
file-type-iconREADME.md
file-type-iconterragrunt.hcl
file-type-iconcross-account-iam-roles
file-type-iconcustom-iam-entity
file-type-iconiam-groups
file-type-iconiam-password-policy
file-type-iconsaml-iam-roles
file-type-iconsecurityhub
file-type-iconmodules
file-type-iconrfcs
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconCONTRIBUTING.md
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
file-type-iconsetup.cfg
CIS Foundations Benchmark

CIS Foundations Benchmark

Modules and utilities certified by Gruntwork and CIS to comply with the CIS AWS Foundations Benchmark

Code Preview

Preview the Code

mobile file icon

README.md

down

cloudwatch-logs-metric-filters Terragrunt Example

This directory uses the cloudwatch-logs-metric-filters wrapper module with Terragrunt to create a series of metric filters according to the recommendations in section 3 of the CIS AWS Foundations Benchmark. If you aren't using terragrunt, see the terraform example.

If you're using this example as part of a larger terragrunt repository, copy it to the appropriate location within the repo. For example, the hierarchy below demonstrates a structure of four accounts: dev, master, prod, and security.

.
├── dev
│   └── us-east-1
│       └── dev
├── master
├── prod
│   └── us-east-1
│       ├── _global
│       │   └── cloudwatch-logs-metric-filters
│       │       └── terragrunt.hcl
│       ├── prod
│       └── region.yaml
└── security
    └── us-east-1
        └── dev

The example is nested under the prod account, us-east-1 region, _global configuration because CloudWatch Logs is not constrained to a VPC.

Quick start

  1. Copy this module to a location in your terragrunt repository, as described above.
  2. Configure the variables as described below
  3. Run terragrunt apply
  4. Add subscriptions to the SNS topic to receive alarms. If you use Slack, try the sns_to_slack Lambda function to connect the CloudTrail alerts to a Slack channel.

Configuration

Use the following variables to configure the module:

  • aws_region: Set this to the region where the metrics and alarms should be created. It should be in the same region as your CloudWatch Logs group. This value may be inherited from a parent file, as demonstrated by the hierarchy above.
  • cloudwatch_logs_group_name: Set this to the name of a CloudWatch Logs group used by CloudTrail
  • sns_topic_already_exists: If you already have an SNS topic you'd like to use, set this to true and set the sns_topic_arn variable
  • sns_topic_name: If sns_topic_already_exists is false, set this variable to a sensible value. The module will configure all the Benchmark alarms to use this topic.
  • sns_topic_arn: If sns_topic_already_exists is true, set this variable to the ARN of the topic.

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?