CfnTargetGroupPropsMixin
- class aws_cdk.mixins_preview.aws_elasticloadbalancingv2.mixins.CfnTargetGroupPropsMixin(props, *, strategy=None)
Bases:
MixinSpecifies 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::Permissionresource that grants the Elastic Load Balancing service principal permission to invoke the Lambda function.- See:
- CloudformationResource:
AWS::ElasticLoadBalancingV2::TargetGroup
- Mixin:
true
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview import mixins from aws_cdk.mixins_preview.aws_elasticloadbalancingv2 import mixins as elasticloadbalancingv2_mixins cfn_target_group_props_mixin = elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin(elasticloadbalancingv2_mixins.CfnTargetGroupMixinProps( 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=elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin.MatcherProperty( grpc_code="grpcCode", http_code="httpCode" ), name="name", port=123, protocol="protocol", protocol_version="protocolVersion", tags=[CfnTag( key="key", value="value" )], target_control_port=123, target_group_attributes=[elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin.TargetGroupAttributeProperty( key="key", value="value" )], targets=[elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin.TargetDescriptionProperty( availability_zone="availabilityZone", id="id", port=123, quic_server_id="quicServerId" )], target_type="targetType", unhealthy_threshold_count=123, vpc_id="vpcId" ), strategy=mixins.PropertyMergeStrategy.OVERRIDE )
Create a mixin to apply properties to
AWS::ElasticLoadBalancingV2::TargetGroup.- Parameters:
props (
Union[CfnTargetGroupMixinProps,Dict[str,Any]]) – L1 properties to apply.strategy (
Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE
Methods
- apply_to(construct)
Apply the mixin properties to the construct.
- Parameters:
construct (
IConstruct)- Return type:
- supports(construct)
Check if this mixin supports the given construct.
- Parameters:
construct (
IConstruct)- Return type:
bool
Attributes
- CFN_PROPERTY_KEYS = ['healthCheckEnabled', 'healthCheckIntervalSeconds', 'healthCheckPath', 'healthCheckPort', 'healthCheckProtocol', 'healthCheckTimeoutSeconds', 'healthyThresholdCount', 'ipAddressType', 'matcher', 'name', 'port', 'protocol', 'protocolVersion', 'tags', 'targetControlPort', 'targetGroupAttributes', 'targets', 'targetType', 'unhealthyThresholdCount', 'vpcId']
Static Methods
- classmethod is_mixin(x)
(experimental) Checks if
xis a Mixin.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsMixin.- Stability:
experimental
MatcherProperty
- class CfnTargetGroupPropsMixin.MatcherProperty(*, grpc_code=None, http_code=None)
Bases:
objectSpecifies 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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_elasticloadbalancingv2 import mixins as elasticloadbalancingv2_mixins matcher_property = elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin.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 CfnTargetGroupPropsMixin.TargetDescriptionProperty(*, availability_zone=None, id=None, port=None, quic_server_id=None)
Bases:
objectSpecifies a target to add to a target group.
- Parameters:
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 isinstanceoralb. If the target type isipand 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 isipand 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.id (
Optional[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.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.quic_server_id (
Optional[str]) – The server ID for the targets. This value is required if the protocol isQUICorTCP_QUICand can’t be used with other protocols. The ID consists of the0xprefix followed by 16 hexadecimal characters. Any letters must be lowercase. The value must be unique at the listener level. You can’t modify the server ID for a registered target. You must deregister the target and then provide a new server ID when you register the target again.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_elasticloadbalancingv2 import mixins as elasticloadbalancingv2_mixins target_description_property = elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin.TargetDescriptionProperty( availability_zone="availabilityZone", id="id", port=123, quic_server_id="quicServerId" )
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
instanceoralb.If the target type is
ipand 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
ipand 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.
- quic_server_id
The server ID for the targets.
This value is required if the protocol is
QUICorTCP_QUICand can’t be used with other protocols.The ID consists of the
0xprefix followed by 16 hexadecimal characters. Any letters must be lowercase. The value must be unique at the listener level. You can’t modify the server ID for a registered target. You must deregister the target and then provide a new server ID when you register the target again.
TargetGroupAttributeProperty
- class CfnTargetGroupPropsMixin.TargetGroupAttributeProperty(*, key=None, value=None)
Bases:
objectSpecifies 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 fromdrainingtounused. 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 istrueorfalse. The default isfalse. -stickiness.type- Indicates the type of stickiness. The possible values are: -lb_cookieandapp_cookiefor Application Load Balancers. -source_ipfor Network Load Balancers. -source_ip_dest_ipandsource_ip_dest_ip_protofor 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,falseoruse_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 areoffor an integer from 1 to the maximum number of targets. The default is 1. -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 areoffor 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 areoffor 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,least_outstanding_requests, orweighted_random. The default isround_robin. -load_balancing.algorithm.anomaly_mitigation- Only available whenload_balancing.algorithm.typeisweighted_random. Indicates whether anomaly mitigation is enabled. The value isonoroff. The default isoff. -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 istrueorfalse. The default isfalse. If the value isfalseand 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 istrueorfalse. For new UDP/TCP_UDP target groups the default istrue. Otherwise, the default isfalse. -preserve_client_ip.enabled- Indicates whether client IP preservation is enabled. The value istrueorfalse. 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 can’t be disabled for UDP and TCP_UDP target groups. -proxy_protocol_v2.enabled- Indicates whether Proxy Protocol version 2 is enabled. The value istrueorfalse. The default isfalse. -target_health_state.unhealthy.connection_termination.enabled- Indicates whether the load balancer terminates connections to unhealthy targets. The value istrueorfalse. The default istrue. This attribute can’t be enabled for UDP and TCP_UDP target groups. -target_health_state.unhealthy.draining_interval_seconds- The amount of time for Elastic Load Balancing to wait before changing the state of an unhealthy target fromunhealthy.drainingtounhealthy. The range is 0-360000 seconds. The default value is 0 seconds. Note: This attribute can only be configured whentarget_health_state.unhealthy.connection_termination.enabledisfalse. 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 arerebalanceandno_rebalance. The default isno_rebalance. The two attributes (target_failover.on_deregistrationandtarget_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 arerebalanceandno_rebalance. The default isno_rebalance. The two attributes (target_failover.on_deregistrationandtarget_failover.on_unhealthy) can’t be set independently. The value you set for both attributes must be the same.value (
Optional[str]) – The value of the attribute.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_elasticloadbalancingv2 import mixins as elasticloadbalancingv2_mixins target_group_attribute_property = elasticloadbalancingv2_mixins.CfnTargetGroupPropsMixin.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 fromdrainingtounused. 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 istrueorfalse. The default isfalse.stickiness.type- Indicates the type of stickiness. The possible values are:lb_cookieandapp_cookiefor Application Load Balancers.source_ipfor Network Load Balancers.source_ip_dest_ipandsource_ip_dest_ip_protofor 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,falseoruse_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 areoffor an integer from 1 to the maximum number of targets. The default is 1.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 areoffor 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 areoffor 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,least_outstanding_requests, orweighted_random. The default isround_robin.load_balancing.algorithm.anomaly_mitigation- Only available whenload_balancing.algorithm.typeisweighted_random. Indicates whether anomaly mitigation is enabled. The value isonoroff. The default isoff.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 istrueorfalse. The default isfalse. If the value isfalseand 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 istrueorfalse. For new UDP/TCP_UDP target groups the default istrue. Otherwise, the default isfalse.preserve_client_ip.enabled- Indicates whether client IP preservation is enabled. The value istrueorfalse. 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 can’t be disabled for UDP and TCP_UDP target groups.proxy_protocol_v2.enabled- Indicates whether Proxy Protocol version 2 is enabled. The value istrueorfalse. The default isfalse.target_health_state.unhealthy.connection_termination.enabled- Indicates whether the load balancer terminates connections to unhealthy targets. The value istrueorfalse. The default istrue. This attribute can’t be enabled for UDP and TCP_UDP target groups.target_health_state.unhealthy.draining_interval_seconds- The amount of time for Elastic Load Balancing to wait before changing the state of an unhealthy target fromunhealthy.drainingtounhealthy. The range is 0-360000 seconds. The default value is 0 seconds.
Note: This attribute can only be configured when
target_health_state.unhealthy.connection_termination.enabledisfalse.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 arerebalanceandno_rebalance. The default isno_rebalance. The two attributes (target_failover.on_deregistrationandtarget_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 arerebalanceandno_rebalance. The default isno_rebalance. The two attributes (target_failover.on_deregistrationandtarget_failover.on_unhealthy) can’t be set independently. The value you set for both attributes must be the same.