Interface IDeploymentAlarmConfig
Configuration for deployment alarms.
Inherited Members
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IDeploymentAlarmConfig : IDeploymentAlarmOptions
Syntax (vb)
Public Interface IDeploymentAlarmConfig
Inherits IDeploymentAlarmOptions
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.CloudWatch;
Cluster cluster;
TaskDefinition taskDefinition;
Alarm elbAlarm;
var service = new FargateService(this, "Service", new FargateServiceProps {
Cluster = cluster,
TaskDefinition = taskDefinition,
DeploymentAlarms = new DeploymentAlarmConfig {
AlarmNames = new [] { elbAlarm.AlarmName },
Behavior = AlarmBehavior.ROLLBACK_ON_ALARM
}
});
// Defining a deployment alarm after the service has been created
var cpuAlarmName = "MyCpuMetricAlarm";
new Alarm(this, "CPUAlarm", new AlarmProps {
AlarmName = cpuAlarmName,
Metric = service.MetricCpuUtilization(),
EvaluationPeriods = 2,
Threshold = 80
});
service.EnableDeploymentAlarms(new [] { cpuAlarmName }, new DeploymentAlarmOptions {
Behavior = AlarmBehavior.FAIL_ON_ALARM
});
Synopsis
Properties
AlarmNames | List of alarm names to monitor during deployments. |
Properties
AlarmNames
List of alarm names to monitor during deployments.
string[] AlarmNames { get; }
Property Value
System.String[]