AWS v6.77.1 published on Friday, Apr 18, 2025 by Pulumi
aws.lb.getLoadBalancer
Explore with Pulumi AI
Note:
aws.alb.LoadBalanceris known asaws.lb.LoadBalancer. The functionality is identical.
Provides information about a Load Balancer.
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 lbArn = config.get("lbArn") || "";
const lbName = config.get("lbName") || "";
const test = aws.lb.getLoadBalancer({
    arn: lbArn,
    name: lbName,
});
import pulumi
import pulumi_aws as aws
config = pulumi.Config()
lb_arn = config.get("lbArn")
if lb_arn is None:
    lb_arn = ""
lb_name = config.get("lbName")
if lb_name is None:
    lb_name = ""
test = aws.lb.get_load_balancer(arn=lb_arn,
    name=lb_name)
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lb"
	"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, "")
		lbArn := ""
		if param := cfg.Get("lbArn"); param != "" {
			lbArn = param
		}
		lbName := ""
		if param := cfg.Get("lbName"); param != "" {
			lbName = param
		}
		_, err := lb.LookupLoadBalancer(ctx, &lb.LookupLoadBalancerArgs{
			Arn:  pulumi.StringRef(lbArn),
			Name: pulumi.StringRef(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 lbArn = config.Get("lbArn") ?? "";
    var lbName = config.Get("lbName") ?? "";
    var test = Aws.LB.GetLoadBalancer.Invoke(new()
    {
        Arn = lbArn,
        Name = lbName,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lb.LbFunctions;
import com.pulumi.aws.lb.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 lbArn = config.get("lbArn").orElse("");
        final var lbName = config.get("lbName").orElse("");
        final var test = LbFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
            .arn(lbArn)
            .name(lbName)
            .build());
    }
}
configuration:
  lbArn:
    type: string
    default: ""
  lbName:
    type: string
    default: ""
variables:
  test:
    fn::invoke:
      function: aws:lb:getLoadBalancer
      arguments:
        arn: ${lbArn}
        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(arn: Optional[str] = None,
                      name: Optional[str] = None,
                      tags: Optional[Mapping[str, str]] = None,
                      opts: Optional[InvokeOptions] = None) -> GetLoadBalancerResult
def get_load_balancer_output(arn: Optional[pulumi.Input[str]] = None,
                      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)
public static Output<GetLoadBalancerResult> getLoadBalancer(GetLoadBalancerArgs args, InvokeOptions options)
fn::invoke:
  function: aws:lb/getLoadBalancer:getLoadBalancer
  arguments:
    # arguments dictionaryThe following arguments are supported:
getLoadBalancer Result
The following output properties are available:
- Access
Logs GetLoad Balancer Access Logs  - Arn string
 - Arn
Suffix string - Client
Keep intAlive  - Connection
Logs List<GetLoad Balancer Connection Log>  - Customer
Owned stringIpv4Pool  - Desync
Mitigation stringMode  - Dns
Name string - Dns
Record stringClient Routing Policy  - Drop
Invalid boolHeader Fields  - Enable
Cross boolZone Load Balancing  - Enable
Deletion boolProtection  - Enable
Http2 bool - Enable
Tls boolVersion And Cipher Suite Headers  - Enable
Waf boolFail Open  - Enable
Xff boolClient Port  - Enable
Zonal boolShift  - Enforce
Security stringGroup Inbound Rules On Private Link Traffic  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Idle
Timeout int - Internal bool
 - Ip
Address stringType  - Ipam
Pools List<GetLoad Balancer Ipam Pool>  - Load
Balancer stringType  - Name string
 - Preserve
Host boolHeader  - Security
Groups List<string> - Subnet
Mappings List<GetLoad Balancer Subnet Mapping>  - Subnets List<string>
 - Dictionary<string, string>
 - Vpc
Id string - Xff
Header stringProcessing Mode  - Zone
Id string 
- Access
Logs GetLoad Balancer Access Logs  - Arn string
 - Arn
Suffix string - Client
Keep intAlive  - Connection
Logs []GetLoad Balancer Connection Log  - Customer
Owned stringIpv4Pool  - Desync
Mitigation stringMode  - Dns
Name string - Dns
Record stringClient Routing Policy  - Drop
Invalid boolHeader Fields  - Enable
Cross boolZone Load Balancing  - Enable
Deletion boolProtection  - Enable
Http2 bool - Enable
Tls boolVersion And Cipher Suite Headers  - Enable
Waf boolFail Open  - Enable
Xff boolClient Port  - Enable
Zonal boolShift  - Enforce
Security stringGroup Inbound Rules On Private Link Traffic  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Idle
Timeout int - Internal bool
 - Ip
Address stringType  - Ipam
Pools []GetLoad Balancer Ipam Pool  - Load
Balancer stringType  - Name string
 - Preserve
Host boolHeader  - Security
Groups []string - Subnet
Mappings []GetLoad Balancer Subnet Mapping  - Subnets []string
 - map[string]string
 - Vpc
Id string - Xff
Header stringProcessing Mode  - Zone
Id string 
- access
Logs GetLoad Balancer Access Logs  - arn String
 - arn
Suffix String - client
Keep IntegerAlive  - connection
Logs List<GetLoad Balancer Connection Log>  - customer
Owned StringIpv4Pool  - desync
Mitigation StringMode  - dns
Name String - dns
Record StringClient Routing Policy  - drop
Invalid BooleanHeader Fields  - enable
Cross BooleanZone Load Balancing  - enable
Deletion BooleanProtection  - enable
Http2 Boolean - enable
Tls BooleanVersion And Cipher Suite Headers  - enable
Waf BooleanFail Open  - enable
Xff BooleanClient Port  - enable
Zonal BooleanShift  - enforce
Security StringGroup Inbound Rules On Private Link Traffic  - id String
 - The provider-assigned unique ID for this managed resource.
 - idle
Timeout Integer - internal Boolean
 - ip
Address StringType  - ipam
Pools List<GetLoad Balancer Ipam Pool>  - load
Balancer StringType  - name String
 - preserve
Host BooleanHeader  - security
Groups List<String> - subnet
Mappings List<GetLoad Balancer Subnet Mapping>  - subnets List<String>
 - Map<String,String>
 - vpc
Id String - xff
Header StringProcessing Mode  - zone
Id String 
- access
Logs GetLoad Balancer Access Logs  - arn string
 - arn
Suffix string - client
Keep numberAlive  - connection
Logs GetLoad Balancer Connection Log[]  - customer
Owned stringIpv4Pool  - desync
Mitigation stringMode  - dns
Name string - dns
Record stringClient Routing Policy  - drop
Invalid booleanHeader Fields  - enable
Cross booleanZone Load Balancing  - enable
Deletion booleanProtection  - enable
Http2 boolean - enable
Tls booleanVersion And Cipher Suite Headers  - enable
Waf booleanFail Open  - enable
Xff booleanClient Port  - enable
Zonal booleanShift  - enforce
Security stringGroup Inbound Rules On Private Link Traffic  - id string
 - The provider-assigned unique ID for this managed resource.
 - idle
Timeout number - internal boolean
 - ip
Address stringType  - ipam
Pools GetLoad Balancer Ipam Pool[]  - load
Balancer stringType  - name string
 - preserve
Host booleanHeader  - security
Groups string[] - subnet
Mappings GetLoad Balancer Subnet Mapping[]  - subnets string[]
 - {[key: string]: string}
 - vpc
Id string - xff
Header stringProcessing Mode  - zone
Id string 
- access_
logs GetLoad Balancer Access Logs  - arn str
 - arn_
suffix str - client_
keep_ intalive  - connection_
logs Sequence[GetLoad Balancer Connection Log]  - customer_
owned_ stripv4_ pool  - desync_
mitigation_ strmode  - dns_
name str - dns_
record_ strclient_ routing_ policy  - drop_
invalid_ boolheader_ fields  - enable_
cross_ boolzone_ load_ balancing  - enable_
deletion_ boolprotection  - enable_
http2 bool - enable_
tls_ boolversion_ and_ cipher_ suite_ headers  - enable_
waf_ boolfail_ open  - enable_
xff_ boolclient_ port  - enable_
zonal_ boolshift  - enforce_
security_ strgroup_ inbound_ rules_ on_ private_ link_ traffic  - id str
 - The provider-assigned unique ID for this managed resource.
 - idle_
timeout int - internal bool
 - ip_
address_ strtype  - ipam_
pools Sequence[GetLoad Balancer Ipam Pool]  - load_
balancer_ strtype  - name str
 - preserve_
host_ boolheader  - security_
groups Sequence[str] - subnet_
mappings Sequence[GetLoad Balancer Subnet Mapping]  - subnets Sequence[str]
 - Mapping[str, str]
 - vpc_
id str - xff_
header_ strprocessing_ mode  - zone_
id str 
- access
Logs Property Map - arn String
 - arn
Suffix String - client
Keep NumberAlive  - connection
Logs List<Property Map> - customer
Owned StringIpv4Pool  - desync
Mitigation StringMode  - dns
Name String - dns
Record StringClient Routing Policy  - drop
Invalid BooleanHeader Fields  - enable
Cross BooleanZone Load Balancing  - enable
Deletion BooleanProtection  - enable
Http2 Boolean - enable
Tls BooleanVersion And Cipher Suite Headers  - enable
Waf BooleanFail Open  - enable
Xff BooleanClient Port  - enable
Zonal BooleanShift  - enforce
Security StringGroup Inbound Rules On Private Link Traffic  - id String
 - The provider-assigned unique ID for this managed resource.
 - idle
Timeout Number - internal Boolean
 - ip
Address StringType  - ipam
Pools List<Property Map> - load
Balancer StringType  - name String
 - preserve
Host BooleanHeader  - security
Groups List<String> - subnet
Mappings List<Property Map> - subnets List<String>
 - Map<String>
 - vpc
Id String - xff
Header StringProcessing Mode  - zone
Id String 
Supporting Types
GetLoadBalancerAccessLogs    
GetLoadBalancerConnectionLog    
GetLoadBalancerIpamPool    
- Ipv4Ipam
Pool stringId  
- Ipv4Ipam
Pool stringId  
- ipv4Ipam
Pool StringId  
- ipv4Ipam
Pool stringId  
- ipv4Ipam
Pool StringId  
GetLoadBalancerSubnetMapping    
- Allocation
Id string - Ipv6Address string
 - Outpost
Id string - Private
Ipv4Address string - Subnet
Id string 
- Allocation
Id string - Ipv6Address string
 - Outpost
Id string - Private
Ipv4Address string - Subnet
Id string 
- allocation
Id String - ipv6Address String
 - outpost
Id String - private
Ipv4Address String - subnet
Id String 
- allocation
Id string - ipv6Address string
 - outpost
Id string - private
Ipv4Address string - subnet
Id string 
- allocation_
id str - ipv6_
address str - outpost_
id str - private_
ipv4_ straddress  - subnet_
id str 
- allocation
Id String - ipv6Address String
 - outpost
Id String - private
Ipv4Address String - subnet
Id String 
Package Details
- Repository
 - AWS Classic pulumi/pulumi-aws
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
awsTerraform Provider.