Skip to content
v2.278.0

MetricExpressionConfig Struct ​

Properties for a concrete metric.

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';

declare const metric: cloudwatch.Metric;
const metricExpressionConfig: cloudwatch.MetricExpressionConfig = {
  expression: 'expression',
  period: 123,
  usingMetrics: {
    usingMetricsKey: metric,
  },

  // the properties below are optional
  searchAccount: 'searchAccount',
  searchRegion: 'searchRegion',
};
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

# metric: cloudwatch.Metric

metric_expression_config = cloudwatch.MetricExpressionConfig(
    expression="expression",
    period=123,
    using_metrics={
        "using_metrics_key": metric
    },

    # the properties below are optional
    search_account="searchAccount",
    search_region="searchRegion"
)
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.*;

Metric metric;

MetricExpressionConfig metricExpressionConfig = MetricExpressionConfig.builder()
        .expression("expression")
        .period(123)
        .usingMetrics(Map.of(
                "usingMetricsKey", metric))

        // the properties below are optional
        .searchAccount("searchAccount")
        .searchRegion("searchRegion")
        .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;

Metric metric;

var metricExpressionConfig = new MetricExpressionConfig {
    Expression = "expression",
    Period = 123,
    UsingMetrics = new Dictionary<string, IMetric> {
        { "usingMetricsKey", metric }
    },

    // the properties below are optional
    SearchAccount = "searchAccount",
    SearchRegion = "searchRegion"
};
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"

var metric Metric

metricExpressionConfig := &MetricExpressionConfig{
	Expression: jsii.String("expression"),
	Period: jsii.Number(123),
	UsingMetrics: map[string]IMetric{
		"usingMetricsKey": metric,
	},

	// the properties below are optional
	SearchAccount: jsii.String("searchAccount"),
	SearchRegion: jsii.String("searchRegion"),
}

Properties ​

expressionstringexpressionstrexpressionStringExpressionstringExpression*string required #
Math expression for the metric.
periodnumberperiodint | floatperiodNumberPerioddoublePeriod*float64 required #
How many seconds to aggregate over.
searchAccountoptionalstringsearch_accountoptionalstrsearchAccountoptionalStringSearchAccountoptionalstringSearchAccountoptional*string #
Account to evaluate search expressions within.

Default: Deployment account.

searchRegionoptionalstringsearch_regionoptionalstrsearchRegionoptionalStringSearchRegionoptionalstringSearchRegionoptional*string #
Region to evaluate search expressions within.

Default: Deployment region.

usingMetrics{ [key: string]: IMetric }using_metricstyping.Mapping[str, IMetric]usingMetricsMap<String, IMetric>UsingMetricsIDictionary<string, IMetric>UsingMetrics*map[string]IMetric required #
Metrics used in the math expression.