@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.099Z") @Stability(value=Stable) public class CfnTargetGroup extends CfnResource implements IInspectable
Specifies a target group for an Application Load Balancer, a Network Load Balancer, or a Gateway Load Balancer.
If the protocol of the target group is TCP, TLS, UDP, or TCP_UDP, you can't modify the health check protocol, interval, timeout, or success codes.
Before you register a Lambda function as a target, you must create a AWS::Lambda::Permission resource that grants the Elastic Load Balancing service principal permission to invoke the Lambda function.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticloadbalancingv2.*;
CfnTargetGroup cfnTargetGroup = CfnTargetGroup.Builder.create(this, "MyCfnTargetGroup")
.healthCheckEnabled(false)
.healthCheckIntervalSeconds(123)
.healthCheckPath("healthCheckPath")
.healthCheckPort("healthCheckPort")
.healthCheckProtocol("healthCheckProtocol")
.healthCheckTimeoutSeconds(123)
.healthyThresholdCount(123)
.ipAddressType("ipAddressType")
.matcher(MatcherProperty.builder()
.grpcCode("grpcCode")
.httpCode("httpCode")
.build())
.name("name")
.port(123)
.protocol("protocol")
.protocolVersion("protocolVersion")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.targetGroupAttributes(List.of(TargetGroupAttributeProperty.builder()
.key("key")
.value("value")
.build()))
.targets(List.of(TargetDescriptionProperty.builder()
.id("id")
// the properties below are optional
.availabilityZone("availabilityZone")
.port(123)
.build()))
.targetType("targetType")
.unhealthyThresholdCount(123)
.vpcId("vpcId")
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnTargetGroup.Builder
A fluent builder for
CfnTargetGroup. |
static interface |
CfnTargetGroup.MatcherProperty
Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check.
|
static interface |
CfnTargetGroup.TargetDescriptionProperty
Specifies a target to add to a target group.
|
static interface |
CfnTargetGroup.TargetGroupAttributeProperty
Specifies a target group attribute.
|
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnTargetGroup(software.constructs.Construct scope,
String id)
Create a new `AWS::ElasticLoadBalancingV2::TargetGroup`.
|
|
CfnTargetGroup(software.constructs.Construct scope,
String id,
CfnTargetGroupProps props)
Create a new `AWS::ElasticLoadBalancingV2::TargetGroup`.
|
protected |
CfnTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnTargetGroup(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getAttrLoadBalancerArns()
The Amazon Resource Names (ARNs) of the load balancers that route traffic to this target group.
|
String |
getAttrTargetGroupFullName()
The full name of the target group.
|
String |
getAttrTargetGroupName()
The name of the target group.
|
protected Map<String,Object> |
getCfnProperties() |
Object |
getHealthCheckEnabled()
Indicates whether health checks are enabled.
|
Number |
getHealthCheckIntervalSeconds()
The approximate amount of time, in seconds, between health checks of an individual target.
|
String |
getHealthCheckPath()
[HTTP/HTTPS health checks] The destination for health checks on the targets.
|
String |
getHealthCheckPort()
The port the load balancer uses when performing health checks on targets.
|
String |
getHealthCheckProtocol()
The protocol the load balancer uses when performing health checks on targets.
|
Number |
getHealthCheckTimeoutSeconds()
The amount of time, in seconds, during which no response from a target means a failed health check.
|
Number |
getHealthyThresholdCount()
The number of consecutive health checks successes required before considering an unhealthy target healthy.
|
String |
getIpAddressType()
The type of IP address used for this target group.
|
Object |
getMatcher()
[HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.
|
String |
getName()
The name of the target group.
|
Number |
getPort()
The port on which the targets receive traffic.
|
String |
getProtocol()
The protocol to use for routing traffic to the targets.
|
String |
getProtocolVersion()
[HTTP/HTTPS protocol] The protocol version.
|
TagManager |
getTags()
The tags.
|
Object |
getTargetGroupAttributes()
The attributes.
|
Object |
getTargets()
The targets.
|
String |
getTargetType()
The type of target that you must specify when registering targets with this target group.
|
Number |
getUnhealthyThresholdCount()
The number of consecutive health check failures required before considering a target unhealthy.
|
String |
getVpcId()
The identifier of the virtual private cloud (VPC).
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setHealthCheckEnabled(Boolean value)
Indicates whether health checks are enabled.
|
void |
setHealthCheckEnabled(IResolvable value)
Indicates whether health checks are enabled.
|
void |
setHealthCheckIntervalSeconds(Number value)
The approximate amount of time, in seconds, between health checks of an individual target.
|
void |
setHealthCheckPath(String value)
[HTTP/HTTPS health checks] The destination for health checks on the targets.
|
void |
setHealthCheckPort(String value)
The port the load balancer uses when performing health checks on targets.
|
void |
setHealthCheckProtocol(String value)
The protocol the load balancer uses when performing health checks on targets.
|
void |
setHealthCheckTimeoutSeconds(Number value)
The amount of time, in seconds, during which no response from a target means a failed health check.
|
void |
setHealthyThresholdCount(Number value)
The number of consecutive health checks successes required before considering an unhealthy target healthy.
|
void |
setIpAddressType(String value)
The type of IP address used for this target group.
|
void |
setMatcher(CfnTargetGroup.MatcherProperty value)
[HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.
|
void |
setMatcher(IResolvable value)
[HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.
|
void |
setName(String value)
The name of the target group.
|
void |
setPort(Number value)
The port on which the targets receive traffic.
|
void |
setProtocol(String value)
The protocol to use for routing traffic to the targets.
|
void |
setProtocolVersion(String value)
[HTTP/HTTPS protocol] The protocol version.
|
void |
setTargetGroupAttributes(IResolvable value)
The attributes.
|
void |
setTargetGroupAttributes(List<Object> value)
The attributes.
|
void |
setTargets(IResolvable value)
The targets.
|
void |
setTargets(List<Object> value)
The targets.
|
void |
setTargetType(String value)
The type of target that you must specify when registering targets with this target group.
|
void |
setUnhealthyThresholdCount(Number value)
The number of consecutive health check failures required before considering a target unhealthy.
|
void |
setVpcId(String value)
The identifier of the virtual private cloud (VPC).
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnTargetGroup(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnTargetGroup(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
CfnTargetGroupProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties.@Stability(value=Stable)
public CfnTargetGroup(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public List<String> getAttrLoadBalancerArns()
@Stability(value=Stable) @NotNull public String getAttrTargetGroupFullName()
For example, targetgroup/my-target-group/cbf133c568e0d028 .
@Stability(value=Stable) @NotNull public String getAttrTargetGroupName()
For example, my-target-group .
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public TagManager getTags()
@Stability(value=Stable) @Nullable public Object getHealthCheckEnabled()
If the target type is lambda , health checks are disabled by default but can be enabled. If the target type is instance , ip , or alb , health checks are always enabled and cannot be disabled.
@Stability(value=Stable)
public void setHealthCheckEnabled(@Nullable
Boolean value)
If the target type is lambda , health checks are disabled by default but can be enabled. If the target type is instance , ip , or alb , health checks are always enabled and cannot be disabled.
@Stability(value=Stable)
public void setHealthCheckEnabled(@Nullable
IResolvable value)
If the target type is lambda , health checks are disabled by default but can be enabled. If the target type is instance , ip , or alb , health checks are always enabled and cannot be disabled.
@Stability(value=Stable) @Nullable public Number getHealthCheckIntervalSeconds()
If the target group protocol is HTTP or HTTPS, the default is 30 seconds. If the target group protocol is TCP, TLS, UDP, or TCP_UDP, the supported values are 10 and 30 seconds and the default is 30 seconds. If the target group protocol is GENEVE, the default is 10 seconds. If the target type is lambda , the default is 35 seconds.
@Stability(value=Stable)
public void setHealthCheckIntervalSeconds(@Nullable
Number value)
If the target group protocol is HTTP or HTTPS, the default is 30 seconds. If the target group protocol is TCP, TLS, UDP, or TCP_UDP, the supported values are 10 and 30 seconds and the default is 30 seconds. If the target group protocol is GENEVE, the default is 10 seconds. If the target type is lambda , the default is 35 seconds.
@Stability(value=Stable) @Nullable public String getHealthCheckPath()
[HTTP1 or HTTP2 protocol version] The ping path. The default is /.
[GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is / AWS .ALB/healthcheck.
@Stability(value=Stable)
public void setHealthCheckPath(@Nullable
String value)
[HTTP1 or HTTP2 protocol version] The ping path. The default is /.
[GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is / AWS .ALB/healthcheck.
@Stability(value=Stable) @Nullable public String getHealthCheckPort()
If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the default is traffic-port , which is the port on which each target receives traffic from the load balancer. If the protocol is GENEVE, the default is port 80.
@Stability(value=Stable)
public void setHealthCheckPort(@Nullable
String value)
If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the default is traffic-port , which is the port on which each target receives traffic from the load balancer. If the protocol is GENEVE, the default is port 80.
@Stability(value=Stable) @Nullable public String getHealthCheckProtocol()
For Application Load Balancers, the default is HTTP. For Network Load Balancers and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported for health checks if the protocol of the target group is HTTP or HTTPS. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.
@Stability(value=Stable)
public void setHealthCheckProtocol(@Nullable
String value)
For Application Load Balancers, the default is HTTP. For Network Load Balancers and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported for health checks if the protocol of the target group is HTTP or HTTPS. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.
@Stability(value=Stable) @Nullable public Number getHealthCheckTimeoutSeconds()
For target groups with a protocol of HTTP, HTTPS, or GENEVE, the default is 5 seconds. For target groups with a protocol of TCP or TLS, this value must be 6 seconds for HTTP health checks and 10 seconds for TCP and HTTPS health checks. If the target type is lambda , the default is 30 seconds.
@Stability(value=Stable)
public void setHealthCheckTimeoutSeconds(@Nullable
Number value)
For target groups with a protocol of HTTP, HTTPS, or GENEVE, the default is 5 seconds. For target groups with a protocol of TCP or TLS, this value must be 6 seconds for HTTP health checks and 10 seconds for TCP and HTTPS health checks. If the target type is lambda , the default is 30 seconds.
@Stability(value=Stable) @Nullable public Number getHealthyThresholdCount()
For target groups with a protocol of HTTP or HTTPS, the default is 5. For target groups with a protocol of TCP, TLS, or GENEVE, the default is 3. If the target type is lambda , the default is 5.
@Stability(value=Stable)
public void setHealthyThresholdCount(@Nullable
Number value)
For target groups with a protocol of HTTP or HTTPS, the default is 5. For target groups with a protocol of TCP, TLS, or GENEVE, the default is 3. If the target type is lambda , the default is 5.
@Stability(value=Stable) @Nullable public String getIpAddressType()
The possible values are ipv4 and ipv6 . This is an optional parameter. If not specified, the IP address type defaults to ipv4 .
@Stability(value=Stable)
public void setIpAddressType(@Nullable
String value)
The possible values are ipv4 and ipv6 . This is an optional parameter. If not specified, the IP address type defaults to ipv4 .
@Stability(value=Stable) @Nullable public Object getMatcher()
@Stability(value=Stable)
public void setMatcher(@Nullable
CfnTargetGroup.MatcherProperty value)
@Stability(value=Stable)
public void setMatcher(@Nullable
IResolvable value)
@Stability(value=Stable) @Nullable public String getName()
This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
@Stability(value=Stable)
public void setName(@Nullable
String value)
This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
@Stability(value=Stable) @Nullable public Number getPort()
This port is used unless you specify a port override when registering the target. If the target is a Lambda function, this parameter does not apply. If the protocol is GENEVE, the supported port is 6081.
@Stability(value=Stable)
public void setPort(@Nullable
Number value)
This port is used unless you specify a port override when registering the target. If the target is a Lambda function, this parameter does not apply. If the protocol is GENEVE, the supported port is 6081.
@Stability(value=Stable) @Nullable public String getProtocol()
For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP. For Gateway Load Balancers, the supported protocol is GENEVE. A TCP_UDP listener must be associated with a TCP_UDP target group. If the target is a Lambda function, this parameter does not apply.
@Stability(value=Stable)
public void setProtocol(@Nullable
String value)
For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP. For Gateway Load Balancers, the supported protocol is GENEVE. A TCP_UDP listener must be associated with a TCP_UDP target group. If the target is a Lambda function, this parameter does not apply.
@Stability(value=Stable) @Nullable public String getProtocolVersion()
The possible values are GRPC , HTTP1 , and HTTP2 .
@Stability(value=Stable)
public void setProtocolVersion(@Nullable
String value)
The possible values are GRPC , HTTP1 , and HTTP2 .
@Stability(value=Stable) @Nullable public Object getTargetGroupAttributes()
@Stability(value=Stable)
public void setTargetGroupAttributes(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setTargetGroupAttributes(@Nullable
List<Object> value)
@Stability(value=Stable) @Nullable public Object getTargets()
@Stability(value=Stable)
public void setTargets(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setTargets(@Nullable
List<Object> value)
@Stability(value=Stable) @Nullable public String getTargetType()
You can't specify targets for a target group using more than one target type.
instance - Register targets by instance ID. This is the default value.ip - Register targets by IP address. You can specify IP addresses from the subnets of the virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses.lambda - Register a single Lambda function as a target.alb - Register a single Application Load Balancer as a target.@Stability(value=Stable)
public void setTargetType(@Nullable
String value)
You can't specify targets for a target group using more than one target type.
instance - Register targets by instance ID. This is the default value.ip - Register targets by IP address. You can specify IP addresses from the subnets of the virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses.lambda - Register a single Lambda function as a target.alb - Register a single Application Load Balancer as a target.@Stability(value=Stable) @Nullable public Number getUnhealthyThresholdCount()
If the target group protocol is HTTP or HTTPS, the default is 2. If the target group protocol is TCP or TLS, this value must be the same as the healthy threshold count. If the target group protocol is GENEVE, the default is 3. If the target type is lambda , the default is 2.
@Stability(value=Stable)
public void setUnhealthyThresholdCount(@Nullable
Number value)
If the target group protocol is HTTP or HTTPS, the default is 2. If the target group protocol is TCP or TLS, this value must be the same as the healthy threshold count. If the target group protocol is GENEVE, the default is 3. If the target type is lambda , the default is 2.
@Stability(value=Stable) @Nullable public String getVpcId()
If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.
@Stability(value=Stable)
public void setVpcId(@Nullable
String value)
If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.
Copyright © 2022. All rights reserved.