08. Adding Target Groups and Listeners
ND9991 C2 L04 A05.2 No Title
The following is the required syntax for TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckEnabled: Boolean
HealthCheckIntervalSeconds: Integer
HealthCheckPath: String
HealthCheckPort: String
HealthCheckProtocol: String
HealthCheckTimeoutSeconds: Integer
HealthyThresholdCount: Integer
Matcher:
Matcher
Name: String
Port: Integer
Protocol: String
Tags:
- Tag
TargetGroupAttributes:
- TargetGroupAttribute
TargetType: String
Targets:
- TargetDescription
UnhealthyThresholdCount: Integer
VpcId: String
Health Checks are the requests your Application Load Balancersends to its registered targets. These periodic requests test the status of these targets. You can see us defining our Health Check properties in the example below:
WebAppTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckIntervalSeconds: 35
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 30
HealthyThresholdCount: 2
Port: 80
Protocol: HTTP
UnhealthyThresholdCount: 5
VpcId:
Fn::ImportValue:
Fn::Sub: "${EnvironmentName}-VPCID"
In the above example we specify the following:
- The port where our targets receive traffic -
Port: 80 - The protocol the load balancer uses when performing health checks on targets -
HealthCheckProtocol: HTTP - The time it takes to determine a non-responsive target is unhealthy -
HealthCheckIntervalSeconds: 35 - The number of healthy/unhealthy checks required to change the health status -
HealthyThresholdCount: 2UnhealthyThresholdCount: 5