Class CfnMetricStream
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
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();
- See Also:
-
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.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnMetricStream
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnMetricStream
(software.amazon.jsii.JsiiObjectRef objRef) CfnMetricStream
(software.constructs.Construct scope, String id, CfnMetricStreamProps props) -
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()
Tag Manager which manages the tags for this resource.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.void
setTagsRaw
(List<CfnTag> value) An array of key-value pairs to apply to the metric stream.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
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 software.constructs.Construct scope, @NotNull String id, @NotNull CfnMetricStreamProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
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
Tag Manager which manages the tags for this resource. -
getFirehoseArn
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream. -
setFirehoseArn
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream. -
getOutputFormat
The output format for the stream. -
setOutputFormat
The output format for the stream. -
getRoleArn
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. -
setRoleArn
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. -
getExcludeFilters
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here. -
setExcludeFilters
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here. -
setExcludeFilters
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here. -
getIncludeFilters
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here. -
setIncludeFilters
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here. -
setIncludeFilters
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here. -
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. -
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. -
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. -
getName
If you are creating a new metric stream, this is the name for the new stream. -
setName
If you are creating a new metric stream, this is the name for the new stream. -
getStatisticsConfigurations
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed. -
setStatisticsConfigurations
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed. -
setStatisticsConfigurations
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed. -
getTagsRaw
An array of key-value pairs to apply to the metric stream. -
setTagsRaw
An array of key-value pairs to apply to the metric stream.
-