Skip to content

A terraform module to provision the infrastructure to connect a cloudwatch metrics stream to prometheus remote write endpoints

License

Notifications You must be signed in to change notification settings

signal-ai/terraform-aws-cloudwatch-prometheus

Repository files navigation

terraform-aws-cloudwatch-prometheus

CircleCI

Are you fed up with the costs, faf and effort of maintaining cloudwatch exporters to get metrics into your prometheus setup? Maybe you are using one of the following:

These are expensive and costly in terms of number of API calls no matter how you look at it.

Thankfully AWS released Cloudwatch Metric Steams to connect to metrics partners like Datadog or New Relic.

This is a terraform module that does the same thing but connects to one of your prometheus remote write endpoints directly.

Features

  • Blazingly fast, efficient metrics that you want directly in prometheus.
  • Standardized prometheus __naming__ in snake_case
  • Currently supporting lambda and sqs (More coming soon)

System Architecture

System Architecture

Providers

Name Version
aws >= 3.75.1

Resources

Name Type
aws_cloudwatch_log_group.logs resource
aws_cloudwatch_metric_stream.main resource
aws_iam_role.cloudwatch_metrics_firehose_role resource
aws_iam_role.iam_for_lambda resource
aws_iam_role.metric_stream_to_firehose resource
aws_iam_role_policy.cloudwatch_metrics_firehose_lambda_policy resource
aws_iam_role_policy.cloudwatch_metrics_s3_policy resource
aws_iam_role_policy.metric_stream_to_firehose resource
aws_iam_role_policy_attachment.execution resource
aws_iam_role_policy_attachment.vpc resource
aws_kinesis_firehose_delivery_stream.cloudwatch_metrics_firehose_delivery_stream resource
aws_lambda_function.cloudwatch_metrics_firehose_prometheus_remote_write resource
aws_s3_bucket.cloudwatch_metrics_firehose_bucket resource
aws_s3_bucket_acl.cloudwatch_metrics_firehose_bucket_acl resource
aws_s3_bucket_ownership_controls.bucket_ownership_cloudwatch_firehose resource
aws_security_group.cloudwatch_metrics_firehose_prometheus_remote_write resource
aws_security_group_rule.cloudwatch_metrics_firehose_prometheus_remote_write resource

Inputs

Name Description Type Default Required
aws_cloudwatch_metric_stream_name The desired cloudwatch metric stream name that will be created string n/a yes
aws_firehose_lambda_name The lambda name that will attached to put events in the s3 bucket output of the firehose stream string n/a yes
aws_firehose_s3_bucket_name The s3 bucket name that will be the output of the firehose stream string n/a yes
aws_firehose_stream_name The desired firehose stream name that will be created and linked to the output of the cloudwatch metric stream string n/a yes
included_aws_namespaces The list of AWS Namespaces to include in the stream list(string) n/a yes
prometheus_endpoints A list of prometheus remote write endpoints to write metrics list(string) n/a yes
subnet_ids The subnet ids the create the lambda in (these should have network access to the prometheus remote write endpoints) list(string) n/a yes
tags The standard tags to apply to every AWS resource. map(string) {} no
vpc_id The VPC to create the lambda in (this should have network access to the prometheusremote write endpoints) string n/a yes

Thank you

AWS Recipe - This draws heavily on this (using a modified version of the go code in their lambda)

About

A terraform module to provision the infrastructure to connect a cloudwatch metrics stream to prometheus remote write endpoints

Resources

License

Stars

Watchers

Forks

Packages

No packages published