Skip to main content

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This topic explains how to stream AWS CloudWatch metrics from your AWS account to LaunchDarkly’s observability features. This integration allows you to monitor your AWS infrastructure alongside your feature flag data for unified observability. The integration uses AWS CloudWatch Metric Streams to send metrics in real-time using the OpenTelemetry format. Data is delivered using Amazon Kinesis Data Firehose to LaunchDarkly’s OpenTelemetry Protocol (OTLP) endpoint.

Prerequisites

To use the AWS CloudWatch Metrics integration, you require:
  • A LaunchDarkly client-side ID for your target environment
  • AWS account with permissions to create:
    • CloudWatch Metric Streams
    • Kinesis Data Firehose delivery streams
    • S3 buckets
    • IAM roles and policies
  • AWS CLI installed and configured (optional, for command-line deployment)To find and copy your LaunchDarkly client-side ID, follow the instructions under View or copy keys and credentials.

Deploy the Cloud

Formation templateYou can deploy the AWS CloudWatch Metrics integration using the AWS CloudFormation console or the AWS CLI.

Deploy using the AWS Console

To deploy using the AWS Console:
  1. Copy the CloudFormation template below and save it as a file named metric-stream.yaml.
  2. Open the AWS CloudFormation console.
  3. Click Create stack and select With new resources (standard).
  4. Select Upload a template file, click Choose file, and select the metric-stream.yaml file you saved.
  5. Click Next.
  6. Enter a Stack name, such as launchdarkly-metrics-stream.
  7. Enter your the client-side ID from your LaunchDarkly environment into LaunchDarklyClientSideID.
  8. Click Next through the remaining steps.
  9. On the final page, acknowledge that CloudFormation will create IAM resources by checking the checkbox.
  10. Click Submit.The stack takes 3-5 minutes to create. After creation completes, metrics begin flowing to LaunchDarkly.

