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.
Parameters
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.
aws_elb
Ensure your ALB blocks unwanted access
It is better to limit accessibility to the minimum that is required for the application to work.
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
-
AccessLoggingPolicy
optional - AccessLoggingPolicy -
AppCookieStickinessPolicy
optional - List of AppCookieStickinessPolicy -
AvailabilityZones
optional - List -
ConnectionDrainingPolicy
optional - ConnectionDrainingPolicy -
ConnectionSettings
optional - ConnectionSettings -
CrossZone
optional - Boolean -
HealthCheck
optional - HealthCheck -
Instances
optional - List -
LBCookieStickinessPolicy
optional - List of LBCookieStickinessPolicy -
Listeners
required - List of Listeners -
LoadBalancerName
optional - String -
Policies
optional - List of Policies -
Scheme
optional - String -
SecurityGroups
optional - List -
Subnets
optional - List -
Tags
optional - List of Tag
Explanation in CloudFormation Registry
Specifies a Classic Load Balancer.
You can specify the
AvailabilityZones
orSubnets
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.