target_groups
Creates, updates, deletes or gets a target_group resource or lists target_groups in a region
Overview
| Name | target_groups |
| Type | Resource |
| Description | Resource Type definition for AWS::ElasticLoadBalancingV2::TargetGroup |
| Id | awscc.elasticloadbalancingv2.target_groups |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
ip_address_type | string | The type of IP address used for this target group. The possible values are ipv4 and ipv6. |
target_group_arn | string | The ARN of the Target Group |
health_check_interval_seconds | integer | The approximate amount of time, in seconds, between health checks of an individual target. |
load_balancer_arns | array | The Amazon Resource Names (ARNs) of the load balancers that route traffic to this target group. |
matcher | object | [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target. |
health_check_path | string | [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. |
port | integer | 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. |
targets | array | The targets. |
health_check_enabled | boolean | 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 is instance, ip, or alb, health checks are always enabled and cannot be disabled. |
protocol_version | string | [HTTP/HTTPS protocol] The protocol version. The possible values are GRPC, HTTP1, and HTTP2. |
unhealthy_threshold_count | integer | The number of consecutive health check failures required before considering a target unhealthy. |
health_check_timeout_seconds | integer | The amount of time, in seconds, during which no response from a target means a failed health check. |
name | string | The name of the target group. |
vpc_id | string | The identifier of the virtual private cloud (VPC). If the target is a Lambda function, this parameter does not apply. |
target_group_full_name | string | The full name of the target group. |
healthy_threshold_count | integer | The number of consecutive health checks successes required before considering an unhealthy target healthy. |
health_check_protocol | string | The protocol the load balancer uses when performing health checks on targets. |
target_group_attributes | array | The attributes. |
target_type | string | 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. |
health_check_port | string | The port the load balancer uses when performing health checks on targets. |
protocol | string | The protocol to use for routing traffic to the targets. |
target_group_name | string | The name of the target group. |
tags | array | The tags. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
target_group_arn | string | The ARN of the Target Group |
region | string | AWS region. |
For more information, see AWS::ElasticLoadBalancingV2::TargetGroup.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | target_groups | INSERT | region |
delete_resource | target_groups | DELETE | Identifier, region |
update_resource | target_groups | UPDATE | Identifier, PatchDocument, region |
list_resources | target_groups_list_only | SELECT | region |
get_resource | target_groups | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual target_group.
SELECT
region,
ip_address_type,
target_group_arn,
health_check_interval_seconds,
load_balancer_arns,
matcher,
health_check_path,
port,
targets,
health_check_enabled,
protocol_version,
unhealthy_threshold_count,
health_check_timeout_seconds,
name,
vpc_id,
target_group_full_name,
healthy_threshold_count,
health_check_protocol,
target_group_attributes,
target_type,
health_check_port,
protocol,
target_group_name,
tags
FROM awscc.elasticloadbalancingv2.target_groups
WHERE
region = 'us-east-1' AND
Identifier = '{{ target_group_arn }}';
Lists all target_groups in a region.
SELECT
region,
target_group_arn
FROM awscc.elasticloadbalancingv2.target_groups_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new target_group resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.target_groups (
IpAddressType,
HealthCheckIntervalSeconds,
Matcher,
HealthCheckPath,
Port,
Targets,
HealthCheckEnabled,
ProtocolVersion,
UnhealthyThresholdCount,
HealthCheckTimeoutSeconds,
Name,
VpcId,
HealthyThresholdCount,
HealthCheckProtocol,
TargetGroupAttributes,
TargetType,
HealthCheckPort,
Protocol,
Tags,
region
)
SELECT
'{{ ip_address_type }}',
'{{ health_check_interval_seconds }}',
'{{ matcher }}',
'{{ health_check_path }}',
'{{ port }}',
'{{ targets }}',
'{{ health_check_enabled }}',
'{{ protocol_version }}',
'{{ unhealthy_threshold_count }}',
'{{ health_check_timeout_seconds }}',
'{{ name }}',
'{{ vpc_id }}',
'{{ healthy_threshold_count }}',
'{{ health_check_protocol }}',
'{{ target_group_attributes }}',
'{{ target_type }}',
'{{ health_check_port }}',
'{{ protocol }}',
'{{ tags }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.target_groups (
IpAddressType,
HealthCheckIntervalSeconds,
Matcher,
HealthCheckPath,
Port,
Targets,
HealthCheckEnabled,
ProtocolVersion,
UnhealthyThresholdCount,
HealthCheckTimeoutSeconds,
Name,
VpcId,
HealthyThresholdCount,
HealthCheckProtocol,
TargetGroupAttributes,
TargetType,
HealthCheckPort,
Protocol,
Tags,
region
)
SELECT
'{{ ip_address_type }}',
'{{ health_check_interval_seconds }}',
'{{ matcher }}',
'{{ health_check_path }}',
'{{ port }}',
'{{ targets }}',
'{{ health_check_enabled }}',
'{{ protocol_version }}',
'{{ unhealthy_threshold_count }}',
'{{ health_check_timeout_seconds }}',
'{{ name }}',
'{{ vpc_id }}',
'{{ healthy_threshold_count }}',
'{{ health_check_protocol }}',
'{{ target_group_attributes }}',
'{{ target_type }}',
'{{ health_check_port }}',
'{{ protocol }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: target_group
props:
- name: ip_address_type
value: '{{ ip_address_type }}'
- name: health_check_interval_seconds
value: '{{ health_check_interval_seconds }}'
- name: matcher
value:
grpc_code: '{{ grpc_code }}'
http_code: '{{ http_code }}'
- name: health_check_path
value: '{{ health_check_path }}'
- name: port
value: '{{ port }}'
- name: targets
value:
- port: '{{ port }}'
availability_zone: '{{ availability_zone }}'
id: '{{ id }}'
- name: health_check_enabled
value: '{{ health_check_enabled }}'
- name: protocol_version
value: '{{ protocol_version }}'
- name: unhealthy_threshold_count
value: '{{ unhealthy_threshold_count }}'
- name: health_check_timeout_seconds
value: '{{ health_check_timeout_seconds }}'
- name: name
value: '{{ name }}'
- name: vpc_id
value: '{{ vpc_id }}'
- name: healthy_threshold_count
value: '{{ healthy_threshold_count }}'
- name: health_check_protocol
value: '{{ health_check_protocol }}'
- name: target_group_attributes
value:
- value: '{{ value }}'
key: '{{ key }}'
- name: target_type
value: '{{ target_type }}'
- name: health_check_port
value: '{{ health_check_port }}'
- name: protocol
value: '{{ protocol }}'
- name: tags
value:
- value: '{{ value }}'
key: '{{ key }}'
UPDATE example
Use the following StackQL query and manifest file to update a target_group resource, using stack-deploy.
/*+ update */
UPDATE awscc.elasticloadbalancingv2.target_groups
SET PatchDocument = string('{{ {
"HealthCheckIntervalSeconds": health_check_interval_seconds,
"Matcher": matcher,
"HealthCheckPath": health_check_path,
"Targets": targets,
"HealthCheckEnabled": health_check_enabled,
"UnhealthyThresholdCount": unhealthy_threshold_count,
"HealthCheckTimeoutSeconds": health_check_timeout_seconds,
"HealthyThresholdCount": healthy_threshold_count,
"HealthCheckProtocol": health_check_protocol,
"TargetGroupAttributes": target_group_attributes,
"HealthCheckPort": health_check_port,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ target_group_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.elasticloadbalancingv2.target_groups
WHERE
Identifier = '{{ target_group_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the target_groups resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
elasticloadbalancing:DescribeTargetGroups,
elasticloadbalancing:DescribeTargetGroupAttributes,
elasticloadbalancing:DescribeTargetHealth,
elasticloadbalancing:DescribeTags
elasticloadbalancing:CreateTargetGroup,
elasticloadbalancing:DescribeTargetGroups,
elasticloadbalancing:RegisterTargets,
elasticloadbalancing:ModifyTargetGroupAttributes,
elasticloadbalancing:DescribeTargetHealth,
elasticloadbalancing:AddTags
elasticloadbalancing:DescribeTargetGroups,
elasticloadbalancing:ModifyTargetGroup,
elasticloadbalancing:ModifyTargetGroupAttributes,
elasticloadbalancing:RegisterTargets,
elasticloadbalancing:DescribeTargetHealth,
elasticloadbalancing:DeregisterTargets,
elasticloadbalancing:AddTags,
elasticloadbalancing:RemoveTags
elasticloadbalancing:DescribeTargetGroups
elasticloadbalancing:DeleteTargetGroup,
elasticloadbalancing:DescribeTargetGroups