Class LoadBalancer


  • public class LoadBalancer
    extends com.pulumi.resources.CustomResource
    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.LoadBalancerHealthCheckArgs;
     import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
     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) {
             // Create a new load balancer
             var bar = new LoadBalancer("bar", LoadBalancerArgs.builder()
                 .accessLogs(LoadBalancerAccessLogsArgs.builder()
                     .bucket("foo")
                     .bucketPrefix("bar")
                     .interval(60)
                     .build())
                 .healthCheck(LoadBalancerHealthCheckArgs.builder()
                     .healthyThreshold(2)
                     .unhealthyThreshold(2)
                     .timeout(3)
                     .target("HTTP:8000/")
                     .interval(30)
                     .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())
                 .name("foobar-elb")
                 .availabilityZones(            
                     "us-west-2a",
                     "us-west-2b",
                     "us-west-2c")
                 .instances(foo.id())
                 .crossZoneLoadBalancing(true)
                 .idleTimeout(400)
                 .connectionDraining(true)
                 .connectionDrainingTimeout(400)
                 .tags(Map.of("Name", "foobar-elb"))
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `name` (String) Name of the ELB. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import ELBs using the `name`. For example: ```sh $ pulumi import aws:elb/loadBalancer:LoadBalancer example elb-production-12345 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • 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.util.List<java.lang.String>> availabilityZones()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> connectionDraining()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> connectionDrainingTimeout()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> crossZoneLoadBalancing()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> desyncMitigationMode()  
      com.pulumi.core.Output<java.lang.String> dnsName()  
      static LoadBalancer get​(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<LoadBalancerHealthCheck> healthCheck()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> idleTimeout()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> instances()  
      com.pulumi.core.Output<java.lang.Boolean> internal()  
      com.pulumi.core.Output<java.util.List<LoadBalancerListener>> listeners()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> namePrefix()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> securityGroups()  
      com.pulumi.core.Output<java.lang.String> sourceSecurityGroup()  
      com.pulumi.core.Output<java.lang.String> sourceSecurityGroupId()  
      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> zoneId()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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,
                            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,
                            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:
        An Access Logs block. Access Logs documented below.
      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        The ARN of the ELB
      • availabilityZones

        public com.pulumi.core.Output<java.util.List<java.lang.String>> availabilityZones()
        Returns:
        The AZ's to serve traffic in.
      • connectionDraining

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> connectionDraining()
        Returns:
        Boolean to enable connection draining. Default: `false`
      • connectionDrainingTimeout

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> connectionDrainingTimeout()
        Returns:
        The time in seconds to allow for connections to drain. Default: `300`
      • crossZoneLoadBalancing

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> crossZoneLoadBalancing()
        Returns:
        Enable cross-zone load balancing. Default: `true`
      • desyncMitigationMode

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> desyncMitigationMode()
        Returns:
        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`.
      • dnsName

        public com.pulumi.core.Output<java.lang.String> dnsName()
        Returns:
        The DNS name of the ELB
      • healthCheck

        public com.pulumi.core.Output<LoadBalancerHealthCheck> healthCheck()
        Returns:
        A healthCheck block. Health Check documented below.
      • idleTimeout

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> idleTimeout()
        Returns:
        The time in seconds that the connection is allowed to be idle. Default: `60`
      • instances

        public com.pulumi.core.Output<java.util.List<java.lang.String>> instances()
        Returns:
        A list of instance IDs to place in the ELB pool.
      • internal

        public com.pulumi.core.Output<java.lang.Boolean> internal()
        Returns:
        If true, ELB will be an internal ELB.
      • listeners

        public com.pulumi.core.Output<java.util.List<LoadBalancerListener>> listeners()
        Returns:
        A list of listener blocks. Listeners documented below.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of the ELB. By default generated by this provider.
      • namePrefix

        public com.pulumi.core.Output<java.lang.String> namePrefix()
        Returns:
        Creates a unique name beginning with the specified prefix. Conflicts with `name`.
      • 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.
      • securityGroups

        public com.pulumi.core.Output<java.util.List<java.lang.String>> securityGroups()
        Returns:
        A list of security group IDs to assign to the ELB. Only valid if creating an ELB within a VPC
      • sourceSecurityGroup

        public com.pulumi.core.Output<java.lang.String> sourceSecurityGroup()
        Returns:
        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.
      • sourceSecurityGroupId

        public com.pulumi.core.Output<java.lang.String> sourceSecurityGroupId()
        Returns:
        The ID of the security group that you can use as part of your inbound rules for your load balancer's back-end application instances. Only available on ELBs launched in a VPC.
      • subnets

        public com.pulumi.core.Output<java.util.List<java.lang.String>> subnets()
        Returns:
        A list of subnet IDs to attach to the ELB. When an update to subnets will remove all current subnets, this will force a new resource.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        A 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. Exactly one of `availabilityZones` or `subnets` must be specified: this determines if the ELB exists in a VPC or in EC2-classic.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • zoneId

        public com.pulumi.core.Output<java.lang.String> zoneId()
        Returns:
        The canonical hosted zone ID of the ELB (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.