CfnTargetGroup
- class aws_cdk.aws_elasticloadbalancingv2.CfnTargetGroup(scope, id, *, health_check_enabled=None, health_check_interval_seconds=None, health_check_path=None, health_check_port=None, health_check_protocol=None, health_check_timeout_seconds=None, healthy_threshold_count=None, ip_address_type=None, matcher=None, name=None, port=None, protocol=None, protocol_version=None, tags=None, target_group_attributes=None, targets=None, target_type=None, unhealthy_threshold_count=None, vpc_id=None)
Bases:
CfnResource
A CloudFormation
AWS::ElasticLoadBalancingV2::TargetGroup
.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.- CloudformationResource:
AWS::ElasticLoadBalancingV2::TargetGroup
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 cfn_target_group = elbv2.CfnTargetGroup(self, "MyCfnTargetGroup", health_check_enabled=False, health_check_interval_seconds=123, health_check_path="healthCheckPath", health_check_port="healthCheckPort", health_check_protocol="healthCheckProtocol", health_check_timeout_seconds=123, healthy_threshold_count=123, ip_address_type="ipAddressType", matcher=elbv2.CfnTargetGroup.MatcherProperty( grpc_code="grpcCode", http_code="httpCode" ), name="name", port=123, protocol="protocol", protocol_version="protocolVersion", tags=[CfnTag( key="key", value="value" )], target_group_attributes=[elbv2.CfnTargetGroup.TargetGroupAttributeProperty( key="key", value="value" )], targets=[elbv2.CfnTargetGroup.TargetDescriptionProperty( id="id", # the properties below are optional availability_zone="availabilityZone", port=123 )], target_type="targetType", unhealthy_threshold_count=123, vpc_id="vpcId" )
Create a new
AWS::ElasticLoadBalancingV2::TargetGroup
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
health_check_enabled (
Union
[bool
,IResolvable
,None
]) – Indicates whether health checks are enabled. If the target type islambda
, health checks are disabled by default but can be enabled. If the target type isinstance
,ip
, oralb
, health checks are always enabled and cannot be disabled.health_check_interval_seconds (
Union
[int
,float
,None
]) – The approximate amount of time, in seconds, between health checks of an individual target. 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 islambda
, the default is 35 seconds.health_check_path (
Optional
[str
]) – [HTTP/HTTPS health checks] The destination for health checks on the targets. [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.health_check_port (
Optional
[str
]) – The port the load balancer uses when performing health checks on targets. If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the default istraffic-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.health_check_protocol (
Optional
[str
]) – The protocol the load balancer uses when performing health checks on targets. 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.health_check_timeout_seconds (
Union
[int
,float
,None
]) – The amount of time, in seconds, during which no response from a target means a failed health check. 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 islambda
, the default is 30 seconds.healthy_threshold_count (
Union
[int
,float
,None
]) – The number of consecutive health check successes required before considering a target healthy. 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 5. If the target type islambda
, the default is 5.ip_address_type (
Optional
[str
]) – The type of IP address used for this target group. The possible values areipv4
andipv6
. This is an optional parameter. If not specified, the IP address type defaults toipv4
.matcher (
Union
[IResolvable
,MatcherProperty
,Dict
[str
,Any
],None
]) – [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target. 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.name (
Optional
[str
]) – The name of the target group. 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.port (
Union
[int
,float
,None
]) – The port on which the targets receive traffic. 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.protocol (
Optional
[str
]) – The protocol to use for routing traffic to the targets. 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.protocol_version (
Optional
[str
]) – [HTTP/HTTPS protocol] The protocol version. The possible values areGRPC
,HTTP1
, andHTTP2
.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – The tags.target_group_attributes (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetGroupAttributeProperty
,Dict
[str
,Any
]]],None
]) – The attributes.targets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetDescriptionProperty
,Dict
[str
,Any
]]],None
]) – The targets.target_type (
Optional
[str
]) – The type of target that you must specify when registering targets with this target group. 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.unhealthy_threshold_count (
Union
[int
,float
,None
]) – The number of consecutive health check failures required before considering a target unhealthy. 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 2. If the target type islambda
, the default is 5.vpc_id (
Optional
[str
]) – The identifier of the virtual private cloud (VPC). If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::ElasticLoadBalancingV2::TargetGroup'
- attr_load_balancer_arns
The Amazon Resource Name (ARN) of the load balancer that routes traffic to this target group.
- CloudformationAttribute:
LoadBalancerArns
- attr_target_group_arn
The Amazon Resource Name (ARN) of the target group.
- CloudformationAttribute:
TargetGroupArn
- attr_target_group_full_name
The full name of the target group.
For example,
targetgroup/my-target-group/cbf133c568e0d028
.- CloudformationAttribute:
TargetGroupFullName
- attr_target_group_name
The name of the target group.
For example,
my-target-group
.- CloudformationAttribute:
TargetGroupName
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- health_check_enabled
Indicates whether health checks are enabled.
If the target type is
lambda
, health checks are disabled by default but can be enabled. If the target type isinstance
,ip
, oralb
, health checks are always enabled and cannot be disabled.
- health_check_interval_seconds
The approximate amount of time, in seconds, between health checks of an individual target.
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.
- health_check_path
[HTTP/HTTPS health checks] The destination for health checks on the targets.
[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.
- health_check_port
The port the load balancer uses when performing health checks on targets.
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.
- health_check_protocol
The protocol the load balancer uses when performing health checks on targets.
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.
- health_check_timeout_seconds
The amount of time, in seconds, during which no response from a target means a failed health check.
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.
- healthy_threshold_count
The number of consecutive health check successes required before considering a target healthy.
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 5. If the target type is
lambda
, the default is 5.
- ip_address_type
The type of IP address used for this target group.
The possible values are
ipv4
andipv6
. This is an optional parameter. If not specified, the IP address type defaults toipv4
.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- matcher
[HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.
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.
- name
The name of the target group.
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.
- node
The construct tree node associated with this construct.
- port
The port on which the targets receive traffic.
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.
- protocol
The protocol to use for routing traffic to the targets.
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.
- protocol_version
[HTTP/HTTPS protocol] The protocol version.
The possible values are
GRPC
,HTTP1
, andHTTP2
.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
The tags.
- target_group_attributes
The attributes.
- target_type
The type of target that you must specify when registering targets with this target group.
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.
- targets
The targets.
- unhealthy_threshold_count
The number of consecutive health check failures required before considering a target unhealthy.
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 2. If the target type is
lambda
, the default is 5.
- vpc_id
The identifier of the virtual private cloud (VPC).
If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
MatcherProperty
- class CfnTargetGroup.MatcherProperty(*, grpc_code=None, http_code=None)
Bases:
object
Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check.
- Parameters:
grpc_code (
Optional
[str
]) – You can specify values between 0 and 99. You can specify multiple values (for example, “0,1”) or a range of values (for example, “0-5”). The default value is 12.http_code (
Optional
[str
]) – For Application Load Balancers, you can specify values between 200 and 499, with the default value being 200. You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”). For Network Load Balancers, you can specify values between 200 and 599, with the default value being 200-399. You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”). For Gateway Load Balancers, this must be “200–399”. Note that when using shorthand syntax, some values such as commas need to be escaped.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 matcher_property = elbv2.CfnTargetGroup.MatcherProperty( grpc_code="grpcCode", http_code="httpCode" )
Attributes
- grpc_code
You can specify values between 0 and 99.
You can specify multiple values (for example, “0,1”) or a range of values (for example, “0-5”). The default value is 12.
- http_code
For Application Load Balancers, you can specify values between 200 and 499, with the default value being 200.
You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”).
For Network Load Balancers, you can specify values between 200 and 599, with the default value being 200-399. You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”).
For Gateway Load Balancers, this must be “200–399”.
Note that when using shorthand syntax, some values such as commas need to be escaped.
TargetDescriptionProperty
- class CfnTargetGroup.TargetDescriptionProperty(*, id, availability_zone=None, port=None)
Bases:
object
Specifies a target to add to a target group.
- Parameters:
id (
str
) – The ID of the target. If the target type of the target group isinstance
, specify an instance ID. If the target type isip
, specify an IP address. If the target type islambda
, specify the ARN of the Lambda function. If the target type isalb
, specify the ARN of the Application Load Balancer target.availability_zone (
Optional
[str
]) – An Availability Zone orall
. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer. For Application Load Balancer target groups, the specified Availability Zone value is only applicable when cross-zone load balancing is off. Otherwise the parameter is ignored and treated asall
. This parameter is not supported if the target type of the target group isinstance
oralb
. If the target type isip
and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required. For Application Load Balancer target groups with cross-zone load balancing off, if the target type isip
and the IP address is outside of the VPC for the target group, this should be an Availability Zone inside the VPC for the target group. If the target type islambda
, this parameter is optional and the only supported value isall
.port (
Union
[int
,float
,None
]) – The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type isalb
, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. This parameter is not used if the target is a Lambda function.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 target_description_property = elbv2.CfnTargetGroup.TargetDescriptionProperty( id="id", # the properties below are optional availability_zone="availabilityZone", port=123 )
Attributes
- availability_zone
An Availability Zone or
all
.This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.
For Application Load Balancer target groups, the specified Availability Zone value is only applicable when cross-zone load balancing is off. Otherwise the parameter is ignored and treated as
all
.This parameter is not supported if the target type of the target group is
instance
oralb
.If the target type is
ip
and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.For Application Load Balancer target groups with cross-zone load balancing off, if the target type is
ip
and the IP address is outside of the VPC for the target group, this should be an Availability Zone inside the VPC for the target group.If the target type is
lambda
, this parameter is optional and the only supported value isall
.
- id
The ID of the target.
If the target type of the target group is
instance
, specify an instance ID. If the target type isip
, specify an IP address. If the target type islambda
, specify the ARN of the Lambda function. If the target type isalb
, specify the ARN of the Application Load Balancer target.
- port
The port on which the target is listening.
If the target group protocol is GENEVE, the supported port is 6081. If the target type is
alb
, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. This parameter is not used if the target is a Lambda function.
TargetGroupAttributeProperty
- class CfnTargetGroup.TargetGroupAttributeProperty(*, key=None, value=None)
Bases:
object
Specifies a target group attribute.
- Parameters:
key (
Optional
[str
]) – The name of the attribute. The following attributes are supported by all load balancers: -deregistration_delay.timeout_seconds
- The amount of time, in seconds, for Elastic Load Balancing to wait before changing the state of a deregistering target fromdraining
tounused
. The range is 0-3600 seconds. The default value is 300 seconds. If the target is a Lambda function, this attribute is not supported. -stickiness.enabled
- Indicates whether target stickiness is enabled. The value istrue
orfalse
. The default isfalse
. -stickiness.type
- Indicates the type of stickiness. The possible values are: -lb_cookie
andapp_cookie
for Application Load Balancers. -source_ip
for Network Load Balancers. -source_ip_dest_ip
andsource_ip_dest_ip_proto
for Gateway Load Balancers. The following attributes are supported by Application Load Balancers and Network Load Balancers: -load_balancing.cross_zone.enabled
- Indicates whether cross zone load balancing is enabled. The value istrue
,false
oruse_load_balancer_configuration
. The default isuse_load_balancer_configuration
. -target_group_health.dns_failover.minimum_healthy_targets.count
- The minimum number of targets that must be healthy. If the number of healthy targets is below this value, mark the zone as unhealthy in DNS, so that traffic is routed only to healthy zones. The possible values areoff
or an integer from 1 to the maximum number of targets. The default isoff
. -target_group_health.dns_failover.minimum_healthy_targets.percentage
- The minimum percentage of targets that must be healthy. If the percentage of healthy targets is below this value, mark the zone as unhealthy in DNS, so that traffic is routed only to healthy zones. The possible values areoff
or an integer from 1 to 100. The default isoff
. -target_group_health.unhealthy_state_routing.minimum_healthy_targets.count
- The minimum number of targets that must be healthy. If the number of healthy targets is below this value, send traffic to all targets, including unhealthy targets. The possible values are 1 to the maximum number of targets. The default is 1. -target_group_health.unhealthy_state_routing.minimum_healthy_targets.percentage
- The minimum percentage of targets that must be healthy. If the percentage of healthy targets is below this value, send traffic to all targets, including unhealthy targets. The possible values areoff
or an integer from 1 to 100. The default isoff
. The following attributes are supported only if the load balancer is an Application Load Balancer and the target is an instance or an IP address: -load_balancing.algorithm.type
- The load balancing algorithm determines how the load balancer selects targets when routing requests. The value isround_robin
orleast_outstanding_requests
. The default isround_robin
. -slow_start.duration_seconds
- The time period, in seconds, during which a newly registered target receives an increasing share of the traffic to the target group. After this time period ends, the target receives its full share of traffic. The range is 30-900 seconds (15 minutes). The default is 0 seconds (disabled). -stickiness.app_cookie.cookie_name
- Indicates the name of the application-based cookie. Names that start with the following prefixes are not allowed:AWSALB
,AWSALBAPP
, andAWSALBTG
; they’re reserved for use by the load balancer. -stickiness.app_cookie.duration_seconds
- The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the application-based cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds). -stickiness.lb_cookie.duration_seconds
- The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds). The following attribute is supported only if the load balancer is an Application Load Balancer and the target is a Lambda function: -lambda.multi_value_headers.enabled
- Indicates whether the request and response headers that are exchanged between the load balancer and the Lambda function include arrays of values or strings. The value istrue
orfalse
. The default isfalse
. If the value isfalse
and the request contains a duplicate header field name or query parameter key, the load balancer uses the last value sent by the client. The following attributes are supported only by Network Load Balancers: -deregistration_delay.connection_termination.enabled
- Indicates whether the load balancer terminates connections at the end of the deregistration timeout. The value istrue
orfalse
. The default isfalse
. -preserve_client_ip.enabled
- Indicates whether client IP preservation is enabled. The value istrue
orfalse
. The default is disabled if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, the default is enabled. Client IP preservation cannot be disabled for UDP and TCP_UDP target groups. -proxy_protocol_v2.enabled
- Indicates whether Proxy Protocol version 2 is enabled. The value istrue
orfalse
. The default isfalse
. The following attributes are supported only by Gateway Load Balancers: -target_failover.on_deregistration
- Indicates how the Gateway Load Balancer handles existing flows when a target is deregistered. The possible values arerebalance
andno_rebalance
. The default isno_rebalance
. The two attributes (target_failover.on_deregistration
andtarget_failover.on_unhealthy
) can’t be set independently. The value you set for both attributes must be the same. -target_failover.on_unhealthy
- Indicates how the Gateway Load Balancer handles existing flows when a target is unhealthy. The possible values arerebalance
andno_rebalance
. The default isno_rebalance
. The two attributes (target_failover.on_deregistration
andtarget_failover.on_unhealthy
) cannot be set independently. The value you set for both attributes must be the same.value (
Optional
[str
]) – The value of the attribute.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 target_group_attribute_property = elbv2.CfnTargetGroup.TargetGroupAttributeProperty( key="key", value="value" )
Attributes
- key
The name of the attribute.
The following attributes are supported by all load balancers:
deregistration_delay.timeout_seconds
- The amount of time, in seconds, for Elastic Load Balancing to wait before changing the state of a deregistering target fromdraining
tounused
. The range is 0-3600 seconds. The default value is 300 seconds. If the target is a Lambda function, this attribute is not supported.stickiness.enabled
- Indicates whether target stickiness is enabled. The value istrue
orfalse
. The default isfalse
.stickiness.type
- Indicates the type of stickiness. The possible values are:lb_cookie
andapp_cookie
for Application Load Balancers.source_ip
for Network Load Balancers.source_ip_dest_ip
andsource_ip_dest_ip_proto
for Gateway Load Balancers.
The following attributes are supported by Application Load Balancers and Network Load Balancers:
load_balancing.cross_zone.enabled
- Indicates whether cross zone load balancing is enabled. The value istrue
,false
oruse_load_balancer_configuration
. The default isuse_load_balancer_configuration
.target_group_health.dns_failover.minimum_healthy_targets.count
- The minimum number of targets that must be healthy. If the number of healthy targets is below this value, mark the zone as unhealthy in DNS, so that traffic is routed only to healthy zones. The possible values areoff
or an integer from 1 to the maximum number of targets. The default isoff
.target_group_health.dns_failover.minimum_healthy_targets.percentage
- The minimum percentage of targets that must be healthy. If the percentage of healthy targets is below this value, mark the zone as unhealthy in DNS, so that traffic is routed only to healthy zones. The possible values areoff
or an integer from 1 to 100. The default isoff
.target_group_health.unhealthy_state_routing.minimum_healthy_targets.count
- The minimum number of targets that must be healthy. If the number of healthy targets is below this value, send traffic to all targets, including unhealthy targets. The possible values are 1 to the maximum number of targets. The default is 1.target_group_health.unhealthy_state_routing.minimum_healthy_targets.percentage
- The minimum percentage of targets that must be healthy. If the percentage of healthy targets is below this value, send traffic to all targets, including unhealthy targets. The possible values areoff
or an integer from 1 to 100. The default isoff
.
The following attributes are supported only if the load balancer is an Application Load Balancer and the target is an instance or an IP address:
load_balancing.algorithm.type
- The load balancing algorithm determines how the load balancer selects targets when routing requests. The value isround_robin
orleast_outstanding_requests
. The default isround_robin
.slow_start.duration_seconds
- The time period, in seconds, during which a newly registered target receives an increasing share of the traffic to the target group. After this time period ends, the target receives its full share of traffic. The range is 30-900 seconds (15 minutes). The default is 0 seconds (disabled).stickiness.app_cookie.cookie_name
- Indicates the name of the application-based cookie. Names that start with the following prefixes are not allowed:AWSALB
,AWSALBAPP
, andAWSALBTG
; they’re reserved for use by the load balancer.stickiness.app_cookie.duration_seconds
- The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the application-based cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).stickiness.lb_cookie.duration_seconds
- The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).
The following attribute is supported only if the load balancer is an Application Load Balancer and the target is a Lambda function:
lambda.multi_value_headers.enabled
- Indicates whether the request and response headers that are exchanged between the load balancer and the Lambda function include arrays of values or strings. The value istrue
orfalse
. The default isfalse
. If the value isfalse
and the request contains a duplicate header field name or query parameter key, the load balancer uses the last value sent by the client.
The following attributes are supported only by Network Load Balancers:
deregistration_delay.connection_termination.enabled
- Indicates whether the load balancer terminates connections at the end of the deregistration timeout. The value istrue
orfalse
. The default isfalse
.preserve_client_ip.enabled
- Indicates whether client IP preservation is enabled. The value istrue
orfalse
. The default is disabled if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, the default is enabled. Client IP preservation cannot be disabled for UDP and TCP_UDP target groups.proxy_protocol_v2.enabled
- Indicates whether Proxy Protocol version 2 is enabled. The value istrue
orfalse
. The default isfalse
.
The following attributes are supported only by Gateway Load Balancers:
target_failover.on_deregistration
- Indicates how the Gateway Load Balancer handles existing flows when a target is deregistered. The possible values arerebalance
andno_rebalance
. The default isno_rebalance
. The two attributes (target_failover.on_deregistration
andtarget_failover.on_unhealthy
) can’t be set independently. The value you set for both attributes must be the same.target_failover.on_unhealthy
- Indicates how the Gateway Load Balancer handles existing flows when a target is unhealthy. The possible values arerebalance
andno_rebalance
. The default isno_rebalance
. The two attributes (target_failover.on_deregistration
andtarget_failover.on_unhealthy
) cannot be set independently. The value you set for both attributes must be the same.