DeploymentAlarmOptions
- class aws_cdk.aws_ecs.DeploymentAlarmOptions(*, behavior=None)
Bases:
object
Options for deployment alarms.
- Parameters:
behavior (
Optional
[AlarmBehavior
]) – Default rollback on alarm. Default: AlarmBehavior.ROLLBACK_ON_ALARM- ExampleMetadata:
infused
Example:
import aws_cdk.aws_cloudwatch as cw # cluster: ecs.Cluster # task_definition: ecs.TaskDefinition # elb_alarm: cw.Alarm service = ecs.FargateService(self, "Service", cluster=cluster, task_definition=task_definition, deployment_alarms=ecs.DeploymentAlarmConfig( alarm_names=[elb_alarm.alarm_name], behavior=ecs.AlarmBehavior.ROLLBACK_ON_ALARM ) ) # Defining a deployment alarm after the service has been created cpu_alarm_name = "MyCpuMetricAlarm" cw.Alarm(self, "CPUAlarm", alarm_name=cpu_alarm_name, metric=service.metric_cpu_utilization(), evaluation_periods=2, threshold=80 ) service.enable_deployment_alarms([cpu_alarm_name], behavior=ecs.AlarmBehavior.FAIL_ON_ALARM )
Attributes
- behavior
Default rollback on alarm.
- Default:
AlarmBehavior.ROLLBACK_ON_ALARM