2014-07-24 03:16:36 +02:00
|
|
|
---
|
|
|
|
layout: "aws"
|
|
|
|
page_title: "AWS: aws_elb"
|
|
|
|
sidebar_current: "docs-aws-resource-elb"
|
2014-10-22 05:21:56 +02:00
|
|
|
description: |-
|
|
|
|
Provides an Elastic Load Balancer resource.
|
2014-07-24 03:16:36 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# aws\_elb
|
|
|
|
|
|
|
|
Provides an Elastic Load Balancer resource.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
|
|
|
# Create a new load balancer
|
|
|
|
resource "aws_elb" "bar" {
|
|
|
|
name = "foobar-terraform-elb"
|
|
|
|
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
|
|
|
|
|
|
|
|
listener {
|
|
|
|
instance_port = 8000
|
|
|
|
instance_protocol = "http"
|
|
|
|
lb_port = 80
|
|
|
|
lb_protocol = "http"
|
|
|
|
}
|
|
|
|
|
2014-08-11 01:09:05 +02:00
|
|
|
listener {
|
|
|
|
instance_port = 8000
|
|
|
|
instance_protocol = "http"
|
|
|
|
lb_port = 443
|
|
|
|
lb_protocol = "https"
|
2014-10-22 05:21:56 +02:00
|
|
|
ssl_certificate_id = "arn:aws:iam::123456789012:server-certificate/certName"
|
2014-08-11 01:09:05 +02:00
|
|
|
}
|
|
|
|
|
2014-07-30 14:14:18 +02:00
|
|
|
health_check {
|
|
|
|
healthy_threshold = 2
|
|
|
|
unhealthy_threshold = 2
|
|
|
|
timeout = 3
|
|
|
|
target = "HTTP:8000/"
|
|
|
|
interval = 30
|
|
|
|
}
|
|
|
|
|
2014-07-24 03:16:36 +02:00
|
|
|
instances = ["${aws_instance.foo.id}"]
|
2014-12-10 08:23:51 +01:00
|
|
|
cross_zone_load_balancing = true
|
2015-04-13 22:14:26 +02:00
|
|
|
idle_timeout = 400
|
|
|
|
connection_draining = true
|
|
|
|
connection_draining_timeout = 400
|
2014-07-24 03:16:36 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) The name of the ELB
|
2015-02-10 17:10:03 +01:00
|
|
|
* `availability_zones` - (Required for an EC2-classic ELB) The AZ's to serve traffic in.
|
2015-01-14 18:28:25 +01:00
|
|
|
* `security_groups` - (Optional) A list of security group IDs to assign to the ELB.
|
2015-02-10 17:10:03 +01:00
|
|
|
* `subnets` - (Required for a VPC ELB) A list of subnet IDs to attach to the ELB.
|
2015-01-14 18:28:25 +01:00
|
|
|
* `instances` - (Optional) A list of instance ids to place in the ELB pool.
|
2014-09-30 22:30:15 +02:00
|
|
|
* `internal` - (Optional) If true, ELB will be an internal ELB.
|
2015-01-14 18:28:25 +01:00
|
|
|
* `listener` - (Required) A list of listener blocks. Listeners documented below.
|
2014-08-22 02:08:51 +02:00
|
|
|
* `health_check` - (Optional) A health_check block. Health Check documented below.
|
2014-12-10 08:23:51 +01:00
|
|
|
* `cross_zone_load_balancing` - (Optional) Enable cross-zone load balancing.
|
2015-04-23 11:46:52 +02:00
|
|
|
* `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Default: 60.
|
2015-04-13 22:14:26 +02:00
|
|
|
* `connection_draining` - (Optional) Boolean to enable connection draining.
|
|
|
|
* `connection_draining_timeout` - (Optional) The time in seconds to allow for connections to drain.
|
2014-07-24 03:16:36 +02:00
|
|
|
|
2015-02-10 17:10:03 +01:00
|
|
|
Exactly one of `availability_zones` or `subnets` must be specified: this
|
|
|
|
determines if the ELB exists in a VPC or in EC2-classic.
|
|
|
|
|
2014-07-24 03:16:36 +02:00
|
|
|
Listeners support the following:
|
|
|
|
|
|
|
|
* `instance_port` - (Required) The port on the instance to route to
|
|
|
|
* `instance_protocol` - (Required) The the protocol to use to the instance.
|
|
|
|
* `lb_port` - (Required) The port to listen on for the load balancer
|
|
|
|
* `lb_protocol` - (Required) The protocol to listen on.
|
2014-08-11 01:09:05 +02:00
|
|
|
* `ssl_certificate_id` - (Optional) The id of an SSL certificate you have uploaded to AWS IAM.
|
2014-07-24 03:16:36 +02:00
|
|
|
|
2014-07-30 14:14:18 +02:00
|
|
|
Health Check supports the following:
|
|
|
|
|
|
|
|
* `healthy_threshold` - (Required) The number of checks before the instance is declared healthy.
|
|
|
|
* `unhealthy_threshold` - (Required) The number of checks before the instance is declared unhealthy.
|
|
|
|
* `target` - (Required) The target of the check.
|
|
|
|
* `interval` - (Required) The interval between checks.
|
|
|
|
* `timeout` - (Required) The length of time before the check times out.
|
|
|
|
|
2014-07-24 03:16:36 +02:00
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
|
|
|
* `id` - The name of the ELB
|
|
|
|
* `name` - The name of the ELB
|
|
|
|
* `dns_name` - The DNS name of the ELB
|
2015-01-14 18:28:25 +01:00
|
|
|
* `instances` - The list of instances in the ELB
|