Load Balancer Args
Provides an Elastic Load Balancer resource, also known as a "Classic Load Balancer" after the release of Application/Network Load Balancers.
NOTE on ELB Instances and ELB Attachments: This provider currently provides both a standalone ELB Attachment resource (describing an instance attached to an ELB), and an ELB resource with
instances
defined in-line. At this time you cannot use an ELB with in-line instances in conjunction with a ELB Attachment resources. Doing so will cause a conflict and will overwrite attachments.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elb.LoadBalancer;
import com.pulumi.aws.elb.LoadBalancerArgs;
import com.pulumi.aws.elb.inputs.LoadBalancerAccessLogsArgs;
import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
import com.pulumi.aws.elb.inputs.LoadBalancerHealthCheckArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var bar = new LoadBalancer("bar", LoadBalancerArgs.builder()
.availabilityZones(
"us-west-2a",
"us-west-2b",
"us-west-2c")
.accessLogs(LoadBalancerAccessLogsArgs.builder()
.bucket("foo")
.bucketPrefix("bar")
.interval(60)
.build())
.listeners(
LoadBalancerListenerArgs.builder()
.instancePort(8000)
.instanceProtocol("http")
.lbPort(80)
.lbProtocol("http")
.build(),
LoadBalancerListenerArgs.builder()
.instancePort(8000)
.instanceProtocol("http")
.lbPort(443)
.lbProtocol("https")
.sslCertificateId("arn:aws:iam::123456789012:server-certificate/certName")
.build())
.healthCheck(LoadBalancerHealthCheckArgs.builder()
.healthyThreshold(2)
.unhealthyThreshold(2)
.timeout(3)
.target("HTTP:8000/")
.interval(30)
.build())
.instances(aws_instance.foo().id())
.crossZoneLoadBalancing(true)
.idleTimeout(400)
.connectionDraining(true)
.connectionDrainingTimeout(400)
.tags(Map.of("Name", "foobar-elb"))
.build());
}
}
Note on ECDSA Key Algorithm
If the ARN of the ssl_certificate_id
that is pointed to references a certificate that was signed by an ECDSA key, note that ELB only supports the P256 and P384 curves. Using a certificate signed by a key using a different curve could produce the error ERR_SSL_VERSION_OR_CIPHER_MISMATCH
in your browser.
Import
ELBs can be imported using the name
, e.g.,
$ pulumi import aws:elasticloadbalancing/loadBalancer:LoadBalancer bar elb-production-12345
Constructors
Properties
An Access Logs block. Access Logs documented below.
The AZ's to serve traffic in.
Boolean to enable connection draining. Default: false
The time in seconds to allow for connections to drain. Default: 300
Enable cross-zone load balancing. Default: true
Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are monitor
, defensive
(default), strictest
.
A health_check block. Health Check documented below.
The time in seconds that the connection is allowed to be idle. Default: 60
A list of listener blocks. Listeners documented below.
Creates a unique name beginning with the specified prefix. Conflicts with name
.
A list of security group IDs to assign to the ELB. Only valid if creating an ELB within a VPC
The name of the security group that you can use as part of your inbound rules for your load balancer's back-end application instances. Use this for Classic or Default VPC only.
A map of tags to assign to the resource. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. Exactly one of availability_zones
or subnets
must be specified: this determines if the ELB exists in a VPC or in EC2-classic.