interface DeploymentAlarmOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ECS.DeploymentAlarmOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#DeploymentAlarmOptions |
Java | software.amazon.awscdk.services.ecs.DeploymentAlarmOptions |
Python | aws_cdk.aws_ecs.DeploymentAlarmOptions |
TypeScript (source) | aws-cdk-lib » aws_ecs » DeploymentAlarmOptions |
Options for deployment alarms.
Example
import * as cw from 'aws-cdk-lib/aws-cloudwatch';
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const elbAlarm: cw.Alarm;
const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
minHealthyPercent: 100,
deploymentAlarms: {
alarmNames: [elbAlarm.alarmName],
behavior: ecs.AlarmBehavior.ROLLBACK_ON_ALARM,
},
});
// Defining a deployment alarm after the service has been created
const cpuAlarmName = 'MyCpuMetricAlarm';
new cw.Alarm(this, 'CPUAlarm', {
alarmName: cpuAlarmName,
metric: service.metricCpuUtilization(),
evaluationPeriods: 2,
threshold: 80,
});
service.enableDeploymentAlarms([cpuAlarmName], {
behavior: ecs.AlarmBehavior.FAIL_ON_ALARM,
});
Properties
| Name | Type | Description |
|---|---|---|
| behavior? | Alarm | Default rollback on alarm. |
behavior?
Type:
Alarm
(optional, default: AlarmBehavior.ROLLBACK_ON_ALARM)
Default rollback on alarm.

.NET
Go
Java
Python
TypeScript (