Class CfnMetricStream
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,ITaggable,IMetricStreamRef,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
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnMetricStream.static interfaceThis 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 interfaceThis structure specifies a list of additional statistics to stream, and the metrics to stream those additional statistics for.static interfaceA 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.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.cloudwatch.IMetricStreamRef
IMetricStreamRef.Jsii$Default, IMetricStreamRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnMetricStream(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnMetricStream(software.amazon.jsii.JsiiObjectRef objRef) CfnMetricStream(software.constructs.Construct scope, String id, CfnMetricStreamProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IMetricStreamReffromMetricStreamArn(software.constructs.Construct scope, String id, String arn) Creates a new IMetricStreamRef from an ARN.static IMetricStreamReffromMetricStreamName(software.constructs.Construct scope, String id, String metricStreamName) Creates a new IMetricStreamRef from a metricStreamName.The 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, eitherrunningorstopped.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, specifytrueto include metrics from source accounts that are linked to this monitoring account, in the metric stream.A reference to a MetricStream resource.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.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetExcludeFilters(List<Object> value) If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.voidsetExcludeFilters(IResolvable value) If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.voidsetFirehoseArn(String value) The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.voidsetIncludeFilters(List<Object> value) If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.voidsetIncludeFilters(IResolvable value) If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.voidIf you are creating a metric stream in a monitoring account, specifytrueto include metrics from source accounts that are linked to this monitoring account, in the metric stream.voidIf you are creating a metric stream in a monitoring account, specifytrueto include metrics from source accounts that are linked to this monitoring account, in the metric stream.voidIf you are creating a new metric stream, this is the name for the new stream.voidsetOutputFormat(String value) The output format for the stream.voidsetRoleArn(String value) The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.voidsetStatisticsConfigurations(List<Object> value) By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.voidBy default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.voidsetTagsRaw(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, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods 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
-
fromMetricStreamArn
@Stability(Stable) @NotNull public static IMetricStreamRef fromMetricStreamArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String arn) Creates a new IMetricStreamRef from an ARN.- Parameters:
scope- This parameter is required.id- This parameter is required.arn- This parameter is required.
-
fromMetricStreamName
@Stability(Stable) @NotNull public static IMetricStreamRef fromMetricStreamName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String metricStreamName) Creates a new IMetricStreamRef from a metricStreamName.- Parameters:
scope- This parameter is required.id- This parameter is required.metricStreamName- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin 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:
renderPropertiesin 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, eitherrunningorstopped. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getMetricStreamRef
A reference to a MetricStream resource.- Specified by:
getMetricStreamRefin interfaceIMetricStreamRef
-
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.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnMetricStream.MetricStreamFilterProperty> -
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.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnMetricStream.MetricStreamFilterProperty> -
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, specifytrueto include metrics from source accounts that are linked to this monitoring account, in the metric stream.Returns union: either
BooleanorIResolvable -
setIncludeLinkedAccountsMetrics
If you are creating a metric stream in a monitoring account, specifytrueto 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, specifytrueto 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.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnMetricStream.MetricStreamStatisticsConfigurationProperty> -
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.
-