1. Packages
  2. AWS
  3. API Docs
  4. cloudwatch
  5. MetricStream
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.cloudwatch.MetricStream

Explore with Pulumi AI

Provides a CloudWatch Metric Stream resource.

Example Usage

Filters

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
const streamsAssumeRole = aws.iam.getPolicyDocument({
    statements: [{
        effect: "Allow",
        principals: [{
            type: "Service",
            identifiers: ["streams.metrics.cloudwatch.amazonaws.com"],
        }],
        actions: ["sts:AssumeRole"],
    }],
});
const metricStreamToFirehoseRole = new aws.iam.Role("metric_stream_to_firehose", {
    name: "metric_stream_to_firehose_role",
    assumeRolePolicy: streamsAssumeRole.then(streamsAssumeRole => streamsAssumeRole.json),
});
const bucket = new aws.s3.BucketV2("bucket", {bucket: "metric-stream-test-bucket"});
const firehoseAssumeRole = aws.iam.getPolicyDocument({
    statements: [{
        effect: "Allow",
        principals: [{
            type: "Service",
            identifiers: ["firehose.amazonaws.com"],
        }],
        actions: ["sts:AssumeRole"],
    }],
});
const firehoseToS3Role = new aws.iam.Role("firehose_to_s3", {assumeRolePolicy: firehoseAssumeRole.then(firehoseAssumeRole => firehoseAssumeRole.json)});
const s3Stream = new aws.kinesis.FirehoseDeliveryStream("s3_stream", {
    name: "metric-stream-test-stream",
    destination: "extended_s3",
    extendedS3Configuration: {
        roleArn: firehoseToS3Role.arn,
        bucketArn: bucket.arn,
    },
});
const main = new aws.cloudwatch.MetricStream("main", {
    name: "my-metric-stream",
    roleArn: metricStreamToFirehoseRole.arn,
    firehoseArn: s3Stream.arn,
    outputFormat: "json",
    includeFilters: [
        {
            namespace: "AWS/EC2",
            metricNames: [
                "CPUUtilization",
                "NetworkOut",
            ],
        },
        {
            namespace: "AWS/EBS",
            metricNames: [],
        },
    ],
});
// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
const metricStreamToFirehose = aws.iam.getPolicyDocumentOutput({
    statements: [{
        effect: "Allow",
        actions: [
            "firehose:PutRecord",
            "firehose:PutRecordBatch",
        ],
        resources: [s3Stream.arn],
    }],
});
const metricStreamToFirehoseRolePolicy = new aws.iam.RolePolicy("metric_stream_to_firehose", {
    name: "default",
    role: metricStreamToFirehoseRole.id,
    policy: metricStreamToFirehose.apply(metricStreamToFirehose => metricStreamToFirehose.json),
});
const bucketAcl = new aws.s3.BucketAclV2("bucket_acl", {
    bucket: bucket.id,
    acl: "private",
});
const firehoseToS3 = aws.iam.getPolicyDocumentOutput({
    statements: [{
        effect: "Allow",
        actions: [
            "s3:AbortMultipartUpload",
            "s3:GetBucketLocation",
            "s3:GetObject",
            "s3:ListBucket",
            "s3:ListBucketMultipartUploads",
            "s3:PutObject",
        ],
        resources: [
            bucket.arn,
            pulumi.interpolate`${bucket.arn}/*`,
        ],
    }],
});
const firehoseToS3RolePolicy = new aws.iam.RolePolicy("firehose_to_s3", {
    name: "default",
    role: firehoseToS3Role.id,
    policy: firehoseToS3.apply(firehoseToS3 => firehoseToS3.json),
});
Copy
import pulumi
import pulumi_aws as aws

# https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
streams_assume_role = aws.iam.get_policy_document(statements=[{
    "effect": "Allow",
    "principals": [{
        "type": "Service",
        "identifiers": ["streams.metrics.cloudwatch.amazonaws.com"],
    }],
    "actions": ["sts:AssumeRole"],
}])
metric_stream_to_firehose_role = aws.iam.Role("metric_stream_to_firehose",
    name="metric_stream_to_firehose_role",
    assume_role_policy=streams_assume_role.json)
bucket = aws.s3.BucketV2("bucket", bucket="metric-stream-test-bucket")
firehose_assume_role = aws.iam.get_policy_document(statements=[{
    "effect": "Allow",
    "principals": [{
        "type": "Service",
        "identifiers": ["firehose.amazonaws.com"],
    }],
    "actions": ["sts:AssumeRole"],
}])
firehose_to_s3_role = aws.iam.Role("firehose_to_s3", assume_role_policy=firehose_assume_role.json)
s3_stream = aws.kinesis.FirehoseDeliveryStream("s3_stream",
    name="metric-stream-test-stream",
    destination="extended_s3",
    extended_s3_configuration={
        "role_arn": firehose_to_s3_role.arn,
        "bucket_arn": bucket.arn,
    })
main = aws.cloudwatch.MetricStream("main",
    name="my-metric-stream",
    role_arn=metric_stream_to_firehose_role.arn,
    firehose_arn=s3_stream.arn,
    output_format="json",
    include_filters=[
        {
            "namespace": "AWS/EC2",
            "metric_names": [
                "CPUUtilization",
                "NetworkOut",
            ],
        },
        {
            "namespace": "AWS/EBS",
            "metric_names": [],
        },
    ])
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
metric_stream_to_firehose = aws.iam.get_policy_document_output(statements=[{
    "effect": "Allow",
    "actions": [
        "firehose:PutRecord",
        "firehose:PutRecordBatch",
    ],
    "resources": [s3_stream.arn],
}])
metric_stream_to_firehose_role_policy = aws.iam.RolePolicy("metric_stream_to_firehose",
    name="default",
    role=metric_stream_to_firehose_role.id,
    policy=metric_stream_to_firehose.json)
bucket_acl = aws.s3.BucketAclV2("bucket_acl",
    bucket=bucket.id,
    acl="private")
