Load Balancer Args
Provides a Load Balancer resource.
Note:
aws.alb.LoadBalancer
is known asaws.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
Properties
An Access Logs block. Access Logs documented below.
The ID of the customer owned ipv4 pool to use for this load balancer.
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
.
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
.
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
.
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
.
Indicates whether HTTP/2 is enabled in application
load balancers. Defaults to true
.
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
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
.
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
.
The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type application
. Default: 60.
The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4
and dualstack
.
The type of load balancer to create. Possible values are application
, gateway
, or network
. The default value is application
.
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
.
Creates a unique name beginning with the specified prefix. Conflicts with name
.
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
.
A list of security group IDs to assign to the LB. Only valid for Load Balancers of type application
.
A subnet mapping block as documented below.
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
.