AWS CloudWatch Metrics

This topic explains how to stream AWS CloudWatch metrics from your AWS account to LaunchDarkly observability features. This integration lets you 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 the LaunchDarkly OpenTelemetry Protocol (OTLP) endpoint.

Prerequisites

To use the AWS CloudWatch Metrics integration, you require:

  • A LaunchDarkly client-side ID for your target environment
  • An AWS account with permissions to create:
    • CloudWatch Metric Streams
    • Kinesis Data Firehose delivery streams
    • S3 buckets
    • Identity and Access Management (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 SDK credentials.

Deploy the CloudFormation template

You 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 client-side ID from your LaunchDarkly environment into LaunchDarklyClientSideID.
  8. Click Next through the remaining steps.
  9. Check the checkbox to acknowledge that CloudFormation will create IAM resources.
  10. Click Submit.

The stack takes 3-5 minutes to create. After creation completes, metrics begin flowing to LaunchDarkly.

Deploy using the AWS CLI

To deploy using the AWS CLI:

  1. Download the CloudFormation template:
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:
Shell
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:
Shell
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 stream.

All metrics from all AWS namespaces such as EC2, Lambda, Relational Database Service (RDS), DynamoDB, and Elastic Container Service (ECS) are streamed automatically, providing comprehensive visibility into your AWS infrastructure.

View metrics in LaunchDarkly Observability

After deployment, metrics appear in the LaunchDarkly Observability list within 1-2 minutes.

To review your metrics:

  1. Navigate to Observability in LaunchDarkly.
  2. Select the environment you configured.
  3. Click 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 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:
CloudFormation YAML
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.