Skip to content
v2.278.0

CfnAnomalyDetectorProps Struct ​

Properties for defining a CfnAnomalyDetector.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
const cfnAnomalyDetectorProps: cloudwatch.CfnAnomalyDetectorProps = {
  configuration: {
    excludedTimeRanges: [{
      endTime: 'endTime',
      startTime: 'startTime',
    }],
    metricTimeZone: 'metricTimeZone',
  },
  dimensions: [{
    name: 'name',
    value: 'value',
  }],
  metricCharacteristics: {
    periodicSpikes: false,
  },
  metricMathAnomalyDetector: {
    metricDataQueries: [{
      id: 'id',

      // the properties below are optional
      accountId: 'accountId',
      expression: 'expression',
      label: 'label',
      metricStat: {
        metric: {
          metricName: 'metricName',
          namespace: 'namespace',

          // the properties below are optional
          dimensions: [{
            name: 'name',
            value: 'value',
          }],
        },
        period: 123,
        stat: 'stat',

        // the properties below are optional
        unit: 'unit',
      },
      period: 123,
      returnData: false,
    }],
  },
  metricName: 'metricName',
  namespace: 'namespace',
  singleMetricAnomalyDetector: {
    accountId: 'accountId',
    dimensions: [{
      name: 'name',
      value: 'value',
    }],
    metricName: 'metricName',
    namespace: 'namespace',
    stat: 'stat',
  },
  stat: 'stat',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudwatch as cloudwatch

cfn_anomaly_detector_props = cloudwatch.CfnAnomalyDetectorProps(
    configuration=cloudwatch.CfnAnomalyDetector.ConfigurationProperty(
        excluded_time_ranges=[cloudwatch.CfnAnomalyDetector.RangeProperty(
            end_time="endTime",
            start_time="startTime"
        )],
        metric_time_zone="metricTimeZone"
    ),
    dimensions=[cloudwatch.CfnAnomalyDetector.DimensionProperty(
        name="name",
        value="value"
    )],
    metric_characteristics=cloudwatch.CfnAnomalyDetector.MetricCharacteristicsProperty(
        periodic_spikes=False
    ),
    metric_math_anomaly_detector=cloudwatch.CfnAnomalyDetector.MetricMathAnomalyDetectorProperty(
        metric_data_queries=[cloudwatch.CfnAnomalyDetector.MetricDataQueryProperty(
            id="id",

            # the properties below are optional
            account_id="accountId",
            expression="expression",
            label="label",
            metric_stat=cloudwatch.CfnAnomalyDetector.MetricStatProperty(
                metric=cloudwatch.CfnAnomalyDetector.MetricProperty(
                    metric_name="metricName",
                    namespace="namespace",

                    # the properties below are optional
                    dimensions=[cloudwatch.CfnAnomalyDetector.DimensionProperty(
                        name="name",
                        value="value"
                    )]
                ),
                period=123,
                stat="stat",

                # the properties below are optional
                unit="unit"
            ),
            period=123,
            return_data=False
        )]
    ),
    metric_name="metricName",
    namespace="namespace",
    single_metric_anomaly_detector=cloudwatch.CfnAnomalyDetector.SingleMetricAnomalyDetectorProperty(
        account_id="accountId",
        dimensions=[cloudwatch.CfnAnomalyDetector.DimensionProperty(
            name="name",
            value="value"
        )],
        metric_name="metricName",
        namespace="namespace",
        stat="stat"
    ),
    stat="stat"
)
java
// 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.*;

CfnAnomalyDetectorProps cfnAnomalyDetectorProps = CfnAnomalyDetectorProps.builder()
        .configuration(ConfigurationProperty.builder()
                .excludedTimeRanges(List.of(RangeProperty.builder()
                        .endTime("endTime")
                        .startTime("startTime")
                        .build()))
                .metricTimeZone("metricTimeZone")
                .build())
        .dimensions(List.of(DimensionProperty.builder()
                .name("name")
                .value("value")
                .build()))
        .metricCharacteristics(MetricCharacteristicsProperty.builder()
                .periodicSpikes(false)
                .build())
        .metricMathAnomalyDetector(MetricMathAnomalyDetectorProperty.builder()
                .metricDataQueries(List.of(MetricDataQueryProperty.builder()
                        .id("id")

                        // the properties below are optional
                        .accountId("accountId")
                        .expression("expression")
                        .label("label")
                        .metricStat(MetricStatProperty.builder()
                                .metric(MetricProperty.builder()
                                        .metricName("metricName")
                                        .namespace("namespace")

                                        // the properties below are optional
                                        .dimensions(List.of(DimensionProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .build())
                                .period(123)
                                .stat("stat")

                                // the properties below are optional
                                .unit("unit")
                                .build())
                        .period(123)
                        .returnData(false)
                        .build()))
                .build())
        .metricName("metricName")
        .namespace("namespace")
        .singleMetricAnomalyDetector(SingleMetricAnomalyDetectorProperty.builder()
                .accountId("accountId")
                .dimensions(List.of(DimensionProperty.builder()
                        .name("name")
                        .value("value")
                        .build()))
                .metricName("metricName")
                .namespace("namespace")
                .stat("stat")
                .build())
        .stat("stat")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudWatch;

var cfnAnomalyDetectorProps = new CfnAnomalyDetectorProps {
    Configuration = new ConfigurationProperty {
        ExcludedTimeRanges = new [] { new RangeProperty {
            EndTime = "endTime",
            StartTime = "startTime"
        } },
        MetricTimeZone = "metricTimeZone"
    },
    Dimensions = new [] { new DimensionProperty {
        Name = "name",
        Value = "value"
    } },
    MetricCharacteristics = new MetricCharacteristicsProperty {
        PeriodicSpikes = false
    },
    MetricMathAnomalyDetector = new MetricMathAnomalyDetectorProperty {
        MetricDataQueries = new [] { new MetricDataQueryProperty {
            Id = "id",

            // the properties below are optional
            AccountId = "accountId",
            Expression = "expression",
            Label = "label",
            MetricStat = new MetricStatProperty {
                Metric = new MetricProperty {
                    MetricName = "metricName",
                    Namespace = "namespace",

                    // the properties below are optional
                    Dimensions = new [] { new DimensionProperty {
                        Name = "name",
                        Value = "value"
                    } }
                },
                Period = 123,
                Stat = "stat",

                // the properties below are optional
                Unit = "unit"
            },
            Period = 123,
            ReturnData = false
        } }
    },
    MetricName = "metricName",
    Namespace = "namespace",
    SingleMetricAnomalyDetector = new SingleMetricAnomalyDetectorProperty {
        AccountId = "accountId",
        Dimensions = new [] { new DimensionProperty {
            Name = "name",
            Value = "value"
        } },
        MetricName = "metricName",
        Namespace = "namespace",
        Stat = "stat"
    },
    Stat = "stat"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnAnomalyDetectorProps := &CfnAnomalyDetectorProps{
	Configuration: &ConfigurationProperty{
		ExcludedTimeRanges: []interface{}{
			&RangeProperty{
				EndTime: jsii.String("endTime"),
				StartTime: jsii.String("startTime"),
			},
		},
		MetricTimeZone: jsii.String("metricTimeZone"),
	},
	Dimensions: []interface{}{
		&DimensionProperty{
			Name: jsii.String("name"),
			Value: jsii.String("value"),
		},
	},
	MetricCharacteristics: &MetricCharacteristicsProperty{
		PeriodicSpikes: jsii.Boolean(false),
	},
	MetricMathAnomalyDetector: &MetricMathAnomalyDetectorProperty{
		MetricDataQueries: []interface{}{
			&MetricDataQueryProperty{
				Id: jsii.String("id"),

				// the properties below are optional
				AccountId: jsii.String("accountId"),
				Expression: jsii.String("expression"),
				Label: jsii.String("label"),
				MetricStat: &MetricStatProperty{
					Metric: &MetricProperty{
						MetricName: jsii.String("metricName"),
						Namespace: jsii.String("namespace"),

						// the properties below are optional
						Dimensions: []interface{}{
							&DimensionProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
					},
					Period: jsii.Number(123),
					Stat: jsii.String("stat"),

					// the properties below are optional
					Unit: jsii.String("unit"),
				},
				Period: jsii.Number(123),
				ReturnData: jsii.Boolean(false),
			},
		},
	},
	MetricName: jsii.String("metricName"),
	Namespace: jsii.String("namespace"),
	SingleMetricAnomalyDetector: &SingleMetricAnomalyDetectorProperty{
		AccountId: jsii.String("accountId"),
		Dimensions: []interface{}{
			&DimensionProperty{
				Name: jsii.String("name"),
				Value: jsii.String("value"),
			},
		},
		MetricName: jsii.String("metricName"),
		Namespace: jsii.String("namespace"),
		Stat: jsii.String("stat"),
	},
	Stat: jsii.String("stat"),
}

Properties ​

configurationoptionalIResolvable | CfnAnomalyDetector.ConfigurationPropertyconfigurationoptionaltyping.Union[IResolvable, ConfigurationProperty]configurationoptionalIResolvableConfigurationoptionalIResolvableConfigurationoptionalinterface{} #
Specifies details about how the anomaly detection model is to be trained, including time ranges to exclude when training and updating the model.

The configuration can also include the time zone to use for the metric.

dimensionsoptionalIResolvable | IResolvable | CfnAnomalyDetector.DimensionProperty[]dimensionsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, DimensionProperty]]]dimensionsoptionalIResolvableDimensionsoptionalIResolvableDimensionsoptionalinterface{} #
The dimensions of the metric associated with the anomaly detection band.
metricCharacteristicsoptionalIResolvable | CfnAnomalyDetector.MetricCharacteristicsPropertymetric_characteristicsoptionaltyping.Union[IResolvable, MetricCharacteristicsProperty]metricCharacteristicsoptionalIResolvableMetricCharacteristicsoptionalIResolvableMetricCharacteristicsoptionalinterface{} #
Use this object to include parameters to provide information about your metric to CloudWatch to help it build more accurate anomaly detection models.

Currently, it includes the PeriodicSpikes parameter.

metricMathAnomalyDetectoroptionalIResolvable | CfnAnomalyDetector.MetricMathAnomalyDetectorPropertymetric_math_anomaly_detectoroptionaltyping.Union[IResolvable, MetricMathAnomalyDetectorProperty]metricMathAnomalyDetectoroptionalIResolvableMetricMathAnomalyDetectoroptionalIResolvableMetricMathAnomalyDetectoroptionalinterface{} #
The CloudWatch metric math expression for this anomaly detector.
metricNameoptionalstringmetric_nameoptionalstrmetricNameoptionalStringMetricNameoptionalstringMetricNameoptional*string #
The name of the metric associated with the anomaly detection band.
namespaceoptionalstringnamespaceoptionalstrnamespaceoptionalStringNamespaceoptionalstringNamespaceoptional*string #
The namespace of the metric associated with the anomaly detection band.
singleMetricAnomalyDetectoroptionalIResolvable | CfnAnomalyDetector.SingleMetricAnomalyDetectorPropertysingle_metric_anomaly_detectoroptionaltyping.Union[IResolvable, SingleMetricAnomalyDetectorProperty]singleMetricAnomalyDetectoroptionalIResolvableSingleMetricAnomalyDetectoroptionalIResolvableSingleMetricAnomalyDetectoroptionalinterface{} #
The CloudWatch metric and statistic for this anomaly detector.
statoptionalstringstatoptionalstrstatoptionalStringStatoptionalstringStatoptional*string #
The statistic of the metric associated with the anomaly detection band.