elb_target_group
Manage a target group for an Application or Network load balancer
Collection: community.aws
Full Name: community.aws.elb_target_group
Synopsis
Manage a target group for an Application or Network load balancer
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_key | str | |||
| aws_ca_bundle | path | |||
| aws_config | dict | |||
| debug_botocore_endpoint_logs | bool | false | ||
| deregistration_connection_termination | bool | false | ||
| deregistration_delay_timeout | int | |||
| endpoint_url | str | |||
| health_check_interval | int | |||
| health_check_path | str | |||
| health_check_port | str | |||
| health_check_protocol | str | |||
| health_check_timeout | int | |||
| healthy_threshold_count | int | |||
| load_balancing_algorithm_type | str | |||
| modify_targets | bool | true | ||
| name | str | yes | ||
| port | int | |||
| preserve_client_ip_enabled | bool | |||
| profile | str | |||
| protocol | str | |||
| protocol_version | str | |||
| proxy_protocol_v2_enabled | bool | |||
| purge_tags | bool | true | ||
| region | str | |||
| secret_key | str | |||
| session_token | str | |||
| state | str | yes | ||
| stickiness_app_cookie_duration | int | |||
| stickiness_app_cookie_name | str | |||
| stickiness_enabled | bool | |||
| stickiness_lb_cookie_duration | int | |||
| stickiness_type | str | |||
| successful_response_codes | str | |||
| tags | dict | |||
| target_type | str | |||
| targets | list | |||
| unhealthy_threshold_count | int | |||
| validate_certs | bool | true | ||
| vpc_id | str | |||
| wait | bool | false | ||
| wait_timeout | int | 200 |
Example
yaml
- name: Create a target group with a default health check
community.aws.elb_target_group:
name: mytargetgroup
protocol: http
port: 80
vpc_id: vpc-01234567
state: present
- name: Create a target group with protocol_version 'GRPC'
community.aws.elb_target_group:
name: mytargetgroup
protocol: http
port: 80
vpc_id: vpc-01234567
protocol_version: GRPC
state: present
- name: Modify the target group with a custom health check
community.aws.elb_target_group:
name: mytargetgroup
protocol: http
port: 80
vpc_id: vpc-01234567
health_check_protocol: http
health_check_path: /health_check
health_check_port: 80
successful_response_codes: 200
health_check_interval: 15
health_check_timeout: 3
healthy_threshold_count: 4
unhealthy_threshold_count: 3
state: present
- name: Delete a target group
community.aws.elb_target_group:
name: mytargetgroup
state: absent
- name: Create a target group with instance targets
community.aws.elb_target_group:
name: mytargetgroup
protocol: http
port: 81
vpc_id: vpc-01234567
health_check_protocol: http
health_check_path: /
successful_response_codes: "200,250-260"
targets:
- Id: i-01234567
Port: 80
- Id: i-98765432
Port: 80
state: present
wait_timeout: 200
wait: true
- name: Create a target group with IP address targets
community.aws.elb_target_group:
name: mytargetgroup
protocol: http
port: 81
vpc_id: vpc-01234567
health_check_protocol: http
health_check_path: /
successful_response_codes: "200,250-260"
target_type: ip
targets:
- Id: 10.0.0.10
Port: 80
AvailabilityZone: all
- Id: 10.0.0.20
Port: 80
state: present
wait_timeout: 200
wait: true
# Using lambda as targets require that the target group
# itself is allow to invoke the lambda function.
# therefore you need first to create an empty target group
# to receive its arn, second, allow the target group
# to invoke the lambda function and third, add the target
# to the target group
- name: first, create empty target group
community.aws.elb_target_group:
name: my-lambda-targetgroup
target_type: lambda
state: present
modify_targets: false
register: out
- name: third, add target
community.aws.elb_target_group:
name: my-lambda-targetgroup
target_type: lambda
state: present
targets:
- Id: arn:aws:lambda:eu-central-1:123456789012:function:my-lambda-function