@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:47.102Z") 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.
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.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnTargetGroup(Construct scope,
java.lang.String id)
Create a new `AWS::ElasticLoadBalancingV2::TargetGroup`.
|
|
CfnTargetGroup(Construct scope,
java.lang.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 |
---|---|
java.util.List<java.lang.String> |
getAttrLoadBalancerArns()
The Amazon Resource Name (ARN) of the load balancer that routes traffic to this target group.
|
java.lang.String |
getAttrTargetGroupArn()
The Amazon Resource Name (ARN) of the target group.
|
java.lang.String |
getAttrTargetGroupFullName()
The full name of the target group.
|
java.lang.String |
getAttrTargetGroupName()
The name of the target group.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Object |
getHealthCheckEnabled()
Indicates whether health checks are enabled.
|
java.lang.Number |
getHealthCheckIntervalSeconds()
The approximate amount of time, in seconds, between health checks of an individual target.
|
java.lang.String |
getHealthCheckPath()
[HTTP/HTTPS health checks] The destination for health checks on the targets.
|
java.lang.String |
getHealthCheckPort()
The port the load balancer uses when performing health checks on targets.
|
java.lang.String |
getHealthCheckProtocol()
The protocol the load balancer uses when performing health checks on targets.
|
java.lang.Number |
getHealthCheckTimeoutSeconds()
The amount of time, in seconds, during which no response from a target means a failed health check.
|
java.lang.Number |
getHealthyThresholdCount()
The number of consecutive health check successes required before considering a target healthy.
|
java.lang.String |
getIpAddressType()
The type of IP address used for this target group.
|
java.lang.Object |
getMatcher()
[HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.
|
java.lang.String |
getName()
The name of the target group.
|
java.lang.Number |
getPort()
The port on which the targets receive traffic.
|
java.lang.String |
getProtocol()
The protocol to use for routing traffic to the targets.
|
java.lang.String |
getProtocolVersion()
[HTTP/HTTPS protocol] The protocol version.
|
TagManager |
getTags()
The tags.
|
java.lang.Object |
getTargetGroupAttributes()
The attributes.
|
java.lang.Object |
getTargets()
The targets.
|
java.lang.String |
getTargetType()
The type of target that you must specify when registering targets with this target group.
|
java.lang.Number |
getUnhealthyThresholdCount()
The number of consecutive health check failures required before considering a target unhealthy.
|
java.lang.String |
getVpcId()
The identifier of the virtual private cloud (VPC).
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setHealthCheckEnabled(java.lang.Boolean value)
Indicates whether health checks are enabled.
|
void |
setHealthCheckEnabled(IResolvable value)
Indicates whether health checks are enabled.
|
void |
setHealthCheckIntervalSeconds(java.lang.Number value)
The approximate amount of time, in seconds, between health checks of an individual target.
|
void |
setHealthCheckPath(java.lang.String value)
[HTTP/HTTPS health checks] The destination for health checks on the targets.
|
void |
setHealthCheckPort(java.lang.String value)
The port the load balancer uses when performing health checks on targets.
|
void |
setHealthCheckProtocol(java.lang.String value)
The protocol the load balancer uses when performing health checks on targets.
|
void |
setHealthCheckTimeoutSeconds(java.lang.Number value)
The amount of time, in seconds, during which no response from a target means a failed health check.
|
void |
setHealthyThresholdCount(java.lang.Number value)
The number of consecutive health check successes required before considering a target healthy.
|
void |
setIpAddressType(java.lang.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(java.lang.String value)
The name of the target group.
|
void |
setPort(java.lang.Number value)
The port on which the targets receive traffic.
|
void |
setProtocol(java.lang.String value)
The protocol to use for routing traffic to the targets.
|
void |
setProtocolVersion(java.lang.String value)
[HTTP/HTTPS protocol] The protocol version.
|
void |
setTargetGroupAttributes(IResolvable value)
The attributes.
|
void |
setTargetGroupAttributes(java.util.List<java.lang.Object> value)
The attributes.
|
void |
setTargets(IResolvable value)
The targets.
|
void |
setTargets(java.util.List<java.lang.Object> value)
The targets.
|
void |
setTargetType(java.lang.String value)
The type of target that you must specify when registering targets with this target group.
|
void |
setUnhealthyThresholdCount(java.lang.Number value)
The number of consecutive health check failures required before considering a target unhealthy.
|
void |
setVpcId(java.lang.String value)
The identifier of the virtual private cloud (VPC).
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnTargetGroup(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnTargetGroup(Construct scope, java.lang.String id, 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.public CfnTargetGroup(Construct scope, java.lang.String id)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.util.List<java.lang.String> getAttrLoadBalancerArns()
public java.lang.String getAttrTargetGroupArn()
public java.lang.String getAttrTargetGroupFullName()
For example, targetgroup/my-target-group/cbf133c568e0d028
.
public java.lang.String getAttrTargetGroupName()
For example, my-target-group
.
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
public java.lang.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.
public void setHealthCheckEnabled(java.lang.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.
public void setHealthCheckEnabled(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.
public java.lang.Number getHealthCheckIntervalSeconds()
The range is 5-300. If the target group protocol is TCP, TLS, UDP, TCP_UDP, HTTP or HTTPS, 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.
public void setHealthCheckIntervalSeconds(java.lang.Number value)
The range is 5-300. If the target group protocol is TCP, TLS, UDP, TCP_UDP, HTTP or HTTPS, 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.
public java.lang.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.
public void setHealthCheckPath(java.lang.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.
public java.lang.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.
public void setHealthCheckPort(java.lang.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.
public java.lang.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.
public void setHealthCheckProtocol(java.lang.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.
public java.lang.Number getHealthCheckTimeoutSeconds()
The range is 2–120 seconds. For target groups with a protocol of HTTP, the default is 6 seconds. For target groups with a protocol of TCP, TLS or HTTPS, the default is 10 seconds. For target groups with a protocol of GENEVE, the default is 5 seconds. If the target type is lambda
, the default is 30 seconds.
public void setHealthCheckTimeoutSeconds(java.lang.Number value)
The range is 2–120 seconds. For target groups with a protocol of HTTP, the default is 6 seconds. For target groups with a protocol of TCP, TLS or HTTPS, the default is 10 seconds. For target groups with a protocol of GENEVE, the default is 5 seconds. If the target type is lambda
, the default is 30 seconds.
public java.lang.Number getHealthyThresholdCount()
The range is 2-10. If the target group protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 5. For target groups with a protocol of GENEVE, the default is 3. If the target type is lambda
, the default is 5.
public void setHealthyThresholdCount(java.lang.Number value)
The range is 2-10. If the target group protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 5. For target groups with a protocol of GENEVE, the default is 3. If the target type is lambda
, the default is 5.
public java.lang.String getIpAddressType()
The possible values are ipv4
and ipv6
. This is an optional parameter. If not specified, the IP address type defaults to ipv4
.
public void setIpAddressType(java.lang.String value)
The possible values are ipv4
and ipv6
. This is an optional parameter. If not specified, the IP address type defaults to ipv4
.
public java.lang.Object getMatcher()
For target groups with a protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol of HTTP or HTTPS, the range is 200-499. For target groups with a protocol of GENEVE, the range is 200-399.
public void setMatcher(IResolvable value)
For target groups with a protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol of HTTP or HTTPS, the range is 200-499. For target groups with a protocol of GENEVE, the range is 200-399.
public void setMatcher(CfnTargetGroup.MatcherProperty value)
For target groups with a protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol of HTTP or HTTPS, the range is 200-499. For target groups with a protocol of GENEVE, the range is 200-399.
public java.lang.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.
public void setName(java.lang.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.
public java.lang.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.
public void setPort(java.lang.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.
public java.lang.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.
public void setProtocol(java.lang.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.
public java.lang.String getProtocolVersion()
The possible values are GRPC
, HTTP1
, and HTTP2
.
public void setProtocolVersion(java.lang.String value)
The possible values are GRPC
, HTTP1
, and HTTP2
.
public java.lang.Object getTargetGroupAttributes()
public void setTargetGroupAttributes(IResolvable value)
public void setTargetGroupAttributes(java.util.List<java.lang.Object> value)
public java.lang.Object getTargets()
public void setTargets(IResolvable value)
public void setTargets(java.util.List<java.lang.Object> value)
public java.lang.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.public void setTargetType(java.lang.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.public java.lang.Number getUnhealthyThresholdCount()
The range is 2-10. If the target group protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 2. For target groups with a protocol of GENEVE, the default is 3. If the target type is lambda
, the default is 5.
public void setUnhealthyThresholdCount(java.lang.Number value)
The range is 2-10. If the target group protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 2. For target groups with a protocol of GENEVE, the default is 3. If the target type is lambda
, the default is 5.
public java.lang.String getVpcId()
If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.
public void setVpcId(java.lang.String value)
If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.