firehose_to_s3 = aws.iam.get_policy_document_output(statements=[{
    "effect": "Allow",
    "actions": [
        "s3:AbortMultipartUpload",
        "s3:GetBucketLocation",
        "s3:GetObject",
        "s3:ListBucket",
        "s3:ListBucketMultipartUploads",
        "s3:PutObject",
    ],
    "resources": [
        bucket.arn,
        bucket.arn.apply(lambda arn: f"{arn}/*"),
    ],
}])
firehose_to_s3_role_policy = aws.iam.RolePolicy("firehose_to_s3",
    name="default",
    role=firehose_to_s3_role.id,
    policy=firehose_to_s3.json)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
		streamsAssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Effect: pulumi.StringRef("Allow"),
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"streams.metrics.cloudwatch.amazonaws.com",
							},
						},
					},
					Actions: []string{
						"sts:AssumeRole",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		metricStreamToFirehoseRole, err := iam.NewRole(ctx, "metric_stream_to_firehose", &iam.RoleArgs{
			Name:             pulumi.String("metric_stream_to_firehose_role"),
			AssumeRolePolicy: pulumi.String(streamsAssumeRole.Json),
		})
		if err != nil {
			return err
		}
		bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{
			Bucket: pulumi.String("metric-stream-test-bucket"),
		})
		if err != nil {
			return err
		}
		firehoseAssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Effect: pulumi.StringRef("Allow"),
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"firehose.amazonaws.com",
							},
						},
					},
					Actions: []string{
						"sts:AssumeRole",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		firehoseToS3Role, err := iam.NewRole(ctx, "firehose_to_s3", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.String(firehoseAssumeRole.Json),
		})
		if err != nil {
			return err
		}
		s3Stream, err := kinesis.NewFirehoseDeliveryStream(ctx, "s3_stream", &kinesis.FirehoseDeliveryStreamArgs{
			Name:        pulumi.String("metric-stream-test-stream"),
			Destination: pulumi.String("extended_s3"),
			ExtendedS3Configuration: &kinesis.FirehoseDeliveryStreamExtendedS3ConfigurationArgs{
				RoleArn:   firehoseToS3Role.Arn,
				BucketArn: bucket.Arn,
			},
		})
		if err != nil {
			return err
		}
		_, err = cloudwatch.NewMetricStream(ctx, "main", &cloudwatch.MetricStreamArgs{
			Name:         pulumi.String("my-metric-stream"),
			RoleArn:      metricStreamToFirehoseRole.Arn,
			FirehoseArn:  s3Stream.Arn,
			OutputFormat: pulumi.String("json"),
			IncludeFilters: cloudwatch.MetricStreamIncludeFilterArray{
				&cloudwatch.MetricStreamIncludeFilterArgs{
					Namespace: pulumi.String("AWS/EC2"),
					MetricNames: pulumi.StringArray{
						pulumi.String("CPUUtilization"),
						pulumi.String("NetworkOut"),
					},
				},
				&cloudwatch.MetricStreamIncludeFilterArgs{
					Namespace:   pulumi.String("AWS/EBS"),
					MetricNames: pulumi.StringArray{},
				},
			},
		})
		if err != nil {
			return err
		}
		// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
		metricStreamToFirehose := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
			Statements: iam.GetPolicyDocumentStatementArray{
				&iam.GetPolicyDocumentStatementArgs{
					Effect: pulumi.String("Allow"),
					Actions: pulumi.StringArray{
						pulumi.String("firehose:PutRecord"),
						pulumi.String("firehose:PutRecordBatch"),
					},
					Resources: pulumi.StringArray{
						s3Stream.Arn,
					},
				},
			},
		}, nil)
		_, err = iam.NewRolePolicy(ctx, "metric_stream_to_firehose", &iam.RolePolicyArgs{
			Name: pulumi.String("default"),
			Role: metricStreamToFirehoseRole.ID(),
			Policy: pulumi.String(metricStreamToFirehose.ApplyT(func(metricStreamToFirehose iam.GetPolicyDocumentResult) (*string, error) {
				return &metricStreamToFirehose.Json, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketAclV2(ctx, "bucket_acl", &s3.BucketAclV2Args{
			Bucket: bucket.ID(),
			Acl:    pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		firehoseToS3 := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
			Statements: iam.GetPolicyDocumentStatementArray{
				&iam.GetPolicyDocumentStatementArgs{
					Effect: pulumi.String("Allow"),
					Actions: pulumi.StringArray{
						pulumi.String("s3:AbortMultipartUpload"),
						pulumi.String("s3:GetBucketLocation"),
						pulumi.String("s3:GetObject"),
						pulumi.String("s3:ListBucket"),
						pulumi.String("s3:ListBucketMultipartUploads"),
						pulumi.String("s3:PutObject"),
					},
					Resources: pulumi.StringArray{
						bucket.Arn,
						bucket.Arn.ApplyT(func(arn string) (string, error) {
							return fmt.Sprintf("%v/*", arn), nil
						}).(pulumi.StringOutput),
					},
				},
			},
		}, nil)
		_, err = iam.NewRolePolicy(ctx, "firehose_to_s3", &iam.RolePolicyArgs{
			Name: pulumi.String("default"),
			Role: firehoseToS3Role.ID(),
			Policy: pulumi.String(firehoseToS3.ApplyT(func(firehoseToS3 iam.GetPolicyDocumentResult) (*string, error) {
				return &firehoseToS3.Json, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    // https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
    var streamsAssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Effect = "Allow",
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "streams.metrics.cloudwatch.amazonaws.com",
                        },
                    },
                },
                Actions = new[]
                {
                    "sts:AssumeRole",
                },
            },
        },
    });

    var metricStreamToFirehoseRole = new Aws.Iam.Role("metric_stream_to_firehose", new()
    {
        Name = "metric_stream_to_firehose_role",
        AssumeRolePolicy = streamsAssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var bucket = new Aws.S3.BucketV2("bucket", new()
    {
        Bucket = "metric-stream-test-bucket",
    });

    var firehoseAssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Effect = "Allow",
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "firehose.amazonaws.com",
                        },
                    },
                },
                Actions = new[]
                {
                    "sts:AssumeRole",
                },
            },
        },
    });

    var firehoseToS3Role = new Aws.Iam.Role("firehose_to_s3", new()
    {
        AssumeRolePolicy = firehoseAssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var s3Stream = new Aws.Kinesis.FirehoseDeliveryStream("s3_stream", new()
    {
        Name = "metric-stream-test-stream",
        Destination = "extended_s3",
        ExtendedS3Configuration = new Aws.Kinesis.Inputs.FirehoseDeliveryStreamExtendedS3ConfigurationArgs
        {
            RoleArn = firehoseToS3Role.Arn,
            BucketArn = bucket.Arn,
        },
    });

    var main = new Aws.CloudWatch.MetricStream("main", new()
    {
        Name = "my-metric-stream",
        RoleArn = metricStreamToFirehoseRole.Arn,
        FirehoseArn = s3Stream.Arn,
        OutputFormat = "json",
        IncludeFilters = new[]
        {
            new Aws.CloudWatch.Inputs.MetricStreamIncludeFilterArgs
            {
                Namespace = "AWS/EC2",
                MetricNames = new[]
                {
                    "CPUUtilization",
                    "NetworkOut",
                },
            },
            new Aws.CloudWatch.Inputs.MetricStreamIncludeFilterArgs
            {
                Namespace = "AWS/EBS",
                MetricNames = new() { },
            },
        },
    });

    // https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
    var metricStreamToFirehose = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Effect = "Allow",
                Actions = new[]
                {
                    "firehose:PutRecord",
                    "firehose:PutRecordBatch",
                },
                Resources = new[]
                {
                    s3Stream.Arn,
                },
            },
        },
    });

    var metricStreamToFirehoseRolePolicy = new Aws.Iam.RolePolicy("metric_stream_to_firehose", new()
    {
        Name = "default",
        Role = metricStreamToFirehoseRole.Id,
        Policy = metricStreamToFirehose.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var bucketAcl = new Aws.S3.BucketAclV2("bucket_acl", new()
    {
        Bucket = bucket.Id,
        Acl = "private",
    });

    var firehoseToS3 = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Effect = "Allow",
                Actions = new[]
                {
                    "s3:AbortMultipartUpload",
                    "s3:GetBucketLocation",
                    "s3:GetObject",
                    "s3:ListBucket",
                    "s3:ListBucketMultipartUploads",
                    "s3:PutObject",
                },
                Resources = new[]
                {
                    bucket.Arn,
                    $"{bucket.Arn}/*",
                },
            },
        },
    });

    var firehoseToS3RolePolicy = new Aws.Iam.RolePolicy("firehose_to_s3", new()
    {
        Name = "default",
        Role = firehoseToS3Role.Id,
        Policy = firehoseToS3.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.kinesis.FirehoseDeliveryStream;
import com.pulumi.aws.kinesis.FirehoseDeliveryStreamArgs;
import com.pulumi.aws.kinesis.inputs.FirehoseDeliveryStreamExtendedS3ConfigurationArgs;
import com.pulumi.aws.cloudwatch.MetricStream;
import com.pulumi.aws.cloudwatch.MetricStreamArgs;
import com.pulumi.aws.cloudwatch.inputs.MetricStreamIncludeFilterArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.aws.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
        final var streamsAssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("Service")
                    .identifiers("streams.metrics.cloudwatch.amazonaws.com")
                    .build())
                .actions("sts:AssumeRole")
                .build())
            .build());

        var metricStreamToFirehoseRole = new Role("metricStreamToFirehoseRole", RoleArgs.builder()
            .name("metric_stream_to_firehose_role")
            .assumeRolePolicy(streamsAssumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
            .build());

        var bucket = new BucketV2("bucket", BucketV2Args.builder()
            .bucket("metric-stream-test-bucket")
            .build());

        final var firehoseAssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("Service")
                    .identifiers("firehose.amazonaws.com")
                    .build())
                .actions("sts:AssumeRole")
                .build())
            .build());

        var firehoseToS3Role = new Role("firehoseToS3Role", RoleArgs.builder()
            .assumeRolePolicy(firehoseAssumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
            .build());

        var s3Stream = new FirehoseDeliveryStream("s3Stream", FirehoseDeliveryStreamArgs.builder()
            .name("metric-stream-test-stream")
            .destination("extended_s3")
            .extendedS3Configuration(FirehoseDeliveryStreamExtendedS3ConfigurationArgs.builder()
                .roleArn(firehoseToS3Role.arn())
                .bucketArn(bucket.arn())
                .build())
            .build());

        var main = new MetricStream("main", MetricStreamArgs.builder()
            .name("my-metric-stream")
            .roleArn(metricStreamToFirehoseRole.arn())
            .firehoseArn(s3Stream.arn())
            .outputFormat("json")
            .includeFilters(            
                MetricStreamIncludeFilterArgs.builder()
                    .namespace("AWS/EC2")
                    .metricNames(                    
                        "CPUUtilization",
                        "NetworkOut")
                    .build(),
                MetricStreamIncludeFilterArgs.builder()
                    .namespace("AWS/EBS")
                    .metricNames()
                    .build())
            .build());

        // https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
        final var metricStreamToFirehose = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .actions(                
                    "firehose:PutRecord",
                    "firehose:PutRecordBatch")
                .resources(s3Stream.arn())
                .build())
            .build());

        var metricStreamToFirehoseRolePolicy = new RolePolicy("metricStreamToFirehoseRolePolicy", RolePolicyArgs.builder()
            .name("default")
            .role(metricStreamToFirehoseRole.id())
            .policy(metricStreamToFirehose.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(metricStreamToFirehose -> metricStreamToFirehose.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
            .build());

        var bucketAcl = new BucketAclV2("bucketAcl", BucketAclV2Args.builder()
            .bucket(bucket.id())
            .acl("private")
            .build());

        final var firehoseToS3 = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .actions(                
                    "s3:AbortMultipartUpload",
                    "s3:GetBucketLocation",
                    "s3:GetObject",
                    "s3:ListBucket",
                    "s3:ListBucketMultipartUploads",
                    "s3:PutObject")
                .resources(                
                    bucket.arn(),
                    bucket.arn().applyValue(arn -> String.format("%s/*", arn)))
                .build())
            .build());

        var firehoseToS3RolePolicy = new RolePolicy("firehoseToS3RolePolicy", RolePolicyArgs.builder()
            .name("default")
            .role(firehoseToS3Role.id())
            .policy(firehoseToS3.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(firehoseToS3 -> firehoseToS3.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
            .build());

    }
}
Copy
resources:
  main:
    type: aws:cloudwatch:MetricStream
    properties:
      name: my-metric-stream
      roleArn: ${metricStreamToFirehoseRole.arn}
      firehoseArn: ${s3Stream.arn}
      outputFormat: json
      includeFilters:
        - namespace: AWS/EC2
          metricNames:
            - CPUUtilization
            - NetworkOut
        - namespace: AWS/EBS
          metricNames: []
  metricStreamToFirehoseRole:
    type: aws:iam:Role
    name: metric_stream_to_firehose
    properties:
      name: metric_stream_to_firehose_role
      assumeRolePolicy: ${streamsAssumeRole.json}
  metricStreamToFirehoseRolePolicy:
    type: aws:iam:RolePolicy
    name: metric_stream_to_firehose
    properties:
      name: default
      role: ${metricStreamToFirehoseRole.id}
      policy: ${metricStreamToFirehose.json}
  bucket:
    type: aws:s3:BucketV2
    properties:
      bucket: metric-stream-test-bucket
  bucketAcl:
    type: aws:s3:BucketAclV2
    name: bucket_acl
    properties:
      bucket: ${bucket.id}
      acl: private
  firehoseToS3Role:
    type: aws:iam:Role
    name: firehose_to_s3
    properties:
      assumeRolePolicy: ${firehoseAssumeRole.json}
  firehoseToS3RolePolicy:
    type: aws:iam:RolePolicy
    name: firehose_to_s3
    properties:
      name: default
      role: ${firehoseToS3Role.id}
      policy: ${firehoseToS3.json}
  s3Stream:
    type: aws:kinesis:FirehoseDeliveryStream
    name: s3_stream
    properties:
      name: metric-stream-test-stream
      destination: extended_s3
      extendedS3Configuration:
        roleArn: ${firehoseToS3Role.arn}
        bucketArn: ${bucket.arn}
variables:
  # https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
  streamsAssumeRole:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - effect: Allow
            principals:
              - type: Service
                identifiers:
                  - streams.metrics.cloudwatch.amazonaws.com
            actions:
              - sts:AssumeRole
  # https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-trustpolicy.html
  metricStreamToFirehose:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - effect: Allow
            actions:
              - firehose:PutRecord
              - firehose:PutRecordBatch
            resources:
              - ${s3Stream.arn}
  firehoseAssumeRole:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - effect: Allow
            principals:
              - type: Service
                identifiers:
                  - firehose.amazonaws.com
            actions:
              - sts:AssumeRole
  firehoseToS3:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - effect: Allow
            actions:
              - s3:AbortMultipartUpload
              - s3:GetBucketLocation
              - s3:GetObject
              - s3:ListBucket
              - s3:ListBucketMultipartUploads
              - s3:PutObject
            resources:
              - ${bucket.arn}
              - ${bucket.arn}/*
Copy

Additional Statistics

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const main = new aws.cloudwatch.MetricStream("main", {
    name: "my-metric-stream",
    roleArn: metricStreamToFirehose.arn,
    firehoseArn: s3Stream.arn,
    outputFormat: "json",
    statisticsConfigurations: [
        {
            additionalStatistics: [
                "p1",
                "tm99",
            ],
            includeMetrics: [{
                metricName: "CPUUtilization",
                namespace: "AWS/EC2",
            }],
        },
        {
            additionalStatistics: ["TS(50.5:)"],
            includeMetrics: [{
                metricName: "CPUUtilization",
                namespace: "AWS/EC2",
            }],
        },
    ],
});
Copy
import pulumi
import pulumi_aws as aws

main = aws.cloudwatch.MetricStream("main",
    name="my-metric-stream",
    role_arn=metric_stream_to_firehose["arn"],
    firehose_arn=s3_stream["arn"],
    output_format="json",
    statistics_configurations=[
        {
            "additional_statistics": [
                "p1",
                "tm99",
            ],
            "include_metrics": [{
                "metric_name": "CPUUtilization",
                "namespace": "AWS/EC2",
            }],
        },
        {
            "additional_statistics": ["TS(50.5:)"],
            "include_metrics": [{
                "metric_name": "CPUUtilization",
                "namespace": "AWS/EC2",
            }],
        },
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudwatch.NewMetricStream(ctx, "main", &cloudwatch.MetricStreamArgs{
			Name:         pulumi.String("my-metric-stream"),
			RoleArn:      pulumi.Any(metricStreamToFirehose.Arn),
			FirehoseArn:  pulumi.Any(s3Stream.Arn),
			OutputFormat: pulumi.String("json"),
			StatisticsConfigurations: cloudwatch.MetricStreamStatisticsConfigurationArray{
				&cloudwatch.MetricStreamStatisticsConfigurationArgs{
					AdditionalStatistics: pulumi.StringArray{
						pulumi.String("p1"),
						pulumi.String("tm99"),
					},
					IncludeMetrics: cloudwatch.MetricStreamStatisticsConfigurationIncludeMetricArray{
						&cloudwatch.MetricStreamStatisticsConfigurationIncludeMetricArgs{
							MetricName: pulumi.String("CPUUtilization"),
							Namespace:  pulumi.String("AWS/EC2"),
						},
					},
				},
				&cloudwatch.MetricStreamStatisticsConfigurationArgs{
					AdditionalStatistics: pulumi.StringArray{
						pulumi.String("TS(50.5:)"),
					},
					IncludeMetrics: cloudwatch.MetricStreamStatisticsConfigurationIncludeMetricArray{
						&cloudwatch.MetricStreamStatisticsConfigurationIncludeMetricArgs{
							MetricName: pulumi.String("CPUUtilization"),
							Namespace:  pulumi.String("AWS/EC2"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var main = new Aws.CloudWatch.MetricStream("main", new()
    {
        Name = "my-metric-stream",
        RoleArn = metricStreamToFirehose.Arn,
        FirehoseArn = s3Stream.Arn,
        OutputFormat = "json",
        StatisticsConfigurations = new[]
        {
            new Aws.CloudWatch.Inputs.MetricStreamStatisticsConfigurationArgs
            {
                AdditionalStatistics = new[]
                {
                    "p1",
                    "tm99",
                },
                IncludeMetrics = new[]
                {
                    new Aws.CloudWatch.Inputs.MetricStreamStatisticsConfigurationIncludeMetricArgs
                    {
                        MetricName = "CPUUtilization",
                        Namespace = "AWS/EC2",
                    },
                },
            },
            new Aws.CloudWatch.Inputs.MetricStreamStatisticsConfigurationArgs
            {
                AdditionalStatistics = new[]
                {
                    "TS(50.5:)",
                },
                IncludeMetrics = new[]
                {
                    new Aws.CloudWatch.Inputs.MetricStreamStatisticsConfigurationIncludeMetricArgs
                    {
                        MetricName = "CPUUtilization",
                        Namespace = "AWS/EC2",
                    },
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.MetricStream;
import com.pulumi.aws.cloudwatch.MetricStreamArgs;
import com.pulumi.aws.cloudwatch.inputs.MetricStreamStatisticsConfigurationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var main = new MetricStream("main", MetricStreamArgs.builder()
            .name("my-metric-stream")
            .roleArn(metricStreamToFirehose.arn())
            .firehoseArn(s3Stream.arn())
            .outputFormat("json")
            .statisticsConfigurations(            
                MetricStreamStatisticsConfigurationArgs.builder()
                    .additionalStatistics(                    
                        "p1",
                        "tm99")
                    .includeMetrics(MetricStreamStatisticsConfigurationIncludeMetricArgs.builder()
                        .metricName("CPUUtilization")
                        .namespace("AWS/EC2")
                        .build())
                    .build(),
                MetricStreamStatisticsConfigurationArgs.builder()
                    .additionalStatistics("TS(50.5:)")
                    .includeMetrics(MetricStreamStatisticsConfigurationIncludeMetricArgs.builder()
                        .metricName("CPUUtilization")
                        .namespace("AWS/EC2")
                        .build())
                    .build())
            .build());

    }
}
Copy
resources:
  main:
    type: aws:cloudwatch:MetricStream
    properties:
      name: my-metric-stream
      roleArn: ${metricStreamToFirehose.arn}
      firehoseArn: ${s3Stream.arn}
      outputFormat: json
      statisticsConfigurations:
        - additionalStatistics:
            - p1
            - tm99
          includeMetrics:
            - metricName: CPUUtilization
              namespace: AWS/EC2
        - additionalStatistics:
            - TS(50.5:)
          includeMetrics:
            - metricName: CPUUtilization
              namespace: AWS/EC2
Copy

Create MetricStream Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new MetricStream(name: string, args: MetricStreamArgs, opts?: CustomResourceOptions);
@overload
def MetricStream(resource_name: str,
                 args: MetricStreamArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def MetricStream(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 firehose_arn: Optional[str] = None,
                 output_format: Optional[str] = None,
                 role_arn: Optional[str] = None,
                 exclude_filters: Optional[Sequence[MetricStreamExcludeFilterArgs]] = None,
                 include_filters: Optional[Sequence[MetricStreamIncludeFilterArgs]] = None,
                 include_linked_accounts_metrics: Optional[bool] = None,
                 name: Optional[str] = None,
                 name_prefix: Optional[str] = None,
                 statistics_configurations: Optional[Sequence[MetricStreamStatisticsConfigurationArgs]] = None,
                 tags: Optional[Mapping[str, str]] = None)
func NewMetricStream(ctx *Context, name string, args MetricStreamArgs, opts ...ResourceOption) (*MetricStream, error)
public MetricStream(string name, MetricStreamArgs args, CustomResourceOptions? opts = null)
public MetricStream(String name, MetricStreamArgs args)
public MetricStream(String name, MetricStreamArgs args, CustomResourceOptions options)
type: aws:cloudwatch:MetricStream
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. MetricStreamArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. MetricStreamArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. MetricStreamArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. MetricStreamArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. MetricStreamArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var metricStreamResource = new Aws.CloudWatch.MetricStream("metricStreamResource", new()
{
    FirehoseArn = "string",
    OutputFormat = "string",
    RoleArn = "string",
    ExcludeFilters = new[]
    {
        new Aws.CloudWatch.Inputs.MetricStreamExcludeFilterArgs
        {
            Namespace = "string",
            MetricNames = new[]
            {
                "string",
            },
        },
    },
    IncludeFilters = new[]
    {
        new Aws.CloudWatch.Inputs.MetricStreamIncludeFilterArgs
        {
            Namespace = "string",
            MetricNames = new[]
            {
                "string",
            },
        },
    },
    IncludeLinkedAccountsMetrics = false,
    Name = "string",
    NamePrefix = "string",
    StatisticsConfigurations = new[]
    {
        new Aws.CloudWatch.Inputs.MetricStreamStatisticsConfigurationArgs
        {
            AdditionalStatistics = new[]
            {
                "string",
            },
            IncludeMetrics = new[]
            {
                new Aws.CloudWatch.Inputs.MetricStreamStatisticsConfigurationIncludeMetricArgs
                {
                    MetricName = "string",
                    Namespace = "string",
                },
            },
        },
    },
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := cloudwatch.NewMetricStream(ctx, "metricStreamResource", &cloudwatch.MetricStreamArgs{
	FirehoseArn:  pulumi.String("string"),
	OutputFormat: pulumi.String("string"),
	RoleArn:      pulumi.String("string"),
	ExcludeFilters: cloudwatch.MetricStreamExcludeFilterArray{
		&cloudwatch.MetricStreamExcludeFilterArgs{
			Namespace: pulumi.String("string"),
			MetricNames: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
	},
	IncludeFilters: cloudwatch.MetricStreamIncludeFilterArray{
		&cloudwatch.MetricStreamIncludeFilterArgs{
			Namespace: pulumi.String("string"),
			MetricNames: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
	},
	IncludeLinkedAccountsMetrics: pulumi.Bool(false),
	Name:                         pulumi.String("string"),
	NamePrefix:                   pulumi.String("string"),
	StatisticsConfigurations: cloudwatch.MetricStreamStatisticsConfigurationArray{
		&cloudwatch.MetricStreamStatisticsConfigurationArgs{
			AdditionalStatistics: pulumi.StringArray{
				pulumi.String("string"),
			},
			IncludeMetrics: cloudwatch.MetricStreamStatisticsConfigurationIncludeMetricArray{
				&cloudwatch.MetricStreamStatisticsConfigurationIncludeMetricArgs{
					MetricName: pulumi.String("string"),
					Namespace:  pulumi.String("string"),
				},
			},
		},
	},
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var metricStreamResource = new MetricStream("metricStreamResource", MetricStreamArgs.builder()
    .firehoseArn("string")
    .outputFormat("string")
    .roleArn("string")
    .excludeFilters(MetricStreamExcludeFilterArgs.builder()
        .namespace("string")
        .metricNames("string")
        .build())
    .includeFilters(MetricStreamIncludeFilterArgs.builder()
        .namespace("string")
        .metricNames("string")
        .build())
    .includeLinkedAccountsMetrics(false)
    .name("string")
    .namePrefix("string")
    .statisticsConfigurations(MetricStreamStatisticsConfigurationArgs.builder()
        .additionalStatistics("string")
        .includeMetrics(MetricStreamStatisticsConfigurationIncludeMetricArgs.builder()
            .metricName("string")
            .namespace("string")
            .build())
        .build())
    .tags(Map.of("string", "string"))
    .build());
Copy
metric_stream_resource = aws.cloudwatch.MetricStream("metricStreamResource",
    firehose_arn="string",
    output_format="string",
    role_arn="string",
    exclude_filters=[{
        "namespace": "string",
        "metric_names": ["string"],
    }],
    include_filters=[{
        "namespace": "string",
        "metric_names": ["string"],
    }],
    include_linked_accounts_metrics=False,
    name="string",
    name_prefix="string",
    statistics_configurations=[{
        "additional_statistics": ["string"],
        "include_metrics": [{
            "metric_name": "string",
            "namespace": "string",
        }],
    }],
    tags={
        "string": "string",
    })
Copy
const metricStreamResource = new aws.cloudwatch.MetricStream("metricStreamResource", {
    firehoseArn: "string",
    outputFormat: "string",
    roleArn: "string",
    excludeFilters: [{
        namespace: "string",
        metricNames: ["string"],
    }],
    includeFilters: [{
        namespace: "string",
        metricNames: ["string"],
    }],
    includeLinkedAccountsMetrics: false,
    name: "string",
    namePrefix: "string",
    statisticsConfigurations: [{
        additionalStatistics: ["string"],
        includeMetrics: [{
            metricName: "string",
            namespace: "string",
        }],
    }],
    tags: {
        string: "string",
    },
});
Copy
type: aws:cloudwatch:MetricStream
properties:
    excludeFilters:
        - metricNames:
            - string
          namespace: string
    firehoseArn: string
    includeFilters:
        - metricNames:
            - string
          namespace: string
    includeLinkedAccountsMetrics: false
    name: string
    namePrefix: string
    outputFormat: string
    roleArn: string
    statisticsConfigurations:
        - additionalStatistics:
            - string
          includeMetrics:
            - metricName: string
              namespace: string
    tags:
        string: string
Copy

MetricStream Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The MetricStream resource accepts the following input properties:

FirehoseArn This property is required. string
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
OutputFormat This property is required. string

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

RoleArn This property is required. string
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
ExcludeFilters List<MetricStreamExcludeFilter>
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
IncludeFilters List<MetricStreamIncludeFilter>
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
IncludeLinkedAccountsMetrics bool
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
Name Changes to this property will trigger replacement. string
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
NamePrefix Changes to this property will trigger replacement. string
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
StatisticsConfigurations List<MetricStreamStatisticsConfiguration>
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
Tags Dictionary<string, string>
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
FirehoseArn This property is required. string
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
OutputFormat This property is required. string

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

RoleArn This property is required. string
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
ExcludeFilters []MetricStreamExcludeFilterArgs
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
IncludeFilters []MetricStreamIncludeFilterArgs
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
IncludeLinkedAccountsMetrics bool
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
Name Changes to this property will trigger replacement. string
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
NamePrefix Changes to this property will trigger replacement. string
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
StatisticsConfigurations []MetricStreamStatisticsConfigurationArgs
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
Tags map[string]string
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
firehoseArn This property is required. String
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
outputFormat This property is required. String

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

roleArn This property is required. String
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
excludeFilters List<MetricStreamExcludeFilter>
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
includeFilters List<MetricStreamIncludeFilter>
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
includeLinkedAccountsMetrics Boolean
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
name Changes to this property will trigger replacement. String
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
namePrefix Changes to this property will trigger replacement. String
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
statisticsConfigurations List<MetricStreamStatisticsConfiguration>
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags Map<String,String>
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
firehoseArn This property is required. string
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
outputFormat This property is required. string

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

roleArn This property is required. string
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
excludeFilters MetricStreamExcludeFilter[]
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
includeFilters MetricStreamIncludeFilter[]
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
includeLinkedAccountsMetrics boolean
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
name Changes to this property will trigger replacement. string
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
namePrefix Changes to this property will trigger replacement. string
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
statisticsConfigurations MetricStreamStatisticsConfiguration[]
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags {[key: string]: string}
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
firehose_arn This property is required. str
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
output_format This property is required. str

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

role_arn This property is required. str
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
exclude_filters Sequence[MetricStreamExcludeFilterArgs]
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
include_filters Sequence[MetricStreamIncludeFilterArgs]
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
include_linked_accounts_metrics bool
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
name Changes to this property will trigger replacement. str
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
name_prefix Changes to this property will trigger replacement. str
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
statistics_configurations Sequence[MetricStreamStatisticsConfigurationArgs]
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags Mapping[str, str]
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
firehoseArn This property is required. String
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
outputFormat This property is required. String

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

roleArn This property is required. String
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
excludeFilters List<Property Map>
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
includeFilters List<Property Map>
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
includeLinkedAccountsMetrics Boolean
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
name Changes to this property will trigger replacement. String
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
namePrefix Changes to this property will trigger replacement. String
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
statisticsConfigurations List<Property Map>
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags Map<String>
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the MetricStream resource produces the following output properties:

Arn string
ARN of the metric stream.
CreationDate string
Date and time in RFC3339 format that the metric stream was created.
Id string
The provider-assigned unique ID for this managed resource.
LastUpdateDate string
Date and time in RFC3339 format that the metric stream was last updated.
State string
State of the metric stream. Possible values are running and stopped.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
ARN of the metric stream.
CreationDate string
Date and time in RFC3339 format that the metric stream was created.
Id string
The provider-assigned unique ID for this managed resource.
LastUpdateDate string
Date and time in RFC3339 format that the metric stream was last updated.
State string
State of the metric stream. Possible values are running and stopped.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the metric stream.
creationDate String
Date and time in RFC3339 format that the metric stream was created.
id String
The provider-assigned unique ID for this managed resource.
lastUpdateDate String
Date and time in RFC3339 format that the metric stream was last updated.
state String
State of the metric stream. Possible values are running and stopped.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
ARN of the metric stream.
creationDate string
Date and time in RFC3339 format that the metric stream was created.
id string
The provider-assigned unique ID for this managed resource.
lastUpdateDate string
Date and time in RFC3339 format that the metric stream was last updated.
state string
State of the metric stream. Possible values are running and stopped.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
ARN of the metric stream.
creation_date str
Date and time in RFC3339 format that the metric stream was created.
id str
The provider-assigned unique ID for this managed resource.
last_update_date str
Date and time in RFC3339 format that the metric stream was last updated.
state str
State of the metric stream. Possible values are running and stopped.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the metric stream.
creationDate String
Date and time in RFC3339 format that the metric stream was created.
id String
The provider-assigned unique ID for this managed resource.
lastUpdateDate String
Date and time in RFC3339 format that the metric stream was last updated.
state String
State of the metric stream. Possible values are running and stopped.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing MetricStream Resource

Get an existing MetricStream resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MetricStreamState, opts?: CustomResourceOptions): MetricStream
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        creation_date: Optional[str] = None,
        exclude_filters: Optional[Sequence[MetricStreamExcludeFilterArgs]] = None,
        firehose_arn: Optional[str] = None,
        include_filters: Optional[Sequence[MetricStreamIncludeFilterArgs]] = None,
        include_linked_accounts_metrics: Optional[bool] = None,
        last_update_date: Optional[str] = None,
        name: Optional[str] = None,
        name_prefix: Optional[str] = None,
        output_format: Optional[str] = None,
        role_arn: Optional[str] = None,
        state: Optional[str] = None,
        statistics_configurations: Optional[Sequence[MetricStreamStatisticsConfigurationArgs]] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> MetricStream
func GetMetricStream(ctx *Context, name string, id IDInput, state *MetricStreamState, opts ...ResourceOption) (*MetricStream, error)
public static MetricStream Get(string name, Input<string> id, MetricStreamState? state, CustomResourceOptions? opts = null)
public static MetricStream get(String name, Output<String> id, MetricStreamState state, CustomResourceOptions options)
resources:  _:    type: aws:cloudwatch:MetricStream    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
ARN of the metric stream.
CreationDate string
Date and time in RFC3339 format that the metric stream was created.
ExcludeFilters List<MetricStreamExcludeFilter>
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
FirehoseArn string
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
IncludeFilters List<MetricStreamIncludeFilter>
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
IncludeLinkedAccountsMetrics bool
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
LastUpdateDate string
Date and time in RFC3339 format that the metric stream was last updated.
Name Changes to this property will trigger replacement. string
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
NamePrefix Changes to this property will trigger replacement. string
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
OutputFormat string

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

RoleArn string
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
State string
State of the metric stream. Possible values are running and stopped.
StatisticsConfigurations List<MetricStreamStatisticsConfiguration>
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
Tags Dictionary<string, string>
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
ARN of the metric stream.
CreationDate string
Date and time in RFC3339 format that the metric stream was created.
ExcludeFilters []MetricStreamExcludeFilterArgs
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
FirehoseArn string
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
IncludeFilters []MetricStreamIncludeFilterArgs
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
IncludeLinkedAccountsMetrics bool
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
LastUpdateDate string
Date and time in RFC3339 format that the metric stream was last updated.
Name Changes to this property will trigger replacement. string
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
NamePrefix Changes to this property will trigger replacement. string
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
OutputFormat string

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

RoleArn string
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
State string
State of the metric stream. Possible values are running and stopped.
StatisticsConfigurations []MetricStreamStatisticsConfigurationArgs
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
Tags map[string]string
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the metric stream.
creationDate String
Date and time in RFC3339 format that the metric stream was created.
excludeFilters List<MetricStreamExcludeFilter>
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
firehoseArn String
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
includeFilters List<MetricStreamIncludeFilter>
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
includeLinkedAccountsMetrics Boolean
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
lastUpdateDate String
Date and time in RFC3339 format that the metric stream was last updated.
name Changes to this property will trigger replacement. String
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
namePrefix Changes to this property will trigger replacement. String
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
outputFormat String

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

roleArn String
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
state String
State of the metric stream. Possible values are running and stopped.
statisticsConfigurations List<MetricStreamStatisticsConfiguration>
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags Map<String,String>
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
ARN of the metric stream.
creationDate string
Date and time in RFC3339 format that the metric stream was created.
excludeFilters MetricStreamExcludeFilter[]
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
firehoseArn string
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
includeFilters MetricStreamIncludeFilter[]
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
includeLinkedAccountsMetrics boolean
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
lastUpdateDate string
Date and time in RFC3339 format that the metric stream was last updated.
name Changes to this property will trigger replacement. string
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
namePrefix Changes to this property will trigger replacement. string
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
outputFormat string

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

roleArn string
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
state string
State of the metric stream. Possible values are running and stopped.
statisticsConfigurations MetricStreamStatisticsConfiguration[]
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags {[key: string]: string}
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
ARN of the metric stream.
creation_date str
Date and time in RFC3339 format that the metric stream was created.
exclude_filters Sequence[MetricStreamExcludeFilterArgs]
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
firehose_arn str
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
include_filters Sequence[MetricStreamIncludeFilterArgs]
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
include_linked_accounts_metrics bool
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
last_update_date str
Date and time in RFC3339 format that the metric stream was last updated.
name Changes to this property will trigger replacement. str
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
name_prefix Changes to this property will trigger replacement. str
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
output_format str

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

role_arn str
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
state str
State of the metric stream. Possible values are running and stopped.
statistics_configurations Sequence[MetricStreamStatisticsConfigurationArgs]
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags Mapping[str, str]
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the metric stream.
creationDate String
Date and time in RFC3339 format that the metric stream was created.
excludeFilters List<Property Map>
List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with include_filter.
firehoseArn String
ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
includeFilters List<Property Map>
List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with exclude_filter.
includeLinkedAccountsMetrics Boolean
If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. For more information about linking accounts, see CloudWatch cross-account observability.
lastUpdateDate String
Date and time in RFC3339 format that the metric stream was last updated.
name Changes to this property will trigger replacement. String
Friendly name of the metric stream. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
namePrefix Changes to this property will trigger replacement. String
Creates a unique friendly name beginning with the specified prefix. Conflicts with name.
outputFormat String

Output format for the stream. Possible values are json, opentelemetry0.7, and opentelemetry1.0. For more information about output formats, see Metric streams output formats.

The following arguments are optional:

roleArn String
ARN of the IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. For more information about role permissions, see Trust between CloudWatch and Kinesis Data Firehose.
state String
State of the metric stream. Possible values are running and stopped.
statisticsConfigurations List<Property Map>
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's output_format. If the OutputFormat is json, you can stream any additional statistic that is supported by CloudWatch, listed in CloudWatch statistics definitions. If the OutputFormat is opentelemetry0.7 or opentelemetry1.0, you can stream percentile statistics (p99 etc.). See details below.
tags Map<String>
Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Supporting Types

MetricStreamExcludeFilter
, MetricStreamExcludeFilterArgs

Namespace This property is required. string
Name of the metric namespace in the filter.
MetricNames List<string>
An array that defines the metrics you want to exclude for this metric namespace
Namespace This property is required. string
Name of the metric namespace in the filter.
MetricNames []string
An array that defines the metrics you want to exclude for this metric namespace
namespace This property is required. String
Name of the metric namespace in the filter.
metricNames List<String>
An array that defines the metrics you want to exclude for this metric namespace
namespace This property is required. string
Name of the metric namespace in the filter.
metricNames string[]
An array that defines the metrics you want to exclude for this metric namespace
namespace This property is required. str
Name of the metric namespace in the filter.
metric_names Sequence[str]
An array that defines the metrics you want to exclude for this metric namespace
namespace This property is required. String
Name of the metric namespace in the filter.
metricNames List<String>
An array that defines the metrics you want to exclude for this metric namespace

MetricStreamIncludeFilter
, MetricStreamIncludeFilterArgs

Namespace This property is required. string
Name of the metric namespace in the filter.
MetricNames List<string>
An array that defines the metrics you want to include for this metric namespace
Namespace This property is required. string
Name of the metric namespace in the filter.
MetricNames []string
An array that defines the metrics you want to include for this metric namespace
namespace This property is required. String
Name of the metric namespace in the filter.
metricNames List<String>
An array that defines the metrics you want to include for this metric namespace
namespace This property is required. string
Name of the metric namespace in the filter.
metricNames string[]
An array that defines the metrics you want to include for this metric namespace
namespace This property is required. str
Name of the metric namespace in the filter.
metric_names Sequence[str]
An array that defines the metrics you want to include for this metric namespace
namespace This property is required. String
Name of the metric namespace in the filter.
metricNames List<String>
An array that defines the metrics you want to include for this metric namespace

MetricStreamStatisticsConfiguration
, MetricStreamStatisticsConfigurationArgs

AdditionalStatistics This property is required. List<string>
The additional statistics to stream for the metrics listed in include_metrics.
IncludeMetrics This property is required. List<MetricStreamStatisticsConfigurationIncludeMetric>
An array that defines the metrics that are to have additional statistics streamed. See details below.
AdditionalStatistics This property is required. []string
The additional statistics to stream for the metrics listed in include_metrics.
IncludeMetrics This property is required. []MetricStreamStatisticsConfigurationIncludeMetric
An array that defines the metrics that are to have additional statistics streamed. See details below.
additionalStatistics This property is required. List<String>
The additional statistics to stream for the metrics listed in include_metrics.
includeMetrics This property is required. List<MetricStreamStatisticsConfigurationIncludeMetric>
An array that defines the metrics that are to have additional statistics streamed. See details below.
additionalStatistics This property is required. string[]
The additional statistics to stream for the metrics listed in include_metrics.
includeMetrics This property is required. MetricStreamStatisticsConfigurationIncludeMetric[]
An array that defines the metrics that are to have additional statistics streamed. See details below.
additional_statistics This property is required. Sequence[str]
The additional statistics to stream for the metrics listed in include_metrics.
include_metrics This property is required. Sequence[MetricStreamStatisticsConfigurationIncludeMetric]
An array that defines the metrics that are to have additional statistics streamed. See details below.
additionalStatistics This property is required. List<String>
The additional statistics to stream for the metrics listed in include_metrics.
includeMetrics This property is required. List<Property Map>
An array that defines the metrics that are to have additional statistics streamed. See details below.

MetricStreamStatisticsConfigurationIncludeMetric
, MetricStreamStatisticsConfigurationIncludeMetricArgs

MetricName This property is required. string
The name of the metric.
Namespace This property is required. string
MetricName This property is required. string
The name of the metric.
Namespace This property is required. string
metricName This property is required. String
The name of the metric.
namespace This property is required. String
metricName This property is required. string
The name of the metric.
namespace This property is required. string
metric_name This property is required. str
The name of the metric.
namespace This property is required. str
metricName This property is required. String
The name of the metric.
namespace This property is required. String

Import

Using pulumi import, import CloudWatch metric streams using the name. For example:

$ pulumi import aws:cloudwatch/metricStream:MetricStream sample sample-stream-name
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.