CfnAlarm L1 construct
The AWS::CloudWatch::Alarm type specifies an alarm and associates it with the specified metric or metric math expression.
When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA . The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed.
When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.
| CloudFormation | AWS::CloudWatch::Alarm |
|---|---|
| Source | |
| Type last changed |
Example
// 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 slidingWindow: any;
const cfnAlarm = new cloudwatch.CfnAlarm(this, 'MyCfnAlarm', /* all optional props */ {
actionConfiguration: {
alarmTagsPropagation: {
enabled: false,
// the properties below are optional
excludedTagKeys: ['excludedTagKeys'],
includedTagKeys: ['includedTagKeys'],
},
},
actionsEnabled: false,
alarmActions: ['alarmActions'],
alarmDescription: 'alarmDescription',
alarmName: 'alarmName',
comparisonOperator: 'comparisonOperator',
datapointsToAlarm: 123,
dimensions: [{
name: 'name',
value: 'value',
}],
evaluateLowSampleCountPercentile: 'evaluateLowSampleCountPercentile',
evaluationCriteria: {
promQlCriteria: {
pendingPeriod: 123,
query: 'query',
recoveryPeriod: 123,
},
},
evaluationInterval: 123,
evaluationPeriods: 123,
evaluationWindow: {
slidingWindow: slidingWindow,
wallClockWindow: {
timezone: 'timezone',
},
},
extendedStatistic: 'extendedStatistic',
insufficientDataActions: ['insufficientDataActions'],
metricName: 'metricName',
metrics: [{
id: 'id',
// the properties below are optional
accountId: 'accountId',
expression: 'expression',
label: 'label',
metricStat: {
metric: {
dimensions: [{
name: 'name',
value: 'value',
}],
metricName: 'metricName',
namespace: 'namespace',
},
period: 123,
stat: 'stat',
// the properties below are optional
unit: 'unit',
},
period: 123,
returnData: false,
}],
namespace: 'namespace',
okActions: ['okActions'],
period: 123,
statistic: 'statistic',
tags: [{
key: 'key',
value: 'value',
}],
threshold: 123,
thresholdMetricId: 'thresholdMetricId',
treatMissingData: 'treatMissingData',
unit: 'unit',
warmUpConfiguration: {
onlyStartEvaluatingAfterWarmUpPeriodEnds: false,
warmUpPeriodDurationInMinutes: 123,
},
});
from aws_cdk import CfnTag
# 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
# sliding_window: Any
cfn_alarm = cloudwatch.CfnAlarm(self, "MyCfnAlarm",
action_configuration=cloudwatch.CfnAlarm.ActionConfigurationProperty(
alarm_tags_propagation=cloudwatch.CfnAlarm.AlarmTagsPropagationProperty(
enabled=False,
# the properties below are optional
excluded_tag_keys=["excludedTagKeys"],
included_tag_keys=["includedTagKeys"]
)
),
actions_enabled=False,
alarm_actions=["alarmActions"],
alarm_description="alarmDescription",
alarm_name="alarmName",
comparison_operator="comparisonOperator",
datapoints_to_alarm=123,
dimensions=[cloudwatch.CfnAlarm.DimensionProperty(
name="name",
value="value"
)],
evaluate_low_sample_count_percentile="evaluateLowSampleCountPercentile",
evaluation_criteria=cloudwatch.CfnAlarm.EvaluationCriteriaProperty(
prom_ql_criteria=cloudwatch.CfnAlarm.AlarmPromQLCriteriaProperty(
pending_period=123,
query="query",
recovery_period=123
)
),
evaluation_interval=123,
evaluation_periods=123,
evaluation_window=cloudwatch.CfnAlarm.EvaluationWindowProperty(
sliding_window=sliding_window,
wall_clock_window=cloudwatch.CfnAlarm.WallClockWindowProperty(
timezone="timezone"
)
),
extended_statistic="extendedStatistic",
insufficient_data_actions=["insufficientDataActions"],
metric_name="metricName",
metrics=[cloudwatch.CfnAlarm.MetricDataQueryProperty(
id="id",
# the properties below are optional
account_id="accountId",
expression="expression",
label="label",
metric_stat=cloudwatch.CfnAlarm.MetricStatProperty(
metric=cloudwatch.CfnAlarm.MetricProperty(
dimensions=[cloudwatch.CfnAlarm.DimensionProperty(
name="name",
value="value"
)],
metric_name="metricName",
namespace="namespace"
),
period=123,
stat="stat",
# the properties below are optional
unit="unit"
),
period=123,
return_data=False
)],
namespace="namespace",
ok_actions=["okActions"],
period=123,
statistic="statistic",
tags=[CfnTag(
key="key",
value="value"
)],
threshold=123,
threshold_metric_id="thresholdMetricId",
treat_missing_data="treatMissingData",
unit="unit",
warm_up_configuration=cloudwatch.CfnAlarm.WarmUpConfigurationProperty(
only_start_evaluating_after_warm_up_period_ends=False,
warm_up_period_duration_in_minutes=123
)
)
// 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.*;
Object slidingWindow;
CfnAlarm cfnAlarm = CfnAlarm.Builder.create(this, "MyCfnAlarm")
.actionConfiguration(ActionConfigurationProperty.builder()
.alarmTagsPropagation(AlarmTagsPropagationProperty.builder()
.enabled(false)
// the properties below are optional
.excludedTagKeys(List.of("excludedTagKeys"))
.includedTagKeys(List.of("includedTagKeys"))
.build())
.build())
.actionsEnabled(false)
.alarmActions(List.of("alarmActions"))
.alarmDescription("alarmDescription")
.alarmName("alarmName")
.comparisonOperator("comparisonOperator")
.datapointsToAlarm(123)
.dimensions(List.of(DimensionProperty.builder()
.name("name")
.value("value")
.build()))
.evaluateLowSampleCountPercentile("evaluateLowSampleCountPercentile")
.evaluationCriteria(EvaluationCriteriaProperty.builder()
.promQlCriteria(AlarmPromQLCriteriaProperty.builder()
.pendingPeriod(123)
.query("query")
.recoveryPeriod(123)
.build())
.build())
.evaluationInterval(123)
.evaluationPeriods(123)
.evaluationWindow(EvaluationWindowProperty.builder()
.slidingWindow(slidingWindow)
.wallClockWindow(WallClockWindowProperty.builder()
.timezone("timezone")
.build())
.build())
.extendedStatistic("extendedStatistic")
.insufficientDataActions(List.of("insufficientDataActions"))
.metricName("metricName")
.metrics(List.of(MetricDataQueryProperty.builder()
.id("id")
// the properties below are optional
.accountId("accountId")
.expression("expression")
.label("label")
.metricStat(MetricStatProperty.builder()
.metric(MetricProperty.builder()
.dimensions(List.of(DimensionProperty.builder()
.name("name")
.value("value")
.build()))
.metricName("metricName")
.namespace("namespace")
.build())
.period(123)
.stat("stat")
// the properties below are optional
.unit("unit")
.build())
.period(123)
.returnData(false)
.build()))
.namespace("namespace")
.okActions(List.of("okActions"))
.period(123)
.statistic("statistic")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.threshold(123)
.thresholdMetricId("thresholdMetricId")
.treatMissingData("treatMissingData")
.unit("unit")
.warmUpConfiguration(WarmUpConfigurationProperty.builder()
.onlyStartEvaluatingAfterWarmUpPeriodEnds(false)
.warmUpPeriodDurationInMinutes(123)
.build())
.build();
// 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 slidingWindow;
var cfnAlarm = new CfnAlarm(this, "MyCfnAlarm", new CfnAlarmProps {
ActionConfiguration = new ActionConfigurationProperty {
AlarmTagsPropagation = new AlarmTagsPropagationProperty {
Enabled = false,
// the properties below are optional
ExcludedTagKeys = new [] { "excludedTagKeys" },
IncludedTagKeys = new [] { "includedTagKeys" }
}
},
ActionsEnabled = false,
AlarmActions = new [] { "alarmActions" },
AlarmDescription = "alarmDescription",
AlarmName = "alarmName",
ComparisonOperator = "comparisonOperator",
DatapointsToAlarm = 123,
Dimensions = new [] { new DimensionProperty {
Name = "name",
Value = "value"
} },
EvaluateLowSampleCountPercentile = "evaluateLowSampleCountPercentile",
EvaluationCriteria = new EvaluationCriteriaProperty {
PromQlCriteria = new AlarmPromQLCriteriaProperty {
PendingPeriod = 123,
Query = "query",
RecoveryPeriod = 123
}
},
EvaluationInterval = 123,
EvaluationPeriods = 123,
EvaluationWindow = new EvaluationWindowProperty {
SlidingWindow = slidingWindow,
WallClockWindow = new WallClockWindowProperty {
Timezone = "timezone"
}
},
ExtendedStatistic = "extendedStatistic",
InsufficientDataActions = new [] { "insufficientDataActions" },
MetricName = "metricName",
Metrics = new [] { new MetricDataQueryProperty {
Id = "id",
// the properties below are optional
AccountId = "accountId",
Expression = "expression",
Label = "label",
MetricStat = new MetricStatProperty {
Metric = new MetricProperty {
Dimensions = new [] { new DimensionProperty {
Name = "name",
Value = "value"
} },
MetricName = "metricName",
Namespace = "namespace"
},
Period = 123,
Stat = "stat",
// the properties below are optional
Unit = "unit"
},
Period = 123,
ReturnData = false
} },
Namespace = "namespace",
OkActions = new [] { "okActions" },
Period = 123,
Statistic = "statistic",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} },
Threshold = 123,
ThresholdMetricId = "thresholdMetricId",
TreatMissingData = "treatMissingData",
Unit = "unit",
WarmUpConfiguration = new WarmUpConfigurationProperty {
OnlyStartEvaluatingAfterWarmUpPeriodEnds = false,
WarmUpPeriodDurationInMinutes = 123
}
});
// 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 slidingWindow interface{}
cfnAlarm := awscdk.Aws_cloudwatch.NewCfnAlarm(this, jsii.String("MyCfnAlarm"), &CfnAlarmProps{
ActionConfiguration: &ActionConfigurationProperty{
AlarmTagsPropagation: &AlarmTagsPropagationProperty{
Enabled: jsii.Boolean(false),
// the properties below are optional
ExcludedTagKeys: []*string{
jsii.String("excludedTagKeys"),
},
IncludedTagKeys: []*string{
jsii.String("includedTagKeys"),
},
},
},
ActionsEnabled: jsii.Boolean(false),
AlarmActions: []interface{}{
jsii.String("alarmActions"),
},
AlarmDescription: jsii.String("alarmDescription"),
AlarmName: jsii.String("alarmName"),
ComparisonOperator: jsii.String("comparisonOperator"),
DatapointsToAlarm: jsii.Number(123),
Dimensions: []interface{}{
&DimensionProperty{
Name: jsii.String("name"),
Value: jsii.String("value"),
},
},
EvaluateLowSampleCountPercentile: jsii.String("evaluateLowSampleCountPercentile"),
EvaluationCriteria: &EvaluationCriteriaProperty{
PromQlCriteria: &AlarmPromQLCriteriaProperty{
PendingPeriod: jsii.Number(123),
Query: jsii.String("query"),
RecoveryPeriod: jsii.Number(123),
},
},
EvaluationInterval: jsii.Number(123),
EvaluationPeriods: jsii.Number(123),
EvaluationWindow: &EvaluationWindowProperty{
SlidingWindow: slidingWindow,
WallClockWindow: &WallClockWindowProperty{
Timezone: jsii.String("timezone"),
},
},
ExtendedStatistic: jsii.String("extendedStatistic"),
InsufficientDataActions: []interface{}{
jsii.String("insufficientDataActions"),
},
MetricName: jsii.String("metricName"),
Metrics: []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{
Dimensions: []interface{}{
&DimensionProperty{
Name: jsii.String("name"),
Value: jsii.String("value"),
},
},
MetricName: jsii.String("metricName"),
Namespace: jsii.String("namespace"),
},
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),
},
},
Namespace: jsii.String("namespace"),
OkActions: []interface{}{
jsii.String("okActions"),
},
Period: jsii.Number(123),
Statistic: jsii.String("statistic"),
Tags: []CfnTag{
&CfnTag{
Key: jsii.String("key"),
Value: jsii.String("value"),
},
},
Threshold: jsii.Number(123),
ThresholdMetricId: jsii.String("thresholdMetricId"),
TreatMissingData: jsii.String("treatMissingData"),
Unit: jsii.String("unit"),
WarmUpConfiguration: &WarmUpConfigurationProperty{
OnlyStartEvaluatingAfterWarmUpPeriodEnds: jsii.Boolean(false),
WarmUpPeriodDurationInMinutes: jsii.Number(123),
},
})
Initializer
new CfnAlarm(scope: Construct, id: string, props?: CfnAlarmProps)
CfnAlarm(scope: Construct, id: str, props: typing.Optional[CfnAlarmProps] = None)
new CfnAlarm(Construct scope, String id, CfnAlarmProps props)
new CfnAlarm(Construct scope, string id, CfnAlarmProps? props = null)
NewCfnAlarm(Scope Construct, Id *string, Props CfnAlarmProps)
Construct Props
actionConfigurationoptionalIResolvable | CfnAlarm.action_configurationoptionaltyping.Union[IResolvable, ActionConfigurationProperty]actionConfigurationoptionalIResolvableActionConfigurationoptionalIResolvableActionConfigurationoptionalinterface{} #actionsEnabledoptionalboolean | IResolvableactions_enabledoptionaltyping.Union[bool, IResolvable]actionsEnabledoptionalBooleanActionsEnabledoptionalboolActionsEnabledoptionalinterface{} = true #The default is TRUE.
alarmActionsoptionalstring | IScalingPolicyRef | ITopicRef[]alarm_actionsoptionaltyping.List[typing.Union[str, IScalingPolicyRef, ITopicRef]]alarmActionsoptionalList<String>AlarmActionsoptionalstring[]AlarmActionsoptional*[]interface{} #notes
Specify each action as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutMetricAlarm in the Amazon CloudWatch API Reference .
alarmDescriptionoptionalstringalarm_descriptionoptionalstralarmDescriptionoptionalStringAlarmDescriptionoptionalstringAlarmDescriptionoptional*string #alarmNameoptionalstringalarm_nameoptionalstralarmNameoptionalStringAlarmNameoptionalstringAlarmNameoptional*string #notes
If you don't specify a name, CloudFormation generates a unique physical ID and uses that ID for the alarm name.
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
comparisonOperatoroptionalstringcomparison_operatoroptionalstrcomparisonOperatoroptionalStringComparisonOperatoroptionalstringComparisonOperatoroptional*string #The specified statistic value is used as the first operand.
datapointsToAlarmoptionalnumberdatapoints_to_alarmoptionalint | floatdatapointsToAlarmoptionalNumberDatapointsToAlarmoptionaldoubleDatapointsToAlarmoptional*float64 #notes
This is used only if you are setting an "M out of N" alarm. In that case, this value is the M, and the value that you set for EvaluationPeriods is the N value. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide .
If you omit this parameter, CloudWatch uses the same value here that you set for EvaluationPeriods , and the alarm goes to alarm state if that many consecutive periods are breaching.
dimensionsoptionalIResolvable | IResolvable | CfnAlarm.DimensionProperty[]dimensionsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, DimensionProperty]]]dimensionsoptionalIResolvableDimensionsoptionalIResolvableDimensionsoptionalinterface{} #For an alarm based on a math expression, you can't specify Dimensions . Instead, you use Metrics .
evaluateLowSampleCountPercentileoptionalstringevaluate_low_sample_count_percentileoptionalstrevaluateLowSampleCountPercentileoptionalStringEvaluateLowSampleCountPercentileoptionalstringEvaluateLowSampleCountPercentileoptional*string #notes
If ignore , the alarm state does not change during periods with too few data points to be statistically significant. If evaluate or this parameter is not used, the alarm is always evaluated and possibly changes state no matter how many data points are available.
evaluationCriteriaoptionalIResolvable | CfnAlarm.evaluation_criteriaoptionaltyping.Union[IResolvable, EvaluationCriteriaProperty]evaluationCriteriaoptionalIResolvableEvaluationCriteriaoptionalIResolvableEvaluationCriteriaoptionalinterface{} #This is a union type that currently supports PromQLCriteria.
evaluationIntervaloptionalnumberevaluation_intervaloptionalint | floatevaluationIntervaloptionalNumberEvaluationIntervaloptionaldoubleEvaluationIntervaloptional*float64 #evaluationPeriodsoptionalnumberevaluation_periodsoptionalint | floatevaluationPeriodsoptionalNumberEvaluationPeriodsoptionaldoubleEvaluationPeriodsoptional*float64 #notes
If you are setting an alarm that requires that a number of consecutive data points be breaching to trigger the alarm, this value specifies that number. If you are setting an "M out of N" alarm, this value is the N, and DatapointsToAlarm is the M.
For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide .
evaluationWindowoptionalIResolvable | CfnAlarm.evaluation_windowoptionaltyping.Union[IResolvable, EvaluationWindowProperty]evaluationWindowoptionalIResolvableEvaluationWindowoptionalIResolvableEvaluationWindowoptionalinterface{} #notes
This is a union type. Set exactly one of its members, SlidingWindow or WallClockWindow. If you don't set EvaluationWindow, the alarm uses a SlidingWindow by default. For more information, see Alarm evaluation windows in the CloudWatch User Guide.
extendedStatisticoptionalstringextended_statisticoptionalstrextendedStatisticoptionalStringExtendedStatisticoptionalstringExtendedStatisticoptional*string #For an alarm based on a metric, you must specify either Statistic or ExtendedStatistic but not both.
For an alarm based on a math expression, you can't specify ExtendedStatistic . Instead, you use Metrics .
insufficientDataActionsoptionalstring | ITopicRef[]insufficient_data_actionsoptionaltyping.List[typing.Union[str, ITopicRef]]insufficientDataActionsoptionalList<String>InsufficientDataActionsoptionalstring[]InsufficientDataActionsoptional*[]interface{} #Each action is specified as an Amazon Resource Name (ARN).
metricNameoptionalstringmetric_nameoptionalstrmetricNameoptionalStringMetricNameoptionalstringMetricNameoptional*string #This is required for an alarm based on a metric. For an alarm based on a math expression, you use Metrics instead and you can't specify MetricName .
metricsoptionalIResolvable | IResolvable | CfnAlarm.MetricDataQueryProperty[]metricsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricDataQueryProperty]]]metricsoptionalIResolvableMetricsoptionalIResolvableMetricsoptionalinterface{} #notes
Each item in the array either retrieves a metric or performs a math expression.
If you specify the Metrics parameter, you cannot specify MetricName , Dimensions , Period , Namespace , Statistic , ExtendedStatistic , or Unit .
namespaceoptionalstringnamespaceoptionalstrnamespaceoptionalStringNamespaceoptionalstringNamespaceoptional*string #notes
This is required for an alarm based on a metric. For an alarm based on a math expression, you can't specify Namespace and you use Metrics instead.
For a list of namespaces for metrics from AWS services, see AWS Services That Publish CloudWatch Metrics.
okActionsoptionalstring | ITopicRef[]ok_actionsoptionaltyping.List[typing.Union[str, ITopicRef]]okActionsoptionalList<String>OkActionsoptionalstring[]OkActionsoptional*[]interface{} #Each action is specified as an Amazon Resource Name (ARN).
periodoptionalnumberperiodoptionalint | floatperiodoptionalNumberPeriodoptionaldoublePeriodoptional*float64 #This is required for an alarm based on a metric. Valid values are 10, 20, 30, 60, and any multiple of 60.
For an alarm based on a math expression, you can't specify Period , and instead you use the Metrics parameter.
Minimum: 10
statisticoptionalstringstatisticoptionalstrstatisticoptionalStringStatisticoptionalstringStatisticoptional*string #For an alarm based on a metric, you must specify either Statistic or ExtendedStatistic but not both.
For an alarm based on a math expression, you can't specify Statistic . Instead, you use Metrics .
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #notes
You can associate as many as 50 tags with an alarm. To be able to associate tags with the alarm when you create the alarm, you must have the cloudwatch:TagResource permission.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.
thresholdoptionalnumberthresholdoptionalint | floatthresholdoptionalNumberThresholdoptionaldoubleThresholdoptional*float64 #thresholdMetricIdoptionalstringthreshold_metric_idoptionalstrthresholdMetricIdoptionalStringThresholdMetricIdoptionalstringThresholdMetricIdoptional*string #treatMissingDataoptionalstringtreat_missing_dataoptionalstrtreatMissingDataoptionalStringTreatMissingDataoptionalstringTreatMissingDataoptional*string #notes
Valid values are breaching , notBreaching , ignore , and missing . For more information, see Configuring How CloudWatch Alarms Treat Missing Data in the Amazon CloudWatch User Guide .
If you omit this parameter, the default behavior of missing is used.
notes
Specify this only if you are creating an alarm based on a single metric. Do not specify this if you are specifying a Metrics array.
You can specify the following values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, or None.
warmUpConfigurationoptionalIResolvable | CfnAlarm.warm_up_configurationoptionaltyping.Union[IResolvable, WarmUpConfigurationProperty]warmUpConfigurationoptionalIResolvableWarmUpConfigurationoptionalIResolvableWarmUpConfigurationoptionalinterface{} #notes
Use these settings to delay alarm evaluation after you create or update the alarm, which reduces alarm noise while a new resource or service starts publishing data. During the warm-up period, the alarm stays in INSUFFICIENT_DATA and does not perform alarm actions.
Properties
actionConfigurationmay be undefinedIResolvable | CfnAlarm.action_configurationmay be undefinedtyping.Union[IResolvable, ActionConfigurationProperty]actionConfigurationmay be undefinedIResolvableActionConfigurationmay be undefinedIResolvableActionConfigurationmay be undefinedinterface{} #actionsEnabledmay be undefinedboolean | IResolvableactions_enabledmay be undefinedtyping.Union[bool, IResolvable]actionsEnabledmay be undefinedBooleanActionsEnabledmay be undefinedboolActionsEnabledmay be undefinedinterface{} #alarmActionsmay be undefinedstring[]alarm_actionsmay be undefinedtyping.List[str]alarmActionsmay be undefinedList<String>AlarmActionsmay be undefinedstring[]AlarmActionsmay be undefined*[]*string #alarmDescriptionmay be undefinedstringalarm_descriptionmay be undefinedstralarmDescriptionmay be undefinedStringAlarmDescriptionmay be undefinedstringAlarmDescriptionmay be undefined*string #alarmNamemay be undefinedstringalarm_namemay be undefinedstralarmNamemay be undefinedStringAlarmNamemay be undefinedstringAlarmNamemay be undefined*string #alarmRefAlarmReferencealarm_refAlarmReferencealarmRefAlarmReferenceAlarmRefAlarmReferenceAlarmRefAlarmReference #cdkTagManagerTagManagercdk_tag_managerTagManagercdkTagManagerTagManagerCdkTagManagerTagManagerCdkTagManagerTagManager #CFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAMEstrCFN_RESOURCE_TYPE_NAMEStringCFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAME*string static #cfnOptionsICfnResourceOptionscfn_optionsICfnResourceOptionscfnOptionsICfnResourceOptionsCfnOptionsICfnResourceOptionsCfnOptionsICfnResourceOptions #cfnResourceTypestringcfn_resource_typestrcfnResourceTypeStringCfnResourceTypestringCfnResourceType*string #comparisonOperatormay be undefinedstringcomparison_operatormay be undefinedstrcomparisonOperatormay be undefinedStringComparisonOperatormay be undefinedstringComparisonOperatormay be undefined*string #creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*string #datapointsToAlarmmay be undefinednumberdatapoints_to_alarmmay be undefinedint | floatdatapointsToAlarmmay be undefinedNumberDatapointsToAlarmmay be undefineddoubleDatapointsToAlarmmay be undefined*float64 #dimensionsmay be undefinedIResolvable | IResolvable | CfnAlarm.DimensionProperty[]dimensionsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, DimensionProperty]]]dimensionsmay be undefinedIResolvableDimensionsmay be undefinedIResolvableDimensionsmay be undefinedinterface{} #evaluateLowSampleCountPercentilemay be undefinedstringevaluate_low_sample_count_percentilemay be undefinedstrevaluateLowSampleCountPercentilemay be undefinedStringEvaluateLowSampleCountPercentilemay be undefinedstringEvaluateLowSampleCountPercentilemay be undefined*string #evaluationCriteriamay be undefinedIResolvable | CfnAlarm.evaluation_criteriamay be undefinedtyping.Union[IResolvable, EvaluationCriteriaProperty]evaluationCriteriamay be undefinedIResolvableEvaluationCriteriamay be undefinedIResolvableEvaluationCriteriamay be undefinedinterface{} #evaluationIntervalmay be undefinednumberevaluation_intervalmay be undefinedint | floatevaluationIntervalmay be undefinedNumberEvaluationIntervalmay be undefineddoubleEvaluationIntervalmay be undefined*float64 #evaluationPeriodsmay be undefinednumberevaluation_periodsmay be undefinedint | floatevaluationPeriodsmay be undefinedNumberEvaluationPeriodsmay be undefineddoubleEvaluationPeriodsmay be undefined*float64 #evaluationWindowmay be undefinedIResolvable | CfnAlarm.evaluation_windowmay be undefinedtyping.Union[IResolvable, EvaluationWindowProperty]evaluationWindowmay be undefinedIResolvableEvaluationWindowmay be undefinedIResolvableEvaluationWindowmay be undefinedinterface{} #extendedStatisticmay be undefinedstringextended_statisticmay be undefinedstrextendedStatisticmay be undefinedStringExtendedStatisticmay be undefinedstringExtendedStatisticmay be undefined*string #Specify a value between p0.0 and p100.
insufficientDataActionsmay be undefinedstring[]insufficient_data_actionsmay be undefinedtyping.List[str]insufficientDataActionsmay be undefinedList<String>InsufficientDataActionsmay be undefinedstring[]InsufficientDataActionsmay be undefined*[]*string #The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId).
metricNamemay be undefinedstringmetric_namemay be undefinedstrmetricNamemay be undefinedStringMetricNamemay be undefinedstringMetricNamemay be undefined*string #metricsmay be undefinedIResolvable | IResolvable | CfnAlarm.MetricDataQueryProperty[]metricsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricDataQueryProperty]]]metricsmay be undefinedIResolvableMetricsmay be undefinedIResolvableMetricsmay be undefinedinterface{} #namespacemay be undefinedstringnamespacemay be undefinedstrnamespacemay be undefinedStringNamespacemay be undefinedstringNamespacemay be undefined*string #okActionsmay be undefinedstring[]ok_actionsmay be undefinedtyping.List[str]okActionsmay be undefinedList<String>OkActionsmay be undefinedstring[]OkActionsmay be undefined*[]*string #periodmay be undefinednumberperiodmay be undefinedint | floatperiodmay be undefinedNumberPeriodmay be undefineddoublePeriodmay be undefined*float64 #If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).
CfnElements must be defined within a stack scope (directly or indirectly).
statisticmay be undefinedstringstatisticmay be undefinedstrstatisticmay be undefinedStringStatisticmay be undefinedstringStatisticmay be undefined*string #For percentile statistics, use ExtendedStatistic .
tagsmay be undefinedCfnTag[]tagsmay be undefinedtyping.List[CfnTag]tagsmay be undefinedList<CfnTag>Tagsmay be undefinedCfnTag[]Tagsmay be undefined*[]CfnTag #thresholdmay be undefinednumberthresholdmay be undefinedint | floatthresholdmay be undefinedNumberThresholdmay be undefineddoubleThresholdmay be undefined*float64 #thresholdMetricIdmay be undefinedstringthreshold_metric_idmay be undefinedstrthresholdMetricIdmay be undefinedStringThresholdMetricIdmay be undefinedstringThresholdMetricIdmay be undefined*string #treatMissingDatamay be undefinedstringtreat_missing_datamay be undefinedstrtreatMissingDatamay be undefinedStringTreatMissingDatamay be undefinedstringTreatMissingDatamay be undefined*string #unitmay be undefinedstringunitmay be undefinedstrunitmay be undefinedStringUnitmay be undefinedstringUnitmay be undefined*string #warmUpConfigurationmay be undefinedIResolvable | CfnAlarm.warm_up_configurationmay be undefinedtyping.Union[IResolvable, WarmUpConfigurationProperty]warmUpConfigurationmay be undefinedIResolvableWarmUpConfigurationmay be undefinedIResolvableWarmUpConfigurationmay be undefinedinterface{} #Methods
addDeletionOverride(path: string): voiddef add_deletion_override(self, path: str) -> Nonepublic void addDeletionOverride(String path)public void AddDeletionOverride(string path)func AddDeletionOverride(Path *string) #1 parameter
Parameters
pathpathpathpathPath— The path of the value to delete.
addDependency(target: CfnResource): voiddef add_dependency(self, target: CfnResource) -> Nonepublic void addDependency(CfnResource target)public void AddDependency(CfnResource target)func AddDependency(Target CfnResource) deprecated #This method has been renamed to addResourceDependency to more clearly set it apart from construct.node.addDependency. See the documentation of that function for more details.
addDependsOn(target: CfnResource): voiddef add_depends_on(self, target: CfnResource) -> Nonepublic void addDependsOn(CfnResource target)public void AddDependsOn(CfnResource target)func AddDependsOn(Target CfnResource) deprecated #notes
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
This method has been renamed to addResourceDependency, which makes it more clear that this method operates at a different level from the construct-level construct.node.addDependency() mechanism.
addMetadata(key: string, value: any): voiddef add_metadata(self, key: str, value: Any) -> Nonepublic void addMetadata(String key, Object value)public void AddMetadata(string key, object value)func AddMetadata(Key *string, Value interface{}) #addOverride(path: string, value: any): voiddef add_override(self, path: str, value: Any) -> Nonepublic void addOverride(String path, Object value)public void AddOverride(string path, object value)func AddOverride(Path *string, Value interface{}) #notes · 2 parameters
To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).
If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.
For example,
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
would add the overrides
"Properties": {
"GlobalSecondaryIndexes": [
{
"Projection": {
"NonKeyAttributes": [ "myattribute" ]
...
}
...
},
{
"ProjectionType": "INCLUDE"
...
},
]
...
}
The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.
Parameters
pathpathpathpathPath— - The path of the property, you can use dot notation to override values in complex types.valuevaluevaluevalueValue— - The value.
addPropertyDeletionOverride(propertyPath: string): voiddef add_property_deletion_override(self, property_path: str) -> Nonepublic void addPropertyDeletionOverride(String propertyPath)public void AddPropertyDeletionOverride(string propertyPath)func AddPropertyDeletionOverride(PropertyPath *string) #1 parameter
Parameters
propertyPathproperty_pathpropertyPathpropertyPathPropertyPath— The path to the property.
addPropertyOverride(propertyPath: string, value: any): voiddef add_property_override(self, property_path: str, value: Any) -> Nonepublic void addPropertyOverride(String propertyPath, Object value)public void AddPropertyOverride(string propertyPath, object value)func AddPropertyOverride(PropertyPath *string, Value interface{}) #Syntactic sugar for addOverride("Properties.<...>", value).
2 parameters
Parameters
propertyPathproperty_pathpropertyPathpropertyPathPropertyPath— The path of the property.valuevaluevaluevalueValue— The value.
addResourceDependency(target: CfnResource, reason?: string): voiddef add_resource_dependency(self, target: CfnResource, reason: typing.Optional[str] = None) -> Nonepublic void addResourceDependency(CfnResource target, String reason)public void AddResourceDependency(CfnResource target, string? reason = null)func AddResourceDependency(Target CfnResource, Reason *string) #notes
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
This method only adds dependencies between L1 resources. If you are looking for a generic construct-to-construct dependency mechanism that works for all constructs including L2s, use construct.node.addDependency instead.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength) #When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.
1 parameter
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): voiddef apply_removal_policy(self, policy: typing.Optional[RemovalPolicy] = None, options: typing.Optional[RemovalPolicyOptions] = None) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy, RemovalPolicyOptions options)public void ApplyRemovalPolicy(RemovalPolicy? policy = null, RemovalPolicyOptions? options = null)func ApplyRemovalPolicy(Policy RemovalPolicy, Options RemovalPolicyOptions) #notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:
cfnPropertyName(cdkPropertyName: string): stringdef cfn_property_name(self, cdk_property_name: str) -> strpublic String cfnPropertyName(String cdkPropertyName)public string CfnPropertyName(string cdkPropertyName)func CfnPropertyName(CdkPropertyName *string) *string #fromAlarmArn(scope: Construct, id: string, arn: string): IAlarmRef@staticmethod def from_alarm_arn(scope: Construct, id: str, arn: str) -> IAlarmRefpublic static IAlarmRef fromAlarmArn(Construct scope, String id, String arn)public static IAlarmRef FromAlarmArn(Construct scope, string id, string arn)func FromAlarmArn(Scope Construct, Id *string, Arn *string) IAlarmRef static #fromAlarmName(scope: Construct, id: string, alarmName: string): IAlarmRef@staticmethod def from_alarm_name(scope: Construct, id: str, alarm_name: str) -> IAlarmRefpublic static IAlarmRef fromAlarmName(Construct scope, String id, String alarmName)public static IAlarmRef FromAlarmName(Construct scope, string id, string alarmName)func FromAlarmName(Scope Construct, Id *string, AlarmName *string) IAlarmRef static #getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Referencedef get_att(self, attribute_name: str, type_hint: typing.Optional[ResolutionTypeHint] = None) -> Referencepublic Reference getAtt(String attributeName, ResolutionTypeHint typeHint)public Reference GetAtt(string attributeName, ResolutionTypeHint? typeHint = null)func GetAtt(AttributeName *string, TypeHint ResolutionTypeHint) Reference #Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.
1 parameter
Parameters
attributeNameattribute_nameattributeNameattributeNameAttributeName— The name of the attribute.
getMetadata(key: string): anydef get_metadata(self, key: str) -> Anypublic Object getMetadata(String key)public object GetMetadata(string key)func GetMetadata(Key *string) interface{} #inspect(inspector: TreeInspector): voiddef inspect(self, inspector: TreeInspector) -> Nonepublic void inspect(TreeInspector inspector)public void Inspect(TreeInspector inspector)func Inspect(Inspector TreeInspector) #1 parameter
Parameters
inspectorinspectorinspectorinspectorInspector— tree inspector to collect and process attributes.
isCfnAlarm(x: any): boolean@staticmethod def is_cfn_alarm(x: Any) -> boolpublic static Boolean isCfnAlarm(Object x)public static bool IsCfnAlarm(object x)func IsCfnAlarm(X interface{}) *bool static #isCfnElement(x: any): boolean@staticmethod def is_cfn_element(x: Any) -> boolpublic static Boolean isCfnElement(Object x)public static bool IsCfnElement(object x)func IsCfnElement(X interface{}) *bool static #Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.
returns
Returns: The construct as a stack element or undefined if it is not a stack element.
isCfnResource(x: any): boolean@staticmethod def is_cfn_resource(x: Any) -> boolpublic static Boolean isCfnResource(Object x)public static bool IsCfnResource(object x)func IsCfnResource(X interface{}) *bool static #isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *bool static #notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
obtainDependencies(): Stack | CfnResource[]def obtain_dependencies(self, ) -> typing.List[typing.Union[Stack, CfnResource]]public List<Stack> obtainDependencies()public Stack[] ObtainDependencies()func ObtainDependencies() *[]interface{} #For resources depended on directly, returns the CfnResource object. For dependencies on other stacks, returns the Stack object. The order of the array is not guaranteed.
overrideLogicalId(newLogicalId: string): voiddef override_logical_id(self, new_logical_id: str) -> Nonepublic void overrideLogicalId(String newLogicalId)public void OverrideLogicalId(string newLogicalId)func OverrideLogicalId(NewLogicalId *string) #1 parameter
Parameters
newLogicalIdnew_logical_idnewLogicalIdnewLogicalIdNewLogicalId— The new logical ID to use for this stack element.
removeDependency(target: CfnResource): voiddef remove_dependency(self, target: CfnResource) -> Nonepublic void removeDependency(CfnResource target)public void RemoveDependency(CfnResource target)func RemoveDependency(Target CfnResource) deprecated #This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
removeResourceDependency(target: CfnResource): voiddef remove_resource_dependency(self, target: CfnResource) -> Nonepublic void removeResourceDependency(CfnResource target)public void RemoveResourceDependency(CfnResource target)func RemoveResourceDependency(Target CfnResource) #This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
replaceDependency(target: CfnResource, newTarget: CfnResource): voiddef replace_dependency(self, target: CfnResource, new_target: CfnResource) -> Nonepublic void replaceDependency(CfnResource target, CfnResource newTarget)public void ReplaceDependency(CfnResource target, CfnResource newTarget)func ReplaceDependency(Target CfnResource, NewTarget CfnResource) #2 parameters
Parameters
targettargettargettargetTarget— The dependency to replace.newTargetnew_targetnewTargetnewTargetNewTarget— The new dependency to add.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #returns
Returns: a string representation of this resource
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct #Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.