Alibaba Cloud v3.87.0 published on Saturday, Oct 18, 2025 by Pulumi
alicloud.nlb.getServerGroups
This data source provides the Nlb Server Groups of the current Alibaba Cloud user.
NOTE: Available in v1.186.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.nlb.getServerGroups({});
export const nlbServerGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
const nameRegex = alicloud.nlb.getServerGroups({
nameRegex: "^my-ServerGroup",
});
export const nlbServerGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.nlb.get_server_groups()
pulumi.export("nlbServerGroupId1", ids.groups[0].id)
name_regex = alicloud.nlb.get_server_groups(name_regex="^my-ServerGroup")
pulumi.export("nlbServerGroupId2", name_regex.groups[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nlb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := nlb.GetServerGroups(ctx, &nlb.GetServerGroupsArgs{}, nil)
if err != nil {
return err
}
ctx.Export("nlbServerGroupId1", ids.Groups[0].Id)
nameRegex, err := nlb.GetServerGroups(ctx, &nlb.GetServerGroupsArgs{
NameRegex: pulumi.StringRef("^my-ServerGroup"),
}, nil)
if err != nil {
return err
}
ctx.Export("nlbServerGroupId2", nameRegex.Groups[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Nlb.GetServerGroups.Invoke();
var nameRegex = AliCloud.Nlb.GetServerGroups.Invoke(new()
{
NameRegex = "^my-ServerGroup",
});
return new Dictionary<string, object?>
{
["nlbServerGroupId1"] = ids.Apply(getServerGroupsResult => getServerGroupsResult.Groups[0]?.Id),
["nlbServerGroupId2"] = nameRegex.Apply(getServerGroupsResult => getServerGroupsResult.Groups[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.nlb.NlbFunctions;
import com.pulumi.alicloud.nlb.inputs.GetServerGroupsArgs;
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 ids = NlbFunctions.getServerGroups(GetServerGroupsArgs.builder()
.build());
ctx.export("nlbServerGroupId1", ids.groups()[0].id());
final var nameRegex = NlbFunctions.getServerGroups(GetServerGroupsArgs.builder()
.nameRegex("^my-ServerGroup")
.build());
ctx.export("nlbServerGroupId2", nameRegex.groups()[0].id());
}
}
variables:
ids:
fn::invoke:
function: alicloud:nlb:getServerGroups
arguments: {}
nameRegex:
fn::invoke:
function: alicloud:nlb:getServerGroups
arguments:
nameRegex: ^my-ServerGroup
outputs:
nlbServerGroupId1: ${ids.groups[0].id}
nlbServerGroupId2: ${nameRegex.groups[0].id}
Using getServerGroups
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 getServerGroups(args: GetServerGroupsArgs, opts?: InvokeOptions): Promise<GetServerGroupsResult>
function getServerGroupsOutput(args: GetServerGroupsOutputArgs, opts?: InvokeOptions): Output<GetServerGroupsResult>
def get_server_groups(ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
resource_group_id: Optional[str] = None,
server_group_names: Optional[Sequence[str]] = None,
server_group_type: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetServerGroupsResult
def get_server_groups_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None,
server_group_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
server_group_type: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServerGroupsResult]
func GetServerGroups(ctx *Context, args *GetServerGroupsArgs, opts ...InvokeOption) (*GetServerGroupsResult, error)
func GetServerGroupsOutput(ctx *Context, args *GetServerGroupsOutputArgs, opts ...InvokeOption) GetServerGroupsResultOutput
> Note: This function is named GetServerGroups
in the Go SDK.
public static class GetServerGroups
{
public static Task<GetServerGroupsResult> InvokeAsync(GetServerGroupsArgs args, InvokeOptions? opts = null)
public static Output<GetServerGroupsResult> Invoke(GetServerGroupsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServerGroupsResult> getServerGroups(GetServerGroupsArgs args, InvokeOptions options)
public static Output<GetServerGroupsResult> getServerGroups(GetServerGroupsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:nlb/getServerGroups:getServerGroups
arguments:
# arguments dictionary
The following arguments are supported:
- Ids List<string>
- A list of Server Group IDs.
- Name
Regex string - A regex string to filter results by Server Group name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Resource
Group stringId - The ID of the resource group to which the security group belongs.
- Server
Group List<string>Names - The names of the server groups to be queried.
- Server
Group stringType - The type of the server group. Valid values:
Instance
,Ip
. - Status string
- The status of the resource. Valid values:
Available
,Configuring
,Creating
. - Dictionary<string, string>
- Ids []string
- A list of Server Group IDs.
- Name
Regex string - A regex string to filter results by Server Group name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Resource
Group stringId - The ID of the resource group to which the security group belongs.
- Server
Group []stringNames - The names of the server groups to be queried.
- Server
Group stringType - The type of the server group. Valid values:
Instance
,Ip
. - Status string
- The status of the resource. Valid values:
Available
,Configuring
,Creating
. - map[string]string
- ids List<String>
- A list of Server Group IDs.
- name
Regex String - A regex string to filter results by Server Group name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - resource
Group StringId - The ID of the resource group to which the security group belongs.
- server
Group List<String>Names - The names of the server groups to be queried.
- server
Group StringType - The type of the server group. Valid values:
Instance
,Ip
. - status String
- The status of the resource. Valid values:
Available
,Configuring
,Creating
. - Map<String,String>
- ids string[]
- A list of Server Group IDs.
- name
Regex string - A regex string to filter results by Server Group name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - resource
Group stringId - The ID of the resource group to which the security group belongs.
- server
Group string[]Names - The names of the server groups to be queried.
- server
Group stringType - The type of the server group. Valid values:
Instance
,Ip
. - status string
- The status of the resource. Valid values:
Available
,Configuring
,Creating
. - {[key: string]: string}
- ids Sequence[str]
- A list of Server Group IDs.
- name_
regex str - A regex string to filter results by Server Group name.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - resource_
group_ strid - The ID of the resource group to which the security group belongs.
- server_
group_ Sequence[str]names - The names of the server groups to be queried.
- server_
group_ strtype - The type of the server group. Valid values:
Instance
,Ip
. - status str
- The status of the resource. Valid values:
Available
,Configuring
,Creating
. - Mapping[str, str]
- ids List<String>
- A list of Server Group IDs.
- name
Regex String - A regex string to filter results by Server Group name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - resource
Group StringId - The ID of the resource group to which the security group belongs.
- server
Group List<String>Names - The names of the server groups to be queried.
- server
Group StringType - The type of the server group. Valid values:
Instance
,Ip
. - status String
- The status of the resource. Valid values:
Available
,Configuring
,Creating
. - Map<String>
getServerGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Nlb. Outputs. Get Server Groups Group> - Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- Name
Regex string - Output
File string - Resource
Group stringId - Server
Group List<string>Names - Server
Group stringType - Status string
- Dictionary<string, string>
- Groups
[]Get
Server Groups Group - Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- Name
Regex string - Output
File string - Resource
Group stringId - Server
Group []stringNames - Server
Group stringType - Status string
- map[string]string
- groups
List<Get
Server Groups Group> - id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- name
Regex String - output
File String - resource
Group StringId - server
Group List<String>Names - server
Group StringType - status String
- Map<String,String>
- groups
Get
Server Groups Group[] - id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- name
Regex string - output
File string - resource
Group stringId - server
Group string[]Names - server
Group stringType - status string
- {[key: string]: string}
- groups
Sequence[Get
Server Groups Group] - id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- name_
regex str - output_
file str - resource_
group_ strid - server_
group_ Sequence[str]names - server_
group_ strtype - status str
- Mapping[str, str]
- groups List<Property Map>
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- name
Regex String - output
File String - resource
Group StringId - server
Group List<String>Names - server
Group StringType - status String
- Map<String>
Supporting Types
GetServerGroupsGroup
- Address
Ip stringVersion - The protocol version.
- Connection
Drain bool - Indicates whether connection draining is enabled.
- Connection
Drain intTimeout - The timeout period of connection draining. Unit: seconds.
- Health
Checks List<Pulumi.Ali Cloud. Nlb. Inputs. Get Server Groups Group Health Check> - The configurations of health checks.
- Id string
- The ID of the Server Group.
- Preserve
Client boolIp Enabled - Indicates whether client address retention is enabled.
- Protocol string
- The protocol used to forward requests to the backend servers.
- List<string>
- The NLB instance.
- Resource
Group stringId - The ID of the resource group to which the security group belongs.
- Scheduler string
- The routing algorithm.
- Server
Count int - The number of server groups associated with the NLB instance.
- Server
Group stringName - The name of the server group.
- Server
Group stringType - The type of the server group.
- Status string
- The status of the server group.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Vpc
Id string - The ID of the VPC to which the server group belongs.
- Address
Ip stringVersion - The protocol version.
- Connection
Drain bool - Indicates whether connection draining is enabled.
- Connection
Drain intTimeout - The timeout period of connection draining. Unit: seconds.
- Health
Checks []GetServer Groups Group Health Check - The configurations of health checks.
- Id string
- The ID of the Server Group.
- Preserve
Client boolIp Enabled - Indicates whether client address retention is enabled.
- Protocol string
- The protocol used to forward requests to the backend servers.
- []string
- The NLB instance.
- Resource
Group stringId - The ID of the resource group to which the security group belongs.
- Scheduler string
- The routing algorithm.
- Server
Count int - The number of server groups associated with the NLB instance.
- Server
Group stringName - The name of the server group.
- Server
Group stringType - The type of the server group.
- Status string
- The status of the server group.
- map[string]string
- A mapping of tags to assign to the resource.
- Vpc
Id string - The ID of the VPC to which the server group belongs.
- address
Ip StringVersion - The protocol version.
- connection
Drain Boolean - Indicates whether connection draining is enabled.
- connection
Drain IntegerTimeout - The timeout period of connection draining. Unit: seconds.
- health
Checks List<GetServer Groups Group Health Check> - The configurations of health checks.
- id String
- The ID of the Server Group.
- preserve
Client BooleanIp Enabled - Indicates whether client address retention is enabled.
- protocol String
- The protocol used to forward requests to the backend servers.
- List<String>
- The NLB instance.
- resource
Group StringId - The ID of the resource group to which the security group belongs.
- scheduler String
- The routing algorithm.
- server
Count Integer - The number of server groups associated with the NLB instance.
- server
Group StringName - The name of the server group.
- server
Group StringType - The type of the server group.
- status String
- The status of the server group.
- Map<String,String>
- A mapping of tags to assign to the resource.
- vpc
Id String - The ID of the VPC to which the server group belongs.
- address
Ip stringVersion - The protocol version.
- connection
Drain boolean - Indicates whether connection draining is enabled.
- connection
Drain numberTimeout - The timeout period of connection draining. Unit: seconds.
- health
Checks GetServer Groups Group Health Check[] - The configurations of health checks.
- id string
- The ID of the Server Group.
- preserve
Client booleanIp Enabled - Indicates whether client address retention is enabled.
- protocol string
- The protocol used to forward requests to the backend servers.
- string[]
- The NLB instance.
- resource
Group stringId - The ID of the resource group to which the security group belongs.
- scheduler string
- The routing algorithm.
- server
Count number - The number of server groups associated with the NLB instance.
- server
Group stringName - The name of the server group.
- server
Group stringType - The type of the server group.
- status string
- The status of the server group.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- vpc
Id string - The ID of the VPC to which the server group belongs.
- address_
ip_ strversion - The protocol version.
- connection_
drain bool - Indicates whether connection draining is enabled.
- connection_
drain_ inttimeout - The timeout period of connection draining. Unit: seconds.
- health_
checks Sequence[GetServer Groups Group Health Check] - The configurations of health checks.
- id str
- The ID of the Server Group.
- preserve_
client_ boolip_ enabled - Indicates whether client address retention is enabled.
- protocol str
- The protocol used to forward requests to the backend servers.
- Sequence[str]
- The NLB instance.
- resource_
group_ strid - The ID of the resource group to which the security group belongs.
- scheduler str
- The routing algorithm.
- server_
count int - The number of server groups associated with the NLB instance.
- server_
group_ strname - The name of the server group.
- server_
group_ strtype - The type of the server group.
- status str
- The status of the server group.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- vpc_
id str - The ID of the VPC to which the server group belongs.
- address
Ip StringVersion - The protocol version.
- connection
Drain Boolean - Indicates whether connection draining is enabled.
- connection
Drain NumberTimeout - The timeout period of connection draining. Unit: seconds.
- health
Checks List<Property Map> - The configurations of health checks.
- id String
- The ID of the Server Group.
- preserve
Client BooleanIp Enabled - Indicates whether client address retention is enabled.
- protocol String
- The protocol used to forward requests to the backend servers.
- List<String>
- The NLB instance.
- resource
Group StringId - The ID of the resource group to which the security group belongs.
- scheduler String
- The routing algorithm.
- server
Count Number - The number of server groups associated with the NLB instance.
- server
Group StringName - The name of the server group.
- server
Group StringType - The type of the server group.
- status String
- The status of the server group.
- Map<String>
- A mapping of tags to assign to the resource.
- vpc
Id String - The ID of the VPC to which the server group belongs.
GetServerGroupsGroupHealthCheck
- Health
Check intConnect Port - The backend port that is used for health checks.
- Health
Check intConnect Timeout - The maximum timeout period of a health check response.
- Health
Check stringDomain - The domain name that is used for health checks.
- Health
Check boolEnabled - Specifies whether to enable health checks.
- Health
Check List<string>Http Codes - The HTTP status codes returned for health checks.
- Health
Check intInterval - The interval between two consecutive health checks.
- Health
Check stringType - The protocol that is used for health checks.
- Health
Check stringUrl - The path to which health check requests are sent.
- Healthy
Threshold int - The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy.
- Http
Check stringMethod - The HTTP method that is used for health checks.
- Unhealthy
Threshold int - The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy.
- Health
Check intConnect Port - The backend port that is used for health checks.
- Health
Check intConnect Timeout - The maximum timeout period of a health check response.
- Health
Check stringDomain - The domain name that is used for health checks.
- Health
Check boolEnabled - Specifies whether to enable health checks.
- Health
Check []stringHttp Codes - The HTTP status codes returned for health checks.
- Health
Check intInterval - The interval between two consecutive health checks.
- Health
Check stringType - The protocol that is used for health checks.
- Health
Check stringUrl - The path to which health check requests are sent.
- Healthy
Threshold int - The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy.
- Http
Check stringMethod - The HTTP method that is used for health checks.
- Unhealthy
Threshold int - The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy.
- health
Check IntegerConnect Port - The backend port that is used for health checks.
- health
Check IntegerConnect Timeout - The maximum timeout period of a health check response.
- health
Check StringDomain - The domain name that is used for health checks.
- health
Check BooleanEnabled - Specifies whether to enable health checks.
- health
Check List<String>Http Codes - The HTTP status codes returned for health checks.
- health
Check IntegerInterval - The interval between two consecutive health checks.
- health
Check StringType - The protocol that is used for health checks.
- health
Check StringUrl - The path to which health check requests are sent.
- healthy
Threshold Integer - The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy.
- http
Check StringMethod - The HTTP method that is used for health checks.
- unhealthy
Threshold Integer - The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy.
- health
Check numberConnect Port - The backend port that is used for health checks.
- health
Check numberConnect Timeout - The maximum timeout period of a health check response.
- health
Check stringDomain - The domain name that is used for health checks.
- health
Check booleanEnabled - Specifies whether to enable health checks.
- health
Check string[]Http Codes - The HTTP status codes returned for health checks.
- health
Check numberInterval - The interval between two consecutive health checks.
- health
Check stringType - The protocol that is used for health checks.
- health
Check stringUrl - The path to which health check requests are sent.
- healthy
Threshold number - The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy.
- http
Check stringMethod - The HTTP method that is used for health checks.
- unhealthy
Threshold number - The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy.
- health_
check_ intconnect_ port - The backend port that is used for health checks.
- health_
check_ intconnect_ timeout - The maximum timeout period of a health check response.
- health_
check_ strdomain - The domain name that is used for health checks.
- health_
check_ boolenabled - Specifies whether to enable health checks.
- health_
check_ Sequence[str]http_ codes - The HTTP status codes returned for health checks.
- health_
check_ intinterval - The interval between two consecutive health checks.
- health_
check_ strtype - The protocol that is used for health checks.
- health_
check_ strurl - The path to which health check requests are sent.
- healthy_
threshold int - The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy.
- http_
check_ strmethod - The HTTP method that is used for health checks.
- unhealthy_
threshold int - The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy.
- health
Check NumberConnect Port - The backend port that is used for health checks.
- health
Check NumberConnect Timeout - The maximum timeout period of a health check response.
- health
Check StringDomain - The domain name that is used for health checks.
- health
Check BooleanEnabled - Specifies whether to enable health checks.
- health
Check List<String>Http Codes - The HTTP status codes returned for health checks.
- health
Check NumberInterval - The interval between two consecutive health checks.
- health
Check StringType - The protocol that is used for health checks.
- health
Check StringUrl - The path to which health check requests are sent.
- healthy
Threshold Number - The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy.
- http
Check StringMethod - The HTTP method that is used for health checks.
- unhealthy
Threshold Number - The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.