Package com.pulumi.aws.lb
Class LoadBalancer
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.lb.LoadBalancer
-
public class LoadBalancer extends com.pulumi.resources.CustomResourceProvides a Load Balancer resource. > **Note:** `aws.alb.LoadBalancer` is known as `aws.lb.LoadBalancer`. The functionality is identical. ## Example Usage ### Application Load Balancer ### Network Load Balancer ### Specifying Elastic IPs
### Specifying private IP addresses for an internal-facing load balancerpackage 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.ArrayList; import java.util.Arrays; 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() .subnetMappings( LoadBalancerSubnetMappingArgs.builder() .subnetId(example1.id()) .allocationId(example1AwsEip.id()) .build(), LoadBalancerSubnetMappingArgs.builder() .subnetId(example2.id()) .allocationId(example2AwsEip.id()) .build()) .name("example") .loadBalancerType("network") .build()); } }
## Import ### Identity Schema #### Required - `arn` (String) ARN of the load balancer. Using `pulumi import`, import LBs using their ARN. For example: ```sh $ pulumi import aws:lb/loadBalancer:LoadBalancer bar arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 ```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.ArrayList; import java.util.Arrays; 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() .subnetMappings( LoadBalancerSubnetMappingArgs.builder() .subnetId(example1.id()) .privateIpv4Address("10.0.1.15") .build(), LoadBalancerSubnetMappingArgs.builder() .subnetId(example2.id()) .privateIpv4Address("10.0.2.15") .build()) .name("example") .loadBalancerType("network") .build()); } }
-
-
Constructor Summary
Constructors Constructor Description LoadBalancer(java.lang.String name)LoadBalancer(java.lang.String name, LoadBalancerArgs args)LoadBalancer(java.lang.String name, LoadBalancerArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Optional<LoadBalancerAccessLogs>>accessLogs()com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.lang.String>arnSuffix()com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>clientKeepAlive()com.pulumi.core.Output<java.util.Optional<LoadBalancerConnectionLogs>>connectionLogs()com.pulumi.core.Output<java.util.Optional<java.lang.String>>customerOwnedIpv4Pool()com.pulumi.core.Output<java.util.Optional<java.lang.String>>desyncMitigationMode()com.pulumi.core.Output<java.lang.String>dnsName()com.pulumi.core.Output<java.util.Optional<java.lang.String>>dnsRecordClientRoutingPolicy()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>dropInvalidHeaderFields()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableCrossZoneLoadBalancing()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableDeletionProtection()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableHttp2()com.pulumi.core.Output<java.lang.String>enablePrefixForIpv6SourceNat()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableTlsVersionAndCipherSuiteHeaders()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableWafFailOpen()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableXffClientPort()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enableZonalShift()com.pulumi.core.Output<java.lang.String>enforceSecurityGroupInboundRulesOnPrivateLinkTraffic()static LoadBalancerget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, LoadBalancerState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<LoadBalancerHealthCheckLogs>>healthCheckLogs()com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>idleTimeout()com.pulumi.core.Output<java.lang.Boolean>internal()com.pulumi.core.Output<java.lang.String>ipAddressType()com.pulumi.core.Output<java.util.Optional<LoadBalancerIpamPools>>ipamPools()com.pulumi.core.Output<java.util.Optional<java.lang.String>>loadBalancerType()com.pulumi.core.Output<java.util.Optional<LoadBalancerMinimumLoadBalancerCapacity>>minimumLoadBalancerCapacity()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>namePrefix()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>preserveHostHeader()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.Integer>secondaryIpsAutoAssignedPerSubnet()com.pulumi.core.Output<java.util.List<java.lang.String>>securityGroups()com.pulumi.core.Output<java.util.List<LoadBalancerSubnetMapping>>subnetMappings()com.pulumi.core.Output<java.util.List<java.lang.String>>subnets()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()com.pulumi.core.Output<java.lang.String>vpcId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>xffHeaderProcessingMode()com.pulumi.core.Output<java.lang.String>zoneId()
-
-
-
Constructor Detail
-
LoadBalancer
public LoadBalancer(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
LoadBalancer
public LoadBalancer(java.lang.String name, @Nullable LoadBalancerArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
LoadBalancer
public LoadBalancer(java.lang.String name, @Nullable LoadBalancerArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
accessLogs
public com.pulumi.core.Output<java.util.Optional<LoadBalancerAccessLogs>> accessLogs()
- Returns:
- Access Logs block. See below.
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the load balancer.
-
arnSuffix
public com.pulumi.core.Output<java.lang.String> arnSuffix()
- Returns:
- ARN suffix for use with CloudWatch Metrics.
-
clientKeepAlive
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> clientKeepAlive()
- Returns:
- Client keep alive value in seconds. The valid range is 60-604800 seconds. The default is 3600 seconds.
-
connectionLogs
public com.pulumi.core.Output<java.util.Optional<LoadBalancerConnectionLogs>> connectionLogs()
- Returns:
- Connection Logs block. See below. Only valid for Load Balancers of type `application`.
-
customerOwnedIpv4Pool
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> customerOwnedIpv4Pool()
- Returns:
- ID of the customer owned ipv4 pool to use for this load balancer.
-
desyncMitigationMode
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> desyncMitigationMode()
- Returns:
- 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`.
-
dnsName
public com.pulumi.core.Output<java.lang.String> dnsName()
- Returns:
- DNS name of the load balancer. * `subnet_mapping.*.outpost_id` - ID of the Outpost containing the load balancer.
-
dnsRecordClientRoutingPolicy
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> dnsRecordClientRoutingPolicy()
- Returns:
- How traffic is distributed among the load balancer Availability Zones. Possible values are `anyAvailabilityZone` (default), `availabilityZoneAffinity`, or `partialAvailabilityZoneAffinity`. See [Availability Zone DNS affinity](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#zonal-dns-affinity) for additional details. Only valid for `network` type load balancers.
-
dropInvalidHeaderFields
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> dropInvalidHeaderFields()
- Returns:
- 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`.
-
enableCrossZoneLoadBalancing
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableCrossZoneLoadBalancing()
- Returns:
- 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`.
-
enableDeletionProtection
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableDeletionProtection()
- Returns:
- 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`.
-
enableHttp2
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableHttp2()
- Returns:
- Whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`.
-
enablePrefixForIpv6SourceNat
public com.pulumi.core.Output<java.lang.String> enablePrefixForIpv6SourceNat()
- Returns:
- Whether to use an IPv6 prefix from each subnet for source NAT. `ipAddressType` must be `dualstack`. Valid values: `on`, `off`.
-
enableTlsVersionAndCipherSuiteHeaders
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableTlsVersionAndCipherSuiteHeaders()
- Returns:
- 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`
-
enableWafFailOpen
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableWafFailOpen()
- Returns:
- 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`.
-
enableXffClientPort
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableXffClientPort()
- Returns:
- 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`.
-
enableZonalShift
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableZonalShift()
- Returns:
- Whether zonal shift is enabled. Defaults to `false`.
-
enforceSecurityGroupInboundRulesOnPrivateLinkTraffic
public com.pulumi.core.Output<java.lang.String> enforceSecurityGroupInboundRulesOnPrivateLinkTraffic()
- Returns:
- Whether inbound security group rules are enforced for traffic originating from a PrivateLink. Only valid for Load Balancers of type `network`. The possible values are `on` and `off`.
-
healthCheckLogs
public com.pulumi.core.Output<java.util.Optional<LoadBalancerHealthCheckLogs>> healthCheckLogs()
- Returns:
- Health Check Logs block. See below. Only valid for Load Balancers of type `application`.
-
idleTimeout
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> idleTimeout()
- Returns:
- Time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60.
-
internal
public com.pulumi.core.Output<java.lang.Boolean> internal()
- Returns:
- If true, the LB will be internal. Defaults to `false`.
-
ipAddressType
public com.pulumi.core.Output<java.lang.String> ipAddressType()
- Returns:
- Type of IP addresses used by the subnets for your load balancer. The possible values depend upon the load balancer type: `ipv4` (all load balancer types), `dualstack` (all load balancer types), and `dualstack-without-public-ipv4` (type `application` only).
-
ipamPools
public com.pulumi.core.Output<java.util.Optional<LoadBalancerIpamPools>> ipamPools()
- Returns:
- . The IPAM pools to use with the load balancer. Only valid for Load Balancers of type `application`. See ipamPools for more information.
-
loadBalancerType
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> loadBalancerType()
- Returns:
- Type of load balancer to create. Possible values are `application`, `gateway`, or `network`. The default value is `application`.
-
minimumLoadBalancerCapacity
public com.pulumi.core.Output<java.util.Optional<LoadBalancerMinimumLoadBalancerCapacity>> minimumLoadBalancerCapacity()
- Returns:
- Minimum capacity for a load balancer. Only valid for Load Balancers of type `application` or `network`.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- 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`.
-
namePrefix
public com.pulumi.core.Output<java.lang.String> namePrefix()
- Returns:
- Creates a unique name beginning with the specified prefix. Conflicts with `name`.
-
preserveHostHeader
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> preserveHostHeader()
- Returns:
- 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`.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
secondaryIpsAutoAssignedPerSubnet
public com.pulumi.core.Output<java.lang.Integer> secondaryIpsAutoAssignedPerSubnet()
- Returns:
- The number of secondary IP addresses to configure for your load balancer nodes. Only valid for Load Balancers of type `network`. The valid range is 0-7. When decreased, this will force a recreation of the resource. Default: `0`.
-
securityGroups
public com.pulumi.core.Output<java.util.List<java.lang.String>> securityGroups()
- Returns:
- List of security group IDs to assign to the LB. Only valid for Load Balancers of type `application` or `network`. For load balancers of type `network` security groups cannot be added if none are currently present, and cannot all be removed once added. If either of these conditions are met, this will force a recreation of the resource.
-
subnetMappings
public com.pulumi.core.Output<java.util.List<LoadBalancerSubnetMapping>> subnetMappings()
- Returns:
- Subnet mapping block. See below. For Load Balancers of type `network` subnet mappings can only be added.
-
subnets
public com.pulumi.core.Output<java.util.List<java.lang.String>> subnets()
- Returns:
- List of subnet IDs to attach to the LB. For Load Balancers of type `network` subnets can only be added (see [Availability Zones](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#availability-zones)), deleting a subnet for load balancers of type `network` will force a recreation of the resource.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
vpcId
public com.pulumi.core.Output<java.lang.String> vpcId()
-
xffHeaderProcessingMode
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> xffHeaderProcessingMode()
- Returns:
- 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`. > **NOTE:** Please note that internal LBs can only use `ipv4` as the `ipAddressType`. You can only change to `dualstack` `ipAddressType` if the selected subnets are IPv6 enabled. > **NOTE:** Please note that one of either `subnets` or `subnetMapping` is required.
-
zoneId
public com.pulumi.core.Output<java.lang.String> zoneId()
- Returns:
- Canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record).
-
get
public static LoadBalancer get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable LoadBalancerState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-