Class HttpCodeTarget
Count of HTTP status originating from the targets.
Inheritance
System.Object
HttpCodeTarget
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public sealed class HttpCodeTarget : Enum
Syntax (vb)
Public NotInheritable Class HttpCodeTarget
Inherits
Enum
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.CloudWatch;
FargateService service;
ApplicationTargetGroup blueTargetGroup;
ApplicationTargetGroup greenTargetGroup;
IApplicationListener listener;
// Alarm on the number of unhealthy ECS tasks in each target group
var blueUnhealthyHosts = new Alarm(this, "BlueUnhealthyHosts", new AlarmProps {
AlarmName = Stack.Of(this).StackName + "-Unhealthy-Hosts-Blue",
Metric = blueTargetGroup.MetricUnhealthyHostCount(),
Threshold = 1,
EvaluationPeriods = 2
});
var greenUnhealthyHosts = new Alarm(this, "GreenUnhealthyHosts", new AlarmProps {
AlarmName = Stack.Of(this).StackName + "-Unhealthy-Hosts-Green",
Metric = greenTargetGroup.MetricUnhealthyHostCount(),
Threshold = 1,
EvaluationPeriods = 2
});
// Alarm on the number of HTTP 5xx responses returned by each target group
var blueApiFailure = new Alarm(this, "Blue5xx", new AlarmProps {
AlarmName = Stack.Of(this).StackName + "-Http-5xx-Blue",
Metric = blueTargetGroup.MetricHttpCodeTarget(HttpCodeTarget.TARGET_5XX_COUNT, new MetricOptions { Period = Duration.Minutes(1) }),
Threshold = 1,
EvaluationPeriods = 1
});
var greenApiFailure = new Alarm(this, "Green5xx", new AlarmProps {
AlarmName = Stack.Of(this).StackName + "-Http-5xx-Green",
Metric = greenTargetGroup.MetricHttpCodeTarget(HttpCodeTarget.TARGET_5XX_COUNT, new MetricOptions { Period = Duration.Minutes(1) }),
Threshold = 1,
EvaluationPeriods = 1
});
new EcsDeploymentGroup(this, "BlueGreenDG", new EcsDeploymentGroupProps {
// CodeDeploy will monitor these alarms during a deployment and automatically roll back
Alarms = new [] { blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure },
AutoRollback = new AutoRollbackConfig {
// CodeDeploy will automatically roll back if a deployment is stopped
StoppedDeployment = true
},
Service = service,
BlueGreenDeploymentConfig = new EcsBlueGreenDeploymentConfig {
BlueTargetGroup = blueTargetGroup,
GreenTargetGroup = greenTargetGroup,
Listener = listener
},
DeploymentConfig = EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES
});
Synopsis
Fields
TARGET_2XX_COUNT | The number of 2xx response codes from targets. |
TARGET_3XX_COUNT | The number of 3xx response codes from targets. |
TARGET_4XX_COUNT | The number of 4xx response codes from targets. |
TARGET_5XX_COUNT | The number of 5xx response codes from targets. |
value__ |
Fields
TARGET_2XX_COUNT
The number of 2xx response codes from targets.
public const HttpCodeTarget TARGET_2XX_COUNT
Field Value
Type | Description |
---|---|
HttpCodeTarget |
TARGET_3XX_COUNT
The number of 3xx response codes from targets.
public const HttpCodeTarget TARGET_3XX_COUNT
Field Value
Type | Description |
---|---|
HttpCodeTarget |
TARGET_4XX_COUNT
The number of 4xx response codes from targets.
public const HttpCodeTarget TARGET_4XX_COUNT
Field Value
Type | Description |
---|---|
HttpCodeTarget |
TARGET_5XX_COUNT
The number of 5xx response codes from targets.
public const HttpCodeTarget TARGET_5XX_COUNT
Field Value
Type | Description |
---|---|
HttpCodeTarget |
value__
public int value__
Field Value
Type | Description |
---|---|
System.Int32 |