AWS Elastic Load Balancing V2 Target Group Attachment
This page shows how to write Terraform and CloudFormation for Elastic Load Balancing V2 Target Group Attachment and write them securely.
aws_lb_target_group_attachment (Terraform)
The Target Group Attachment in Elastic Load Balancing V2 can be configured in Terraform with the resource name aws_lb_target_group_attachment
. The following sections describe 2 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_lb_target_group_attachment" "Final_alb_tg_ass_a" {
target_group_arn = aws_lb_target_group.Final_alb_tg.arn
target_id = aws_instance.Final_web[0].id
port = 80
}
resource "aws_lb_target_group_attachment" "tga_template_a" {
target_group_arn = aws_lb_target_group.ltg_template.arn
target_id = var.tga_target_a.id
}
Parameters
-
availability_zone
optional - string -
id
optional computed - string -
port
optional - number -
target_group_arn
required - string -
target_id
required - string
Explanation in Terraform Registry
Provides the ability to register instances and containers with an Application Load Balancer (ALB) or Network Load Balancer (NLB) target group. For attaching resources with Elastic Load Balancer (ELB), see the
aws_elb_attachment
resource.Note:
aws_alb_target_group_attachment
is known asaws_lb_target_group_attachment
. The functionality is identical.
AWS::ElasticLoadBalancingV2::TargetGroup Matcher (CloudFormation)
The TargetGroup Matcher in ElasticLoadBalancingV2 can be configured in CloudFormation with the resource name AWS::ElasticLoadBalancingV2::TargetGroup Matcher
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
GrpcCode
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.
Required: No
Type: String
Update requires: No interruption
HttpCode
For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").
For Network Load Balancers and Gateway Load Balancers, this must be "200–399".
Note that when using shorthand syntax, some values such as commas need to be escaped.
Required: No
Type: String
Update requires: No interruption
Explanation in CloudFormation Registry
Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check.
Frequently asked questions
What is AWS Elastic Load Balancing V2 Target Group Attachment?
AWS Elastic Load Balancing V2 Target Group Attachment is a resource for Elastic Load Balancing V2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Elastic Load Balancing V2 Target Group Attachment?
For Terraform, the yoen1905/Final_Terraform and ivanykp/ci source code examples are useful. See the Terraform Example section for further details.