github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/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 ~> **NOTE on ELB Instances and ELB Attachments:** Terraform currently 14 provides both a standalone [ELB Attachment resource](elb_attachment.html) 15 (describing an instance attached to an ELB), and an ELB resource with 16 `instances` defined in-line. At this time you cannot use an ELB with in-line 17 instaces in conjunction with a ELB Attachment resources. Doing so will cause a 18 conflict and will overwrite attachments. 19 ## Example Usage 20 21 ``` 22 # Create a new load balancer 23 resource "aws_elb" "bar" { 24 name = "foobar-terraform-elb" 25 availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] 26 27 access_logs { 28 bucket = "foo" 29 bucket_prefix = "bar" 30 interval = 60 31 } 32 33 listener { 34 instance_port = 8000 35 instance_protocol = "http" 36 lb_port = 80 37 lb_protocol = "http" 38 } 39 40 listener { 41 instance_port = 8000 42 instance_protocol = "http" 43 lb_port = 443 44 lb_protocol = "https" 45 ssl_certificate_id = "arn:aws:iam::123456789012:server-certificate/certName" 46 } 47 48 health_check { 49 healthy_threshold = 2 50 unhealthy_threshold = 2 51 timeout = 3 52 target = "HTTP:8000/" 53 interval = 30 54 } 55 56 instances = ["${aws_instance.foo.id}"] 57 cross_zone_load_balancing = true 58 idle_timeout = 400 59 connection_draining = true 60 connection_draining_timeout = 400 61 62 tags { 63 Name = "foobar-terraform-elb" 64 } 65 } 66 ``` 67 68 ## Argument Reference 69 70 The following arguments are supported: 71 72 * `name` - (Optional) The name of the ELB. By default generated by terraform. 73 * `access_logs` - (Optional) An Access Logs block. Access Logs documented below. 74 * `availability_zones` - (Required for an EC2-classic ELB) The AZ's to serve traffic in. 75 * `security_groups` - (Optional) A list of security group IDs to assign to the ELB. 76 Only valid if creating an ELB within a VPC 77 * `subnets` - (Required for a VPC ELB) A list of subnet IDs to attach to the ELB. 78 * `instances` - (Optional) A list of instance ids to place in the ELB pool. 79 * `internal` - (Optional) If true, ELB will be an internal ELB. 80 * `listener` - (Required) A list of listener blocks. Listeners documented below. 81 * `health_check` - (Optional) A health_check block. Health Check documented below. 82 * `cross_zone_load_balancing` - (Optional) Enable cross-zone load balancing. Default: `true` 83 * `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Default: 60. 84 * `connection_draining` - (Optional) Boolean to enable connection draining. 85 * `connection_draining_timeout` - (Optional) The time in seconds to allow for connections to drain. 86 * `tags` - (Optional) A mapping of tags to assign to the resource. 87 88 Exactly one of `availability_zones` or `subnets` must be specified: this 89 determines if the ELB exists in a VPC or in EC2-classic. 90 91 Access Logs support the following: 92 93 * `bucket` - (Required) The S3 bucket name to store the logs in. 94 * `bucket_prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured. 95 * `interval` - (Optional) The publishing interval in minutes. Default: 60 minutes. 96 97 Listeners support the following: 98 99 * `instance_port` - (Required) The port on the instance to route to 100 * `instance_protocol` - (Required) The protocol to use to the instance. Valid 101 values are `HTTP`, `HTTPS`, `TCP`, or `SSL` 102 * `lb_port` - (Required) The port to listen on for the load balancer 103 * `lb_protocol` - (Required) The protocol to listen on. Valid values are `HTTP`, 104 `HTTPS`, `TCP`, or `SSL` 105 * `ssl_certificate_id` - (Optional) The ARN of an SSL certificate you have 106 uploaded to AWS IAM. **Only valid when `lb_protocol` is either HTTPS or SSL** 107 108 Health Check supports the following: 109 110 * `healthy_threshold` - (Required) The number of checks before the instance is declared healthy. 111 * `unhealthy_threshold` - (Required) The number of checks before the instance is declared unhealthy. 112 * `target` - (Required) The target of the check. 113 * `interval` - (Required) The interval between checks. 114 * `timeout` - (Required) The length of time before the check times out. 115 116 ## Attributes Reference 117 118 The following attributes are exported: 119 120 * `id` - The name of the ELB 121 * `name` - The name of the ELB 122 * `dns_name` - The DNS name of the ELB 123 * `instances` - The list of instances in the ELB 124 * `source_security_group` - The name of the security group that you can use as 125 part of your inbound rules for your load balancer's back-end application 126 instances. Use this for Classic or Default VPC only. 127 * `source_security_group_id` - The ID of the security group that you can use as 128 part of your inbound rules for your load balancer's back-end application 129 instances. Only available on ELBs launched in a VPC. 130 * `zone_id` - The canonical hosted zone ID of the ELB (to be used in a Route 53 Alias record)