PARALLAX

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

NameTypeRequiredDefaultDescription
access_keystr
aws_ca_bundlepath
aws_configdict
debug_botocore_endpoint_logsboolfalse
deregistration_connection_terminationboolfalse
deregistration_delay_timeoutint
endpoint_urlstr
health_check_intervalint
health_check_pathstr
health_check_portstr
health_check_protocolstr
health_check_timeoutint
healthy_threshold_countint
load_balancing_algorithm_typestr
modify_targetsbooltrue
namestryes
portint
preserve_client_ip_enabledbool
profilestr
protocolstr
protocol_versionstr
proxy_protocol_v2_enabledbool
purge_tagsbooltrue
regionstr
secret_keystr
session_tokenstr
statestryes
stickiness_app_cookie_durationint
stickiness_app_cookie_namestr
stickiness_enabledbool
stickiness_lb_cookie_durationint
stickiness_typestr
successful_response_codesstr
tagsdict
target_typestr
targetslist
unhealthy_threshold_countint
validate_certsbooltrue
vpc_idstr
waitboolfalse
wait_timeoutint200

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
Search
    ↑ ↓ move↵ openesc close