Deploy using the AWS CLITo deploy using the AWS CLI:

  1. Download the CloudFormation template:
    AWSTemplateFormatVersion: '2010-09-09'
    Description: 'CloudFormation template for LaunchDarkly observability metrics integration'

    Parameters:
        LaunchDarklyClientSideID:
            Type: String
            Description: Your LaunchDarkly environment client-side ID

        DestinationEndpoint:
            Type: String
            Description: OpenTelemetry endpoint URL for metrics
            Default: https://otlpv1.firehose.observability.app.launchdarkly.com

    Resources:
        MetricStreamRole:
            Type: AWS::IAM::Role
            Properties:
                AssumeRolePolicyDocument:
                    Version: '2012-10-17'
                    Statement:
                        - Effect: Allow
                          Principal:
                              Service: streams.metrics.cloudwatch.amazonaws.com
                          Action: sts:AssumeRole
                Policies:
                    - PolicyName: MetricStreamPolicy
                      PolicyDocument:
                          Version: '2012-10-17'
                          Statement:
                              - Effect: Allow
                                Action:
                                    - firehose:PutRecord
                                    - firehose:PutRecordBatch
                                Resource: !GetAtt DeliveryStream.Arn

        BackupBucket:
            Type: AWS::S3::Bucket
            DeletionPolicy: Delete
            UpdateReplacePolicy: Delete
            Properties:
                LifecycleConfiguration:
                    Rules:
                        - Id: DeleteOldBackups
                          Status: Enabled
                          ExpirationInDays: 14

        FirehoseRole:
            Type: AWS::IAM::Role
            Properties:
                AssumeRolePolicyDocument:
                    Version: '2012-10-17'
                    Statement:
                        - Effect: Allow
                          Principal:
                              Service: firehose.amazonaws.com
                          Action: sts:AssumeRole
                Policies:
                    - PolicyName: FirehosePolicy
                      PolicyDocument:
                          Version: '2012-10-17'
                          Statement:
                              - Effect: Allow
                                Action:
                                    - logs:CreateLogStream
                                    - logs:PutLogEvents
                                    - logs:CreateLogGroup
                                Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/kinesisfirehose/${AWS::StackName}:*
                              - Effect: Allow
                                Action:
                                    - s3:PutObject
                                    - s3:GetObject
                                Resource:
                                    - !Sub ${BackupBucket.Arn}/*

        DeliveryStream:
            Type: AWS::KinesisFirehose::DeliveryStream
            Properties:
                DeliveryStreamType: DirectPut
                HttpEndpointDestinationConfiguration:
                    EndpointConfiguration:
                        Url: !Ref DestinationEndpoint
                    RequestConfiguration:
                        ContentEncoding: GZIP
                        CommonAttributes:
                            - AttributeName: x-launchdarkly-project
                              AttributeValue: !Ref LaunchDarklyClientSideID
                    BufferingHints:
                        IntervalInSeconds: 60
                        SizeInMBs: 1
                    RoleARN: !GetAtt FirehoseRole.Arn
                    S3BackupMode: FailedDataOnly
                    S3Configuration:
                        BucketARN: !GetAtt BackupBucket.Arn
                        BufferingHints:
                            IntervalInSeconds: 300
                            SizeInMBs: 5
                        CompressionFormat: GZIP
                        RoleARN: !GetAtt FirehoseRole.Arn
                        Prefix: failed-metrics/

        MetricStream:
            Type: AWS::CloudWatch::MetricStream
            Properties:
                FirehoseArn: !GetAtt DeliveryStream.Arn
                OutputFormat: opentelemetry1.0
                RoleArn: !GetAtt MetricStreamRole.Arn

    Outputs:
        MetricStreamArn:
            Description: ARN of the created metric stream
            Value: !GetAtt MetricStream.Arn

        FirehoseArn:
            Description: ARN of the created Kinesis Firehose
            Value: !GetAtt DeliveryStream.Arn

        BackupBucketName:
            Description: Name of the S3 bucket for failed delivery backups
            Value: !Ref BackupBucket
  1. Create the CloudFormation stack:
    aws cloudformation create-stack \
      --stack-name launchdarkly-metrics-stream \
      --template-body file://metric-stream.yaml \
      --parameters \
        ParameterKey=LaunchDarklyClientSideID,ParameterValue=YOUR_CLIENT_SIDE_ID \
      --capabilities CAPABILITY_IAM
Replace YOUR_CLIENT_SIDE_ID with your LaunchDarkly environment’s client-side ID.
  1. Monitor the stack creation:
    aws cloudformation describe-stacks --stack-name launchdarkly-metrics-stream

What the template creates

The CloudFormation template creates the following AWS resources:
  • CloudWatch Metric Stream: Captures all CloudWatch metrics from all AWS services in real-time
  • Kinesis Data Firehose Delivery Stream: Buffers and delivers metrics to the LaunchDarkly OTLP endpoint
  • S3 Backup Bucket: Stores failed metric deliveries for troubleshooting (14-day retention)
  • IAM Roles: Least-privilege roles for the metric stream and Firehose delivery streamAll metrics from all AWS namespaces such as EC2, Lambda, RDS, DynamoDB, and ECS are streamed automatically, providing comprehensive visibility into your AWS infrastructure.

View metrics in Launch

Darkly ObservabilityAfter deployment, metrics appear in the LaunchDarkly observability dashboard within 1-2 minutes. To view your metrics:
  1. Navigate to Observability in LaunchDarkly.
  2. Select the environment you configured.
  3. Navigate to the Metrics tab.
  4. Use the metric explorer to query and visualize your AWS CloudWatch metrics.
Metrics are tagged with their AWS namespace, region, and resource identifiers for easy filtering.

Filter metrics by namespace (optional)

By default, the integration sends all AWS CloudWatch metrics from all services, providing complete observability coverage. If you need to reduce cost and data volume for specific use cases, you can optionally filter to specific AWS service namespaces. To filter metrics to specific namespaces:
  1. Download and open the CloudFormation template in a text editor.
  2. Locate the MetricStream resource.
  3. Add an IncludeFilters section, similar to:
    MetricStream:
      Type: AWS::CloudWatch::MetricStream
      Properties:
        FirehoseArn: !GetAtt DeliveryStream.Arn
        IncludeFilters:
          - Namespace: AWS/EC2
          - Namespace: AWS/Lambda
          - Namespace: AWS/RDS
        OutputFormat: opentelemetry1.0
        RoleArn: !GetAtt MetricStreamRole.Arn
  1. Save the template and deploy or update the stack. For a complete list of AWS service namespaces, read AWS services that publish CloudWatch metrics in the AWS documentation.