# CloudWatchAlarmDefinitionProperty

The definition of a CloudWatch metric alarm, which determines when an automatic scaling activity is triggered.

When the defined alarm conditions
are satisfied, scaling activity begins.

- Source: [`aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts#L1199)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_stepfunctions_tasks as stepfunctions_tasks } from 'aws-cdk-lib';
const cloudWatchAlarmDefinitionProperty: stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmDefinitionProperty = {
  comparisonOperator: stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator.GREATER_THAN_OR_EQUAL,
  metricName: 'metricName',
  period: cdk.Duration.minutes(30),

  // the properties below are optional
  dimensions: [{
    key: 'key',
    value: 'value',
  }],
  evaluationPeriods: 123,
  namespace: 'namespace',
  statistic: stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmStatistic.SAMPLE_COUNT,
  threshold: 123,
  unit: stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmUnit.NONE,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_stepfunctions_tasks as stepfunctions_tasks

cloud_watch_alarm_definition_property = stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmDefinitionProperty(
    comparison_operator=stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator.GREATER_THAN_OR_EQUAL,
    metric_name="metricName",
    period=cdk.Duration.minutes(30),

    # the properties below are optional
    dimensions=[stepfunctions_tasks.EmrCreateCluster.MetricDimensionProperty(
        key="key",
        value="value"
    )],
    evaluation_periods=123,
    namespace="namespace",
    statistic=stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmStatistic.SAMPLE_COUNT,
    threshold=123,
    unit=stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmUnit.NONE
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;

CloudWatchAlarmDefinitionProperty cloudWatchAlarmDefinitionProperty = CloudWatchAlarmDefinitionProperty.builder()
        .comparisonOperator(EmrCreateCluster.getCloudWatchAlarmComparisonOperator().GREATER_THAN_OR_EQUAL)
        .metricName("metricName")
        .period(Duration.minutes(30))

        // the properties below are optional
        .dimensions(List.of(MetricDimensionProperty.builder()
                .key("key")
                .value("value")
                .build()))
        .evaluationPeriods(123)
        .namespace("namespace")
        .statistic(EmrCreateCluster.getCloudWatchAlarmStatistic().SAMPLE_COUNT)
        .threshold(123)
        .unit(EmrCreateCluster.getCloudWatchAlarmUnit().NONE)
        .build();
```

C# / .NET:

```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;
using Amazon.CDK.AWS.StepFunctions.Tasks;

var cloudWatchAlarmDefinitionProperty = new CloudWatchAlarmDefinitionProperty {
    ComparisonOperator = EmrCreateCluster.CloudWatchAlarmComparisonOperator.GREATER_THAN_OR_EQUAL,
    MetricName = "metricName",
    Period = Duration.Minutes(30),

    // the properties below are optional
    Dimensions = new [] { new MetricDimensionProperty {
        Key = "key",
        Value = "value"
    } },
    EvaluationPeriods = 123,
    Namespace = "namespace",
    Statistic = EmrCreateCluster.CloudWatchAlarmStatistic.SAMPLE_COUNT,
    Threshold = 123,
    Unit = EmrCreateCluster.CloudWatchAlarmUnit.NONE
};
```

Golang:

```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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

cloudWatchAlarmDefinitionProperty := &CloudWatchAlarmDefinitionProperty{
	ComparisonOperator: awscdk.Aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator_GREATER_THAN_OR_EQUAL,
	MetricName: jsii.String("metricName"),
	Period: cdk.Duration_Minutes(jsii.Number(30)),

	// the properties below are optional
	Dimensions: []MetricDimensionProperty{
		&MetricDimensionProperty{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	EvaluationPeriods: jsii.Number(123),
	Namespace: jsii.String("namespace"),
	Statistic: awscdk.*Aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmStatistic_SAMPLE_COUNT,
	Threshold: jsii.Number(123),
	Unit: awscdk.*Aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmUnit_NONE,
}
```

## Properties

- `comparisonOperator`: [EmrCreateCluster.CloudWatchAlarmComparisonOperator](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator.html) (required) — Determines how the metric specified by MetricName is compared to the value specified by Threshold.

- `dimensions`: [EmrCreateCluster.MetricDimensionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.EmrCreateCluster.MetricDimensionProperty.html)[] — A CloudWatch metric dimension.

  **Default:** No dimensions

- `evaluationPeriods`: number = 1 — The number of periods, in five-minute increments, during which the alarm condition must exist before the alarm triggers automatic scaling activity.

- `metricName`: string (required) — The name of the CloudWatch metric that is watched to determine an alarm condition.

- `namespace`: string = 'AWS/ElasticMapReduce' — The namespace for the CloudWatch metric.

- `period`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (required) — The period, in seconds, over which the statistic is applied.

  EMR CloudWatch metrics are emitted every five minutes (300 seconds), so if
  an EMR CloudWatch metric is specified, specify 300.

- `statistic`: [EmrCreateCluster.CloudWatchAlarmStatistic](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmStatistic.html) = CloudWatchAlarmStatistic.AVERAGE — The statistic to apply to the metric associated with the alarm.

- `threshold`: number = None — The value against which the specified statistic is compared.

- `unit`: [EmrCreateCluster.CloudWatchAlarmUnit](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmUnit.html) = CloudWatchAlarmUnit.NONE — The unit of measure associated with the CloudWatch metric being watched.

  The value specified for Unit must correspond to the units
  specified in the CloudWatch metric.
