1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. slb
  5. getBackendServers
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.slb.getBackendServers

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the server load balancer backend servers related to a server load balancer..

NOTE: Available in 1.53.0+

Example Usage

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

const sampleDs = alicloud.slb.getBackendServers({
    loadBalancerId: sampleSlb.id,
});
export const firstSlbBackendServerId = sampleDs.then(sampleDs => sampleDs.backendServers?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

sample_ds = alicloud.slb.get_backend_servers(load_balancer_id=sample_slb["id"])
pulumi.export("firstSlbBackendServerId", sample_ds.backend_servers[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/slb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		sampleDs, err := slb.GetBackendServers(ctx, &slb.GetBackendServersArgs{
			LoadBalancerId: sampleSlb.Id,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstSlbBackendServerId", sampleDs.BackendServers[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var sampleDs = AliCloud.Slb.GetBackendServers.Invoke(new()
    {
        LoadBalancerId = sampleSlb.Id,
    });

    return new Dictionary<string, object?>
    {
        ["firstSlbBackendServerId"] = sampleDs.Apply(getBackendServersResult => getBackendServersResult.BackendServers[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.slb.SlbFunctions;
import com.pulumi.alicloud.slb.inputs.GetBackendServersArgs;
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 sampleDs = SlbFunctions.getBackendServers(GetBackendServersArgs.builder()
            .loadBalancerId(sampleSlb.id())
            .build());

        ctx.export("firstSlbBackendServerId", sampleDs.applyValue(getBackendServersResult -> getBackendServersResult.backendServers()[0].id()));
    }
}
Copy
variables:
  sampleDs:
    fn::invoke:
      function: alicloud:slb:getBackendServers
      arguments:
        loadBalancerId: ${sampleSlb.id}
outputs:
  firstSlbBackendServerId: ${sampleDs.backendServers[0].id}
Copy

Using getBackendServers

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 getBackendServers(args: GetBackendServersArgs, opts?: InvokeOptions): Promise<GetBackendServersResult>
function getBackendServersOutput(args: GetBackendServersOutputArgs, opts?: InvokeOptions): Output<GetBackendServersResult>
Copy
def get_backend_servers(ids: Optional[Sequence[str]] = None,
                        load_balancer_id: Optional[str] = None,
                        output_file: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetBackendServersResult
def get_backend_servers_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                        load_balancer_id: Optional[pulumi.Input[str]] = None,
                        output_file: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetBackendServersResult]
Copy
func GetBackendServers(ctx *Context, args *GetBackendServersArgs, opts ...InvokeOption) (*GetBackendServersResult, error)
func GetBackendServersOutput(ctx *Context, args *GetBackendServersOutputArgs, opts ...InvokeOption) GetBackendServersResultOutput
Copy

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

public static class GetBackendServers 
{
    public static Task<GetBackendServersResult> InvokeAsync(GetBackendServersArgs args, InvokeOptions? opts = null)
    public static Output<GetBackendServersResult> Invoke(GetBackendServersInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetBackendServersResult> getBackendServers(GetBackendServersArgs args, InvokeOptions options)
public static Output<GetBackendServersResult> getBackendServers(GetBackendServersArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:slb/getBackendServers:getBackendServers
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

LoadBalancerId This property is required. string
ID of the SLB with attachments.
Ids Changes to this property will trigger replacement. List<string>
List of attached ECS instance IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
LoadBalancerId This property is required. string
ID of the SLB with attachments.
Ids Changes to this property will trigger replacement. []string
List of attached ECS instance IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
loadBalancerId This property is required. String
ID of the SLB with attachments.
ids Changes to this property will trigger replacement. List<String>
List of attached ECS instance IDs.
outputFile String
File name where to save data source results (after running pulumi preview).
loadBalancerId This property is required. string
ID of the SLB with attachments.
ids Changes to this property will trigger replacement. string[]
List of attached ECS instance IDs.
outputFile string
File name where to save data source results (after running pulumi preview).
load_balancer_id This property is required. str
ID of the SLB with attachments.
ids Changes to this property will trigger replacement. Sequence[str]
List of attached ECS instance IDs.
output_file str
File name where to save data source results (after running pulumi preview).
loadBalancerId This property is required. String
ID of the SLB with attachments.
ids Changes to this property will trigger replacement. List<String>
List of attached ECS instance IDs.
outputFile String
File name where to save data source results (after running pulumi preview).

getBackendServers Result

The following output properties are available:

BackendServers List<Pulumi.AliCloud.Slb.Outputs.GetBackendServersBackendServer>
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
LoadBalancerId string
OutputFile string
BackendServers []GetBackendServersBackendServer
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
LoadBalancerId string
OutputFile string
backendServers List<GetBackendServersBackendServer>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
loadBalancerId String
outputFile String
backendServers GetBackendServersBackendServer[]
id string
The provider-assigned unique ID for this managed resource.
ids string[]
loadBalancerId string
outputFile string
backend_servers Sequence[GetBackendServersBackendServer]
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
load_balancer_id str
output_file str
backendServers List<Property Map>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
loadBalancerId String
outputFile String

Supporting Types

GetBackendServersBackendServer

Id This property is required. string
backend server ID.
ServerType This property is required. string
Type of the backend server.
Weight This property is required. int
Weight associated to the ECS instance.
Id This property is required. string
backend server ID.
ServerType This property is required. string
Type of the backend server.
Weight This property is required. int
Weight associated to the ECS instance.
id This property is required. String
backend server ID.
serverType This property is required. String
Type of the backend server.
weight This property is required. Integer
Weight associated to the ECS instance.
id This property is required. string
backend server ID.
serverType This property is required. string
Type of the backend server.
weight This property is required. number
Weight associated to the ECS instance.
id This property is required. str
backend server ID.
server_type This property is required. str
Type of the backend server.
weight This property is required. int
Weight associated to the ECS instance.
id This property is required. String
backend server ID.
serverType This property is required. String
Type of the backend server.
weight This property is required. Number
Weight associated to the ECS instance.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi