Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi
alicloud.slb.getBackendServers
Explore with Pulumi AI
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);
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)
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
	})
}
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),
    };
});
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()));
    }
}
variables:
  sampleDs:
    fn::invoke:
      function: alicloud:slb:getBackendServers
      arguments:
        loadBalancerId: ${sampleSlb.id}
outputs:
  firstSlbBackendServerId: ${sampleDs.backendServers[0].id}
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>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]func GetBackendServers(ctx *Context, args *GetBackendServersArgs, opts ...InvokeOption) (*GetBackendServersResult, error)
func GetBackendServersOutput(ctx *Context, args *GetBackendServersOutputArgs, opts ...InvokeOption) GetBackendServersResultOutput> 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)
}public static CompletableFuture<GetBackendServersResult> getBackendServers(GetBackendServersArgs args, InvokeOptions options)
public static Output<GetBackendServersResult> getBackendServers(GetBackendServersArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:slb/getBackendServers:getBackendServers
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Load
Balancer stringId  - ID of the SLB with attachments.
 - Ids List<string>
 - List of attached ECS instance IDs.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- Load
Balancer stringId  - ID of the SLB with attachments.
 - Ids []string
 - List of attached ECS instance IDs.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- load
Balancer StringId  - ID of the SLB with attachments.
 - ids List<String>
 - List of attached ECS instance IDs.
 - output
File String - File name where to save data source results (after running 
pulumi preview). 
- load
Balancer stringId  - ID of the SLB with attachments.
 - ids string[]
 - List of attached ECS instance IDs.
 - output
File string - File name where to save data source results (after running 
pulumi preview). 
- load_
balancer_ strid  - ID of the SLB with attachments.
 - ids Sequence[str]
 - List of attached ECS instance IDs.
 - output_
file str - File name where to save data source results (after running 
pulumi preview). 
- load
Balancer StringId  - ID of the SLB with attachments.
 - ids List<String>
 - List of attached ECS instance IDs.
 - output
File String - File name where to save data source results (after running 
pulumi preview). 
getBackendServers Result
The following output properties are available:
- Backend
Servers List<Pulumi.Ali Cloud. Slb. Outputs. Get Backend Servers Backend Server>  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids List<string>
 - Load
Balancer stringId  - Output
File string 
- Backend
Servers []GetBackend Servers Backend Server  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - Load
Balancer stringId  - Output
File string 
- backend
Servers List<GetBackend Servers Backend Server>  - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - load
Balancer StringId  - output
File String 
- backend
Servers GetBackend Servers Backend Server[]  - id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - load
Balancer stringId  - output
File string 
- backend_
servers Sequence[GetBackend Servers Backend Server]  - id str
 - The provider-assigned unique ID for this managed resource.
 - ids Sequence[str]
 - load_
balancer_ strid  - output_
file str 
- backend
Servers List<Property Map> - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - load
Balancer StringId  - output
File String 
Supporting Types
GetBackendServersBackendServer    
- Id string
 - backend server ID.
 - Server
Type string - Type of the backend server.
 - Weight int
 - Weight associated to the ECS instance.
 
- Id string
 - backend server ID.
 - Server
Type string - Type of the backend server.
 - Weight int
 - Weight associated to the ECS instance.
 
- id String
 - backend server ID.
 - server
Type String - Type of the backend server.
 - weight Integer
 - Weight associated to the ECS instance.
 
- id string
 - backend server ID.
 - server
Type string - Type of the backend server.
 - weight number
 - Weight associated to the ECS instance.
 
- id str
 - backend server ID.
 - server_
type str - Type of the backend server.
 - weight int
 - Weight associated to the ECS instance.
 
- id String
 - backend server ID.
 - server
Type String - Type of the backend server.
 - weight 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 
alicloudTerraform Provider.