github.com/armen/terraform@v0.5.2-0.20150529052519-caa8117a08f1/website/source/docs/providers/aws/r/elb.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_elb" 4 sidebar_current: "docs-aws-resource-elb" 5 description: |- 6 Provides an Elastic Load Balancer resource. 7 --- 8 9 # aws\_elb 10 11 Provides an Elastic Load Balancer resource. 12 13 ## Example Usage 14 15 ``` 16 # Create a new load balancer 17 resource "aws_elb" "bar" { 18 name = "foobar-terraform-elb" 19 availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] 20 21 listener { 22 instance_port = 8000 23 instance_protocol = "http" 24 lb_port = 80 25 lb_protocol = "http" 26 } 27 28 listener { 29 instance_port = 8000 30 instance_protocol = "http" 31 lb_port = 443 32 lb_protocol = "https" 33 ssl_certificate_id = "arn:aws:iam::123456789012:server-certificate/certName" 34 } 35 36 health_check { 37 healthy_threshold = 2 38 unhealthy_threshold = 2 39 timeout = 3 40 target = "HTTP:8000/" 41 interval = 30 42 } 43 44 instances = ["${aws_instance.foo.id}"] 45 cross_zone_load_balancing = true 46 idle_timeout = 400 47 connection_draining = true 48 connection_draining_timeout = 400 49 } 50 ``` 51 52 ## Argument Reference 53 54 The following arguments are supported: 55 56 * `name` - (Required) The name of the ELB 57 * `availability_zones` - (Required for an EC2-classic ELB) The AZ's to serve traffic in. 58 * `security_groups` - (Optional) A list of security group IDs to assign to the ELB. 59 * `subnets` - (Required for a VPC ELB) A list of subnet IDs to attach to the ELB. 60 * `instances` - (Optional) A list of instance ids to place in the ELB pool. 61 * `internal` - (Optional) If true, ELB will be an internal ELB. 62 * `listener` - (Required) A list of listener blocks. Listeners documented below. 63 * `health_check` - (Optional) A health_check block. Health Check documented below. 64 * `cross_zone_load_balancing` - (Optional) Enable cross-zone load balancing. 65 * `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Default: 60. 66 * `connection_draining` - (Optional) Boolean to enable connection draining. 67 * `connection_draining_timeout` - (Optional) The time in seconds to allow for connections to drain. 68 69 Exactly one of `availability_zones` or `subnets` must be specified: this 70 determines if the ELB exists in a VPC or in EC2-classic. 71 72 Listeners support the following: 73 74 * `instance_port` - (Required) The port on the instance to route to 75 * `instance_protocol` - (Required) The protocol to use to the instance. 76 * `lb_port` - (Required) The port to listen on for the load balancer 77 * `lb_protocol` - (Required) The protocol to listen on. 78 * `ssl_certificate_id` - (Optional) The id of an SSL certificate you have uploaded to AWS IAM. 79 80 Health Check supports the following: 81 82 * `healthy_threshold` - (Required) The number of checks before the instance is declared healthy. 83 * `unhealthy_threshold` - (Required) The number of checks before the instance is declared unhealthy. 84 * `target` - (Required) The target of the check. 85 * `interval` - (Required) The interval between checks. 86 * `timeout` - (Required) The length of time before the check times out. 87 88 ## Attributes Reference 89 90 The following attributes are exported: 91 92 * `id` - The name of the ELB 93 * `name` - The name of the ELB 94 * `dns_name` - The DNS name of the ELB 95 * `instances` - The list of instances in the ELB 96 * `source_security_group` - The name of the security group that you can use as 97 part of your inbound rules for your load balancer's back-end application 98 instances. 99 * `zone_id` - The canonical hosted zone ID of the ELB (to be used in a Route 53 Alias record)