Documentation

CloudWatch metrics streaming

View your CloudWatch metrics in Lumigo using AWS CloudWatch metrics stream

Stream your CloudWatch Metrics to Lumigo to create dashboards, set alerts, and unify all your observability data—traces, logs, and metrics—into one powerful, centralized view.

Getting started with CloudWatch Metric Stream in Lumigo is quick and straightforward.

  1. Save the following CloudFormation template to a file on your system. This template configures the necessary IAM roles, S3 bucket, and Kinesis Firehose stream for Lumigo to receive your metrics.
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "CloudFormation template for CloudWatch Metrics Stream to Firehose with HTTP Endpoint and S3 Backup.",
  "Parameters": {
    "LumigoToken": {
      "Type": "String",
      "Description": "The Lumigo token of the project to which the metrics are streamed.",
      "NoEcho": true
    }
  },
  "Resources": {
    "LumigoCwMetricsStreamFhRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "RoleName": {
          "Fn::Sub": "LumigoCwmsRole-${AWS::AccountId}-${AWS::Region}"
        },
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "firehose.amazonaws.com",
                  "streams.metrics.cloudwatch.amazonaws.com"
                ]
              },
              "Action": "sts:AssumeRole"
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": {
              "Fn::Sub": "LumigoCwmsPolicy-${AWS::AccountId}-${AWS::Region}"
            },
            "PolicyDocument": {
              "Version": "2012-10-17",
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": [
                    "cloudwatch:PutMetricStream",
                    "firehose:PutRecord",
                    "firehose:PutRecordBatch",
                    "s3:PutObject"
                  ],
                  "Resource": "*"
                }
              ]
            }
          }
        ]
      }
    },
    "LumigoCwMetricsStreamFhBackupBucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": {
          "Fn::Sub": "lmg-cwms-fh-bk-${AWS::AccountId}-${AWS::Region}"
        },
        "AccessControl": "Private"
      }
    },
    "LumigoCwMetricsFhDeliveryStream": {
      "Type": "AWS::KinesisFirehose::DeliveryStream",
      "DependsOn": "LumigoCwMetricsStreamFhRole",
      "Properties": {
        "DeliveryStreamName": {
          "Fn::Sub": "LumigoCwmsFhStream-${AWS::AccountId}-${AWS::Region}"
        },
        "DeliveryStreamType": "DirectPut",
        "HttpEndpointDestinationConfiguration": {
          "EndpointConfiguration": {
            "AccessKey": { "Ref": "LumigoToken" },
            "Name": "LumigoCwOtlpMetricsEdge",
            "Url": "https://ga-otlp.lumigo-tracer-edge.golumigo.com/v1/cw-metrics"
          },
          "BufferingHints": {
            "SizeInMBs": 1,
            "IntervalInSeconds": 0
          },
          "RoleARN": { "Fn::GetAtt": ["LumigoCwMetricsStreamFhRole", "Arn"] },
          "RequestConfiguration": {
            "ContentEncoding": "GZIP"
          },
          "RetryOptions": {
            "DurationInSeconds": 300
          },
          "S3BackupMode": "FailedDataOnly",
          "S3Configuration": {
            "RoleARN": { "Fn::GetAtt": ["LumigoCwMetricsStreamFhRole", "Arn"] },
            "BucketARN": { "Fn::GetAtt": ["LumigoCwMetricsStreamFhBackupBucket", "Arn"] },
            "Prefix": "failed-data/",
            "ErrorOutputPrefix": "error/",
            "BufferingHints": {
              "SizeInMBs": 5,
              "IntervalInSeconds": 300
            },
            "CompressionFormat": "GZIP"
          }
        }
      }
    },
    "LumigoCloudWatchMetricsStream": {
      "Type": "AWS::CloudWatch::MetricStream",
      "Properties": {
        "Name": {
          "Fn::Sub": "LumigoCwMetricsStream-${AWS::AccountId}-${AWS::Region}"
        },
        "OutputFormat": "opentelemetry1.0",
        "RoleArn": { "Fn::GetAtt": ["LumigoCwMetricsStreamFhRole", "Arn"] },
        "FirehoseArn": { "Fn::GetAtt": ["LumigoCwMetricsFhDeliveryStream", "Arn"] }
      }
    }
  },
  "Outputs": {
    "LumigoCloudWatchMetricsStreamArn": {
      "Description": "The ARN of the CloudWatch Metrics Stream",
      "Value": { "Fn::GetAtt": ["LumigoCloudWatchMetricsStream", "Arn"] }
    }
  }
}
  1. Run the following command to deploy the stack:
aws cloudformation deploy --template-file <file path>
	--stack-name LumigoCwMetricsStreamStack
  --region us-west-2 
  --parameter-overrides LumigoToken=<Lumigo token> 
  --capabilities CAPABILITY_NAMED_IAM
  • Replace file path with the path to your saved template.
  • Set LumigoToken with your project token.
  • Adjust the stack-name and region if needed.

Can I select specific metrics to stream?
Yes. To stream only specific namespaces or metrics, update theIncludeFilters in the template. For example:

		  "IncludeFilters": [
		    {
		      "Namespace": "AWS/Lambda",
		      "MetricNames": [
		        "Invocations"
		      ]
		    }
		  ]

The full list of namespaces and metrics can be found by running the following command:

aws cloudwatch list-metrics

Something is unclear?

We’re happy to help! Contact us by clicking the intercom button in the lower-right-hand corner of your screen, or email us at [email protected].