AWS Elastic Load Balancing Attachment

This page shows how to write Terraform and CloudFormation for Elastic Load Balancing Attachment and write them securely.

aws_elb_attachment (Terraform)

The Attachment in Elastic Load Balancing can be configured in Terraform with the resource name aws_elb_attachment. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

  • elb required - string
  • id optional computed - string
  • instance required - string

Explanation in Terraform Registry

Attaches an EC2 instance to an Elastic Load Balancer (ELB). For attaching resources with Application Load Balancer (ALB) or Network Load Balancer (NLB), see the aws_lb_target_group_attachment resource.

NOTE on ELB Instances and ELB Attachments: Terraform currently provides both a standalone ELB Attachment resource (describing an instance attached to an ELB), and an Elastic Load Balancer resource with instances defined in-line. At this time you cannot use an ELB with in-line instances in conjunction with an ELB Attachment resource. Doing so will cause a conflict and will overwrite attachments.

Tips: Best Practices for The Other AWS Elastic Load Balancing Resources

In addition to the aws_elb, AWS Elastic Load Balancing has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_elb

Ensure to drop invalid headers at Elastic Load Balancing

It's better to drop them at Elastic Load Balancing. Passing invalid headers to the applications might cause issues like HTTP Request Smuggling.

Review your AWS Elastic Load Balancing settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::ElasticLoadBalancing::LoadBalancer (CloudFormation)

The LoadBalancer in ElasticLoadBalancing can be configured in CloudFormation with the resource name AWS::ElasticLoadBalancing::LoadBalancer. 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

Explanation in CloudFormation Registry

Specifies a Classic Load Balancer.

You can specify the AvailabilityZones or Subnets property, but not both.

If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn attribute to declare a dependency on the VPC-gateway attachment.

Frequently asked questions

What is AWS Elastic Load Balancing Attachment?

AWS Elastic Load Balancing Attachment is a resource for Elastic Load Balancing of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.