github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/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    tags {
    51      Name = "foobar-terraform-elb"
    52    }
    53  }
    54  ```
    55  
    56  ## Argument Reference
    57  
    58  The following arguments are supported:
    59  
    60  * `name` - (Optional) The name of the ELB. By default generated by terraform.
    61  * `availability_zones` - (Required for an EC2-classic ELB) The AZ's to serve traffic in.
    62  * `security_groups` - (Optional) A list of security group IDs to assign to the ELB.
    63  * `subnets` - (Required for a VPC ELB) A list of subnet IDs to attach to the ELB.
    64  * `instances` - (Optional) A list of instance ids to place in the ELB pool.
    65  * `internal` - (Optional) If true, ELB will be an internal ELB.
    66  * `listener` - (Required) A list of listener blocks. Listeners documented below.
    67  * `health_check` - (Optional) A health_check block. Health Check documented below.
    68  * `cross_zone_load_balancing` - (Optional) Enable cross-zone load balancing.
    69  * `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Default: 60.
    70  * `connection_draining` - (Optional) Boolean to enable connection draining.
    71  * `connection_draining_timeout` - (Optional) The time in seconds to allow for connections to drain. 
    72  * `tags` - (Optional) A mapping of tags to assign to the resource.
    73  
    74  Exactly one of `availability_zones` or `subnets` must be specified: this
    75  determines if the ELB exists in a VPC or in EC2-classic.
    76  
    77  Listeners support the following:
    78  
    79  * `instance_port` - (Required) The port on the instance to route to
    80  * `instance_protocol` - (Required) The protocol to use to the instance.
    81  * `lb_port` - (Required) The port to listen on for the load balancer
    82  * `lb_protocol` - (Required) The protocol to listen on.
    83  * `ssl_certificate_id` - (Optional) The id of an SSL certificate you have uploaded to AWS IAM.
    84  
    85  Health Check supports the following:
    86  
    87  * `healthy_threshold` - (Required) The number of checks before the instance is declared healthy.
    88  * `unhealthy_threshold` - (Required) The number of checks before the instance is declared unhealthy.
    89  * `target` - (Required) The target of the check.
    90  * `interval` - (Required) The interval between checks.
    91  * `timeout` - (Required) The length of time before the check times out.
    92  
    93  ## Attributes Reference
    94  
    95  The following attributes are exported:
    96  
    97  * `id` - The name of the ELB
    98  * `name` - The name of the ELB
    99  * `dns_name` - The DNS name of the ELB
   100  * `instances` - The list of instances in the ELB
   101  * `source_security_group` - The name of the security group that you can use as
   102    part of your inbound rules for your load balancer's back-end application
   103    instances.
   104  * `zone_id` - The canonical hosted zone ID of the ELB (to be used in a Route 53 Alias record)