1. Packages
  2. AWS
  3. API Docs
  4. elb
  5. getLoadBalancer
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.elb.getLoadBalancer

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    Provides information about a “classic” Elastic Load Balancer (ELB). See LB Data Source if you are looking for “v2” Application Load Balancer (ALB) or Network Load Balancer (NLB).

    This data source can prove useful when a module accepts an LB as an input variable and needs to, for example, determine the security groups associated with it, etc.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const config = new pulumi.Config();
    const lbName = config.get("lbName") || "";
    const test = aws.elb.getLoadBalancer({
        name: lbName,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    config = pulumi.Config()
    lb_name = config.get("lbName")
    if lb_name is None:
        lb_name = ""
    test = aws.elb.get_load_balancer(name=lb_name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		lbName := ""
    		if param := cfg.Get("lbName"); param != "" {
    			lbName = param
    		}
    		_, err := elb.LookupLoadBalancer(ctx, &elb.LookupLoadBalancerArgs{
    			Name: lbName,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var lbName = config.Get("lbName") ?? "";
        var test = Aws.Elb.GetLoadBalancer.Invoke(new()
        {
            Name = lbName,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.elb.ElbFunctions;
    import com.pulumi.aws.elb.inputs.GetLoadBalancerArgs;
    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) {
            final var config = ctx.config();
            final var lbName = config.get("lbName").orElse("");
            final var test = ElbFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
                .name(lbName)
                .build());
    
        }
    }
    
    configuration:
      lbName:
        type: string
        default:
    variables:
      test:
        fn::invoke:
          Function: aws:elb:getLoadBalancer
          Arguments:
            name: ${lbName}
    

    Using getLoadBalancer

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getLoadBalancer(args: GetLoadBalancerArgs, opts?: InvokeOptions): Promise<GetLoadBalancerResult>
    function getLoadBalancerOutput(args: GetLoadBalancerOutputArgs, opts?: InvokeOptions): Output<GetLoadBalancerResult>
    def get_load_balancer(name: Optional[str] = None,
                          tags: Optional[Mapping[str, str]] = None,
                          opts: Optional[InvokeOptions] = None) -> GetLoadBalancerResult
    def get_load_balancer_output(name: Optional[pulumi.Input[str]] = None,
                          tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetLoadBalancerResult]
    func LookupLoadBalancer(ctx *Context, args *LookupLoadBalancerArgs, opts ...InvokeOption) (*LookupLoadBalancerResult, error)
    func LookupLoadBalancerOutput(ctx *Context, args *LookupLoadBalancerOutputArgs, opts ...InvokeOption) LookupLoadBalancerResultOutput

    > Note: This function is named LookupLoadBalancer in the Go SDK.

    public static class GetLoadBalancer 
    {
        public static Task<GetLoadBalancerResult> InvokeAsync(GetLoadBalancerArgs args, InvokeOptions? opts = null)
        public static Output<GetLoadBalancerResult> Invoke(GetLoadBalancerInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLoadBalancerResult> getLoadBalancer(GetLoadBalancerArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:elb/getLoadBalancer:getLoadBalancer
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Unique name of the load balancer.
    Tags Dictionary<string, string>
    Name string
    Unique name of the load balancer.
    Tags map[string]string
    name String
    Unique name of the load balancer.
    tags Map<String,String>
    name string
    Unique name of the load balancer.
    tags {[key: string]: string}
    name str
    Unique name of the load balancer.
    tags Mapping[str, str]
    name String
    Unique name of the load balancer.
    tags Map<String>

    getLoadBalancer Result

    The following output properties are available:

    AccessLogs GetLoadBalancerAccessLogs
    Arn string
    AvailabilityZones List<string>
    ConnectionDraining bool
    ConnectionDrainingTimeout int
    CrossZoneLoadBalancing bool
    DesyncMitigationMode string
    DnsName string
    HealthCheck GetLoadBalancerHealthCheck
    Id string
    The provider-assigned unique ID for this managed resource.
    IdleTimeout int
    Instances List<string>
    Internal bool
    Listeners List<GetLoadBalancerListener>
    Name string
    SecurityGroups List<string>
    SourceSecurityGroup string
    SourceSecurityGroupId string
    Subnets List<string>
    Tags Dictionary<string, string>
    ZoneId string
    accessLogs GetLoadBalancerAccessLogs
    arn String
    availabilityZones List<String>
    connectionDraining Boolean
    connectionDrainingTimeout Integer
    crossZoneLoadBalancing Boolean
    desyncMitigationMode String
    dnsName String
    healthCheck GetLoadBalancerHealthCheck
    id String
    The provider-assigned unique ID for this managed resource.
    idleTimeout Integer
    instances List<String>
    internal Boolean
    listeners List<GetLoadBalancerListener>
    name String
    securityGroups List<String>
    sourceSecurityGroup String
    sourceSecurityGroupId String
    subnets List<String>
    tags Map<String,String>
    zoneId String
    accessLogs Property Map
    arn String
    availabilityZones List<String>
    connectionDraining Boolean
    connectionDrainingTimeout Number
    crossZoneLoadBalancing Boolean
    desyncMitigationMode String
    dnsName String
    healthCheck Property Map
    id String
    The provider-assigned unique ID for this managed resource.
    idleTimeout Number
    instances List<String>
    internal Boolean
    listeners List<Property Map>
    name String
    securityGroups List<String>
    sourceSecurityGroup String
    sourceSecurityGroupId String
    subnets List<String>
    tags Map<String>
    zoneId String

    Supporting Types

    GetLoadBalancerAccessLogs

    Bucket string
    BucketPrefix string
    Enabled bool
    Interval int
    Bucket string
    BucketPrefix string
    Enabled bool
    Interval int
    bucket String
    bucketPrefix String
    enabled Boolean
    interval Integer
    bucket string
    bucketPrefix string
    enabled boolean
    interval number
    bucket String
    bucketPrefix String
    enabled Boolean
    interval Number

    GetLoadBalancerHealthCheck

    healthyThreshold Integer
    interval Integer
    target String
    timeout Integer
    unhealthyThreshold Integer

    GetLoadBalancerListener

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi