Class CfnMetricStream
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::CloudWatch::MetricStream
.
Creates or updates a metric stream. Metrics streams can automatically stream CloudWatch metrics to AWS destinations including Amazon S3 and to many third-party solutions. For more information, see Metric streams .
To create a metric stream, you must be logged on to an account that has the iam:PassRole
permission and either the CloudWatchFullAccess policy or the cloudwatch:PutMetricStream
permission.
When you create or update a metric stream, you choose one of the following:
- Stream metrics from all metric namespaces in the account.
- Stream metrics from all metric namespaces in the account, except for the namespaces that you list in
ExcludeFilters
. - Stream metrics from only the metric namespaces that you list in
IncludeFilters
.
When you create a metric stream, the stream is created in the running
state. If you update an existing metric stream, the state does not change.
If you create a metric stream in an account that has been set up as a monitoring account in CloudWatch cross-account observability, you can choose whether to include metrics from linked source accounts in the metric stream.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.cloudwatch.*; CfnMetricStream cfnMetricStream = CfnMetricStream.Builder.create(this, "MyCfnMetricStream") .firehoseArn("firehoseArn") .outputFormat("outputFormat") .roleArn("roleArn") // the properties below are optional .excludeFilters(List.of(MetricStreamFilterProperty.builder() .namespace("namespace") // the properties below are optional .metricNames(List.of("metricNames")) .build())) .includeFilters(List.of(MetricStreamFilterProperty.builder() .namespace("namespace") // the properties below are optional .metricNames(List.of("metricNames")) .build())) .includeLinkedAccountsMetrics(false) .name("name") .statisticsConfigurations(List.of(MetricStreamStatisticsConfigurationProperty.builder() .additionalStatistics(List.of("additionalStatistics")) .includeMetrics(List.of(MetricStreamStatisticsMetricProperty.builder() .metricName("metricName") .namespace("namespace") .build())) .build())) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build();
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A fluent builder forCfnMetricStream
.static interface
This structure contains a metric namespace and optionally, a list of metric names, to either include in a metric ' stream or exclude from a metric stream.static interface
This structure specifies a list of additional statistics to stream, and the metrics to stream those additional statistics for.static interface
A structure that specifies the metric name and namespace for one metric that is going to have additional statistics included in the stream.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionCfnMetricStream
(Construct scope, String id, CfnMetricStreamProps props) Create a newAWS::CloudWatch::MetricStream
.protected
CfnMetricStream
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnMetricStream
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionThe ARN of the metric stream.The date that the metric stream was originally created.The date that the metric stream was most recently updated.The state of the metric stream, eitherrunning
orstopped
.If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.If you are creating a metric stream in a monitoring account, specifytrue
to include metrics from source accounts that are linked to this monitoring account, in the metric stream.getName()
If you are creating a new metric stream, this is the name for the new stream.The output format for the stream.The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.getTags()
An array of key-value pairs to apply to the metric stream.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setExcludeFilters
(List<Object> value) If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.void
setExcludeFilters
(IResolvable value) If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.void
setFirehoseArn
(String value) The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.void
setIncludeFilters
(List<Object> value) If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.void
setIncludeFilters
(IResolvable value) If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.void
If you are creating a metric stream in a monitoring account, specifytrue
to include metrics from source accounts that are linked to this monitoring account, in the metric stream.void
If you are creating a metric stream in a monitoring account, specifytrue
to include metrics from source accounts that are linked to this monitoring account, in the metric stream.void
If you are creating a new metric stream, this is the name for the new stream.void
setOutputFormat
(String value) The output format for the stream.void
setRoleArn
(String value) The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.void
setStatisticsConfigurations
(List<Object> value) By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.void
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnMetricStream
protected CfnMetricStream(software.amazon.jsii.JsiiObjectRef objRef) -
CfnMetricStream
protected CfnMetricStream(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnMetricStream
@Stability(Stable) public CfnMetricStream(@NotNull Construct scope, @NotNull String id, @NotNull CfnMetricStreamProps props) Create a newAWS::CloudWatch::MetricStream
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
The ARN of the metric stream. -
getAttrCreationDate
The date that the metric stream was originally created. -
getAttrLastUpdateDate
The date that the metric stream was most recently updated. -
getAttrState
The state of the metric stream, eitherrunning
orstopped
. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
An array of key-value pairs to apply to the metric stream.For more information, see Tag .
-
getFirehoseArn
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.This Amazon Kinesis Firehose delivery stream must already exist and must be in the same account as the metric stream.
-
setFirehoseArn
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.This Amazon Kinesis Firehose delivery stream must already exist and must be in the same account as the metric stream.
-
getOutputFormat
The output format for the stream.Valid values are
json
andopentelemetry0.7
For more information about metric stream output formats, see Metric streams output formats .This parameter is required.
-
setOutputFormat
The output format for the stream.Valid values are
json
andopentelemetry0.7
For more information about metric stream output formats, see Metric streams output formats .This parameter is required.
-
getRoleArn
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.This IAM role must already exist and must be in the same account as the metric stream. This IAM role must include the
firehose:PutRecord
andfirehose:PutRecordBatch
permissions. -
setRoleArn
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.This IAM role must already exist and must be in the same account as the metric stream. This IAM role must include the
firehose:PutRecord
andfirehose:PutRecordBatch
permissions. -
getExcludeFilters
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.You cannot specify both
IncludeFilters
andExcludeFilters
in the same metric stream.When you modify the
IncludeFilters
orExcludeFilters
of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update. -
setExcludeFilters
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.You cannot specify both
IncludeFilters
andExcludeFilters
in the same metric stream.When you modify the
IncludeFilters
orExcludeFilters
of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update. -
setExcludeFilters
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.You cannot specify both
IncludeFilters
andExcludeFilters
in the same metric stream.When you modify the
IncludeFilters
orExcludeFilters
of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update. -
getIncludeFilters
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.You cannot specify both
IncludeFilters
andExcludeFilters
in the same metric stream.When you modify the
IncludeFilters
orExcludeFilters
of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update. -
setIncludeFilters
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.You cannot specify both
IncludeFilters
andExcludeFilters
in the same metric stream.When you modify the
IncludeFilters
orExcludeFilters
of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update. -
setIncludeFilters
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.You cannot specify both
IncludeFilters
andExcludeFilters
in the same metric stream.When you modify the
IncludeFilters
orExcludeFilters
of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update. -
getIncludeLinkedAccountsMetrics
If you are creating a metric stream in a monitoring account, specifytrue
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
-
setIncludeLinkedAccountsMetrics
If you are creating a metric stream in a monitoring account, specifytrue
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
-
setIncludeLinkedAccountsMetrics
If you are creating a metric stream in a monitoring account, specifytrue
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
-
getName
If you are creating a new metric stream, this is the name for the new stream.The name must be different than the names of other metric streams in this account and Region.
If you are updating a metric stream, specify the name of that stream here.
-
setName
If you are creating a new metric stream, this is the name for the new stream.The name must be different than the names of other metric streams in this account and Region.
If you are updating a metric stream, specify the name of that stream here.
-
getStatisticsConfigurations
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.
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
OutputFormat
. If theOutputFormat
isjson
, you can stream any additional statistic that is supported by CloudWatch , listed in CloudWatch statistics definitions . If theOutputFormat
isopentelemetry0
.7, you can stream percentile statistics (p??) . -
setStatisticsConfigurations
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.
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
OutputFormat
. If theOutputFormat
isjson
, you can stream any additional statistic that is supported by CloudWatch , listed in CloudWatch statistics definitions . If theOutputFormat
isopentelemetry0
.7, you can stream percentile statistics (p??) . -
setStatisticsConfigurations
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.
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
OutputFormat
. If theOutputFormat
isjson
, you can stream any additional statistic that is supported by CloudWatch , listed in CloudWatch statistics definitions . If theOutputFormat
isopentelemetry0
.7, you can stream percentile statistics (p??) .
-