1. Packages
  2. AWS
  3. API Docs
  4. lb
  5. getLbs
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.lb.getLbs

Explore with Pulumi AI

AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

Use this data source to get a list of Load Balancer ARNs matching the specified criteria. Useful for passing to other resources.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.lb.getLbs({
    tags: {
        "elbv2.k8s.aws/cluster": "my-cluster",
    },
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.lb.get_lbs(tags={
    "elbv2.k8s.aws/cluster": "my-cluster",
})
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := lb.GetLbs(ctx, &lb.GetLbsArgs{
			Tags: map[string]interface{}{
				"elbv2.k8s.aws/cluster": "my-cluster",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.LB.GetLbs.Invoke(new()
    {
        Tags = 
        {
            { "elbv2.k8s.aws/cluster", "my-cluster" },
        },
    });

});
Copy
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.GetLbsArgs;
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 example = LbFunctions.getLbs(GetLbsArgs.builder()
            .tags(Map.of("elbv2.k8s.aws/cluster", "my-cluster"))
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:lb:getLbs
      arguments:
        tags:
          elbv2.k8s.aws/cluster: my-cluster
Copy

Using getLbs

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 getLbs(args: GetLbsArgs, opts?: InvokeOptions): Promise<GetLbsResult>
function getLbsOutput(args: GetLbsOutputArgs, opts?: InvokeOptions): Output<GetLbsResult>
Copy
def get_lbs(tags: Optional[Mapping[str, str]] = None,
            opts: Optional[InvokeOptions] = None) -> GetLbsResult
def get_lbs_output(tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetLbsResult]
Copy
func GetLbs(ctx *Context, args *GetLbsArgs, opts ...InvokeOption) (*GetLbsResult, error)
func GetLbsOutput(ctx *Context, args *GetLbsOutputArgs, opts ...InvokeOption) GetLbsResultOutput
Copy

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

public static class GetLbs 
{
    public static Task<GetLbsResult> InvokeAsync(GetLbsArgs args, InvokeOptions? opts = null)
    public static Output<GetLbsResult> Invoke(GetLbsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetLbsResult> getLbs(GetLbsArgs args, InvokeOptions options)
public static Output<GetLbsResult> getLbs(GetLbsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:lb/getLbs:getLbs
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Tags Dictionary<string, string>
Map of tags, each pair of which must exactly match a pair on the desired Load Balancers.
Tags map[string]string
Map of tags, each pair of which must exactly match a pair on the desired Load Balancers.
tags Map<String,String>
Map of tags, each pair of which must exactly match a pair on the desired Load Balancers.
tags {[key: string]: string}
Map of tags, each pair of which must exactly match a pair on the desired Load Balancers.
tags Mapping[str, str]
Map of tags, each pair of which must exactly match a pair on the desired Load Balancers.
tags Map<String>
Map of tags, each pair of which must exactly match a pair on the desired Load Balancers.

getLbs Result

The following output properties are available:

Arns List<string>
Set of Load Balancer ARNs.
Id string
The provider-assigned unique ID for this managed resource.
Tags Dictionary<string, string>
Arns []string
Set of Load Balancer ARNs.
Id string
The provider-assigned unique ID for this managed resource.
Tags map[string]string
arns List<String>
Set of Load Balancer ARNs.
id String
The provider-assigned unique ID for this managed resource.
tags Map<String,String>
arns string[]
Set of Load Balancer ARNs.
id string
The provider-assigned unique ID for this managed resource.
tags {[key: string]: string}
arns Sequence[str]
Set of Load Balancer ARNs.
id str
The provider-assigned unique ID for this managed resource.
tags Mapping[str, str]
arns List<String>
Set of Load Balancer ARNs.
id String
The provider-assigned unique ID for this managed resource.
tags Map<String>

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi