LoadBalancer

Deprecated

aws.applicationloadbalancing.LoadBalancer has been deprecated in favor of aws.alb.LoadBalancer

Provides a Load Balancer resource.

Note: aws.alb.LoadBalancer is known as aws.lb.LoadBalancer. The functionality is identical.

Example Usage

Application Load Balancer

No Java example available.

Network Load Balancer

No Java example available.

Specifying Elastic IPs

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lb.LoadBalancer;
import com.pulumi.aws.lb.LoadBalancerArgs;
import com.pulumi.aws.lb.inputs.LoadBalancerSubnetMappingArgs;
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 example = new LoadBalancer("example", LoadBalancerArgs.builder()
.loadBalancerType("network")
.subnetMappings(
LoadBalancerSubnetMappingArgs.builder()
.subnetId(aws_subnet.example1().id())
.allocationId(aws_eip.example1().id())
.build(),
LoadBalancerSubnetMappingArgs.builder()
.subnetId(aws_subnet.example2().id())
.allocationId(aws_eip.example2().id())
.build())
.build());
}
}

Specifying private IP addresses for an internal-facing load balancer

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lb.LoadBalancer;
import com.pulumi.aws.lb.LoadBalancerArgs;
import com.pulumi.aws.lb.inputs.LoadBalancerSubnetMappingArgs;
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 example = new LoadBalancer("example", LoadBalancerArgs.builder()
.loadBalancerType("network")
.subnetMappings(
LoadBalancerSubnetMappingArgs.builder()
.subnetId(aws_subnet.example1().id())
.privateIpv4Address("10.0.1.15")
.build(),
LoadBalancerSubnetMappingArgs.builder()
.subnetId(aws_subnet.example2().id())
.privateIpv4Address("10.0.2.15")
.build())
.build());
}
}

Import

LBs can be imported using their ARN, e.g.,

$ pulumi import aws:applicationloadbalancing/loadBalancer:LoadBalancer bar arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188

Properties

Link copied to clipboard

An Access Logs block. Access Logs documented below.

Link copied to clipboard
val arn: Output<String>

The ARN of the load balancer (matches id).

Link copied to clipboard
val arnSuffix: Output<String>

The ARN suffix for use with CloudWatch Metrics.

Link copied to clipboard

The ID of the customer owned ipv4 pool to use for this load balancer.

Link copied to clipboard

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.

Link copied to clipboard
val dnsName: Output<String>

The DNS name of the load balancer.

Link copied to clipboard

Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type application.

Link copied to clipboard

If true, cross-zone load balancing of the load balancer will be enabled. This is a network load balancer feature. Defaults to false.

Link copied to clipboard

If true, deletion of the load balancer will be disabled via the AWS API. This will prevent this provider from deleting the load balancer. Defaults to false.

Link copied to clipboard
val enableHttp2: Output<Boolean>?

Indicates whether HTTP/2 is enabled in application load balancers. Defaults to true.

Link copied to clipboard

Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to false.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val idleTimeout: Output<Int>?

The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type application. Default: 60.

Link copied to clipboard
val internal: Output<Boolean>

If true, the LB will be internal.

Link copied to clipboard
val ipAddressType: Output<String>

The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack.

Link copied to clipboard
val loadBalancerType: Output<String>?

The type of load balancer to create. Possible values are application, gateway, or network. The default value is application.

Link copied to clipboard
val name: Output<String>

The name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified, this provider will autogenerate a name beginning with tf-lb.

Link copied to clipboard
val namePrefix: Output<String>?

Creates a unique name beginning with the specified prefix. Conflicts with name.

Link copied to clipboard

Indicates whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. Defaults to false.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val securityGroups: Output<List<String>>

A list of security group IDs to assign to the LB. Only valid for Load Balancers of type application.

Link copied to clipboard

A subnet mapping block as documented below.

Link copied to clipboard
val subnets: Output<List<String>>

A list of subnet IDs to attach to the LB. Subnets cannot be updated for Load Balancers of type network. Changing this value for load balancers of type network will force a recreation of the resource.

Link copied to clipboard
val tags: Output<Map<String, String>>?

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.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>
Link copied to clipboard
val zoneId: Output<String>

The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record).