get Backend Servers
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);
Content copied to clipboard
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)
Content copied to clipboard
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),
};
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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()));
}
}
Content copied to clipboard
variables:
sampleDs:
fn::invoke:
function: alicloud:slb:getBackendServers
arguments:
loadBalancerId: ${sampleSlb.id}
outputs:
firstSlbBackendServerId: ${sampleDs.backendServers[0].id}
Content copied to clipboard
Return
A collection of values returned by getBackendServers.
Parameters
argument
A collection of arguments for invoking getBackendServers.
suspend fun getBackendServers(ids: List<String>? = null, loadBalancerId: String, outputFile: String? = null): GetBackendServersResult
Return
A collection of values returned by getBackendServers.
Parameters
ids
List of attached ECS instance IDs.
load Balancer Id
ID of the SLB with attachments.
output File
File name where to save data source results (after running pulumi preview
).
See also
suspend fun getBackendServers(argument: suspend GetBackendServersPlainArgsBuilder.() -> Unit): GetBackendServersResult
Return
A collection of values returned by getBackendServers.
Parameters
argument
Builder for com.pulumi.alicloud.slb.kotlin.inputs.GetBackendServersPlainArgs.