LoadBalancerArgs

data class LoadBalancerArgs constructor(val accessLogs: Output<LoadBalancerAccessLogsArgs>? = null, val customerOwnedIpv4Pool: Output<String>? = null, val desyncMitigationMode: Output<String>? = null, val dropInvalidHeaderFields: Output<Boolean>? = null, val enableCrossZoneLoadBalancing: Output<Boolean>? = null, val enableDeletionProtection: Output<Boolean>? = null, val enableHttp2: Output<Boolean>? = null, val enableTlsVersionAndCipherSuiteHeaders: Output<Boolean>? = null, val enableWafFailOpen: Output<Boolean>? = null, val enableXffClientPort: Output<Boolean>? = null, val idleTimeout: Output<Int>? = null, val internal: Output<Boolean>? = null, val ipAddressType: Output<String>? = null, val loadBalancerType: Output<String>? = null, val name: Output<String>? = null, val namePrefix: Output<String>? = null, val preserveHostHeader: Output<Boolean>? = null, val securityGroups: Output<List<String>>? = null, val subnetMappings: Output<List<LoadBalancerSubnetMappingArgs>>? = null, val subnets: Output<List<String>>? = null, val tags: Output<Map<String, String>>? = null, val xffHeaderProcessingMode: Output<String>? = null) : ConvertibleToJava<LoadBalancerArgs>

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:elasticloadbalancingv2/loadBalancer:LoadBalancer bar arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188

Constructors

Link copied to clipboard
constructor(accessLogs: Output<LoadBalancerAccessLogsArgs>? = null, customerOwnedIpv4Pool: Output<String>? = null, desyncMitigationMode: Output<String>? = null, dropInvalidHeaderFields: Output<Boolean>? = null, enableCrossZoneLoadBalancing: Output<Boolean>? = null, enableDeletionProtection: Output<Boolean>? = null, enableHttp2: Output<Boolean>? = null, enableTlsVersionAndCipherSuiteHeaders: Output<Boolean>? = null, enableWafFailOpen: Output<Boolean>? = null, enableXffClientPort: Output<Boolean>? = null, idleTimeout: Output<Int>? = null, internal: Output<Boolean>? = null, ipAddressType: Output<String>? = null, loadBalancerType: Output<String>? = null, name: Output<String>? = null, namePrefix: Output<String>? = null, preserveHostHeader: Output<Boolean>? = null, securityGroups: Output<List<String>>? = null, subnetMappings: Output<List<LoadBalancerSubnetMappingArgs>>? = null, subnets: Output<List<String>>? = null, tags: Output<Map<String, String>>? = null, xffHeaderProcessingMode: Output<String>? = null)

Properties

Link copied to clipboard

An Access Logs block. Access Logs documented below.

Link copied to clipboard
val customerOwnedIpv4Pool: Output<String>? = null

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

Link copied to clipboard
val desyncMitigationMode: Output<String>? = null

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 dropInvalidHeaderFields: Output<Boolean>? = null

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. For network and gateway type load balancers, this feature is disabled by default (false). For application load balancer this feature is always enabled (true) and cannot be disabled. Defaults to false.

Link copied to clipboard
val enableDeletionProtection: Output<Boolean>? = null

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>? = null

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

Link copied to clipboard

Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. Only valid for Load Balancers of type application. Defaults to false

Link copied to clipboard
val enableWafFailOpen: Output<Boolean>? = null

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 enableXffClientPort: Output<Boolean>? = null

Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer in application load balancers. Defaults to false.

Link copied to clipboard
val idleTimeout: Output<Int>? = null

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>? = null

If true, the LB will be internal. Defaults to false.

Link copied to clipboard
val ipAddressType: Output<String>? = null

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>? = null

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>? = null

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>? = null

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

Link copied to clipboard
val preserveHostHeader: Output<Boolean>? = null

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
val securityGroups: Output<List<String>>? = null

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>>? = null

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>>? = null

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 xffHeaderProcessingMode: Output<String>? = null

Determines how the load balancer modifies the X-Forwarded-For header in the HTTP request before sending the request to the target. The possible values are append, preserve, and remove. Only valid for Load Balancers of type application. The default is append.

Functions

Link copied to clipboard
open override fun toJava(): LoadBalancerArgs