Try AWS Native preview for resources not in the classic version.
aws.elb.getLoadBalancer
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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 dictionaryThe following arguments are supported:
- Name string
 - Unique name of the load balancer.
 - Dictionary<string, string>
 
- Name string
 - Unique name of the load balancer.
 - map[string]string
 
- name String
 - Unique name of the load balancer.
 - Map<String,String>
 
- name string
 - Unique name of the load balancer.
 - {[key: string]: string}
 
- name str
 - Unique name of the load balancer.
 - Mapping[str, str]
 
- name String
 - Unique name of the load balancer.
 - Map<String>
 
getLoadBalancer Result
The following output properties are available:
- Access
Logs GetLoad Balancer Access Logs  - Arn string
 - Availability
Zones List<string> - Connection
Draining bool - Connection
Draining intTimeout  - Cross
Zone boolLoad Balancing  - Desync
Mitigation stringMode  - Dns
Name string - Health
Check GetLoad Balancer Health Check  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Idle
Timeout int - Instances List<string>
 - Internal bool
 - Listeners
List<Get
Load Balancer Listener>  - Name string
 - Security
Groups List<string> - Source
Security stringGroup  - Source
Security stringGroup Id  - Subnets List<string>
 - Dictionary<string, string>
 - Zone
Id string 
- Access
Logs GetLoad Balancer Access Logs  - Arn string
 - Availability
Zones []string - Connection
Draining bool - Connection
Draining intTimeout  - Cross
Zone boolLoad Balancing  - Desync
Mitigation stringMode  - Dns
Name string - Health
Check GetLoad Balancer Health Check  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Idle
Timeout int - Instances []string
 - Internal bool
 - Listeners
[]Get
Load Balancer Listener  - Name string
 - Security
Groups []string - Source
Security stringGroup  - Source
Security stringGroup Id  - Subnets []string
 - map[string]string
 - Zone
Id string 
- access
Logs GetLoad Balancer Access Logs  - arn String
 - availability
Zones List<String> - connection
Draining Boolean - connection
Draining IntegerTimeout  - cross
Zone BooleanLoad Balancing  - desync
Mitigation StringMode  - dns
Name String - health
Check GetLoad Balancer Health Check  - id String
 - The provider-assigned unique ID for this managed resource.
 - idle
Timeout Integer - instances List<String>
 - internal Boolean
 - listeners
List<Get
Load Balancer Listener>  - name String
 - security
Groups List<String> - source
Security StringGroup  - source
Security StringGroup Id  - subnets List<String>
 - Map<String,String>
 - zone
Id String 
- access
Logs GetLoad Balancer Access Logs  - arn string
 - availability
Zones string[] - connection
Draining boolean - connection
Draining numberTimeout  - cross
Zone booleanLoad Balancing  - desync
Mitigation stringMode  - dns
Name string - health
Check GetLoad Balancer Health Check  - id string
 - The provider-assigned unique ID for this managed resource.
 - idle
Timeout number - instances string[]
 - internal boolean
 - listeners
Get
Load Balancer Listener[]  - name string
 - security
Groups string[] - source
Security stringGroup  - source
Security stringGroup Id  - subnets string[]
 - {[key: string]: string}
 - zone
Id string 
- access_
logs GetLoad Balancer Access Logs  - arn str
 - availability_
zones Sequence[str] - connection_
draining bool - connection_
draining_ inttimeout  - cross_
zone_ boolload_ balancing  - desync_
mitigation_ strmode  - dns_
name str - health_
check GetLoad Balancer Health Check  - id str
 - The provider-assigned unique ID for this managed resource.
 - idle_
timeout int - instances Sequence[str]
 - internal bool
 - listeners
Sequence[Get
Load Balancer Listener]  - name str
 - security_
groups Sequence[str] - source_
security_ strgroup  - source_
security_ strgroup_ id  - subnets Sequence[str]
 - Mapping[str, str]
 - zone_
id str 
- access
Logs Property Map - arn String
 - availability
Zones List<String> - connection
Draining Boolean - connection
Draining NumberTimeout  - cross
Zone BooleanLoad Balancing  - desync
Mitigation StringMode  - dns
Name String - health
Check Property Map - id String
 - The provider-assigned unique ID for this managed resource.
 - idle
Timeout Number - instances List<String>
 - internal Boolean
 - listeners List<Property Map>
 - name String
 - security
Groups List<String> - source
Security StringGroup  - source
Security StringGroup Id  - subnets List<String>
 - Map<String>
 - zone
Id String 
Supporting Types
GetLoadBalancerAccessLogs    
- Bucket string
 - Bucket
Prefix string - Enabled bool
 - Interval int
 
- Bucket string
 - Bucket
Prefix string - Enabled bool
 - Interval int
 
- bucket String
 - bucket
Prefix String - enabled Boolean
 - interval Integer
 
- bucket string
 - bucket
Prefix string - enabled boolean
 - interval number
 
- bucket str
 - bucket_
prefix str - enabled bool
 - interval int
 
- bucket String
 - bucket
Prefix String - enabled Boolean
 - interval Number
 
GetLoadBalancerHealthCheck    
- Healthy
Threshold int - Interval int
 - Target string
 - Timeout int
 - Unhealthy
Threshold int 
- Healthy
Threshold int - Interval int
 - Target string
 - Timeout int
 - Unhealthy
Threshold int 
- healthy
Threshold Integer - interval Integer
 - target String
 - timeout Integer
 - unhealthy
Threshold Integer 
- healthy
Threshold number - interval number
 - target string
 - timeout number
 - unhealthy
Threshold number 
- healthy_
threshold int - interval int
 - target str
 - timeout int
 - unhealthy_
threshold int 
- healthy
Threshold Number - interval Number
 - target String
 - timeout Number
 - unhealthy
Threshold Number 
GetLoadBalancerListener   
- Instance
Port int - Instance
Protocol string - Lb
Port int - Lb
Protocol string - Ssl
Certificate stringId  
- Instance
Port int - Instance
Protocol string - Lb
Port int - Lb
Protocol string - Ssl
Certificate stringId  
- instance
Port Integer - instance
Protocol String - lb
Port Integer - lb
Protocol String - ssl
Certificate StringId  
- instance
Port number - instance
Protocol string - lb
Port number - lb
Protocol string - ssl
Certificate stringId  
- instance_
port int - instance_
protocol str - lb_
port int - lb_
protocol str - ssl_
certificate_ strid  
- instance
Port Number - instance
Protocol String - lb
Port Number - lb
Protocol String - ssl
Certificate StringId  
Package Details
- Repository
 - AWS Classic pulumi/pulumi-aws
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
awsTerraform Provider. 
Try AWS Native preview for resources not in the classic version.