Viewing docs for Alibaba Cloud v3.96.0
published on Tuesday, Mar 3, 2026 by Pulumi
published on Tuesday, Mar 3, 2026 by Pulumi
Viewing docs for Alibaba Cloud v3.96.0
published on Tuesday, Mar 3, 2026 by Pulumi
published on Tuesday, Mar 3, 2026 by Pulumi
The alicloud.polardb.getEndpoints data source provides a collection of PolarDB endpoints available in Alibaba Cloud account.
Filters support regular expression for the cluster name, searches by clusterId, and other filters which are listed below.
NOTE: Available since v1.68.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _this = alicloud.polardb.getNodeClasses({
dbType: "MySQL",
dbVersion: "8.0",
payType: "PostPaid",
category: "Normal",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: "terraform-example",
cidrBlock: "172.16.0.0/16",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vpcId: defaultNetwork.id,
cidrBlock: "172.16.0.0/24",
zoneId: _this.then(_this => _this.classes?.[0]?.zoneId),
vswitchName: "terraform-example",
});
const cluster = new alicloud.polardb.Cluster("cluster", {
dbType: "MySQL",
dbVersion: "8.0",
payType: "PostPaid",
dbNodeCount: 2,
dbNodeClass: _this.then(_this => _this.classes?.[0]?.supportedEngines?.[0]?.availableResources?.[0]?.dbNodeClass),
vswitchId: defaultSwitch.id,
});
const polardbClustersDs = alicloud.polardb.getClustersOutput({
descriptionRegex: cluster.description,
status: "Running",
});
const _default = polardbClustersDs.apply(polardbClustersDs => alicloud.polardb.getEndpointsOutput({
dbClusterId: polardbClustersDs.clusters?.[0]?.id,
}));
export const endpoint = _default.apply(_default => _default.endpoints?.[0]?.dbEndpointId);
import pulumi
import pulumi_alicloud as alicloud
this = alicloud.polardb.get_node_classes(db_type="MySQL",
db_version="8.0",
pay_type="PostPaid",
category="Normal")
default_network = alicloud.vpc.Network("default",
vpc_name="terraform-example",
cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("default",
vpc_id=default_network.id,
cidr_block="172.16.0.0/24",
zone_id=this.classes[0].zone_id,
vswitch_name="terraform-example")
cluster = alicloud.polardb.Cluster("cluster",
db_type="MySQL",
db_version="8.0",
pay_type="PostPaid",
db_node_count=2,
db_node_class=this.classes[0].supported_engines[0].available_resources[0].db_node_class,
vswitch_id=default_switch.id)
polardb_clusters_ds = alicloud.polardb.get_clusters_output(description_regex=cluster.description,
status="Running")
default = polardb_clusters_ds.apply(lambda polardb_clusters_ds: alicloud.polardb.get_endpoints_output(db_cluster_id=polardb_clusters_ds.clusters[0].id))
pulumi.export("endpoint", default.endpoints[0].db_endpoint_id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/polardb"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
this, err := polardb.GetNodeClasses(ctx, &polardb.GetNodeClassesArgs{
DbType: pulumi.StringRef("MySQL"),
DbVersion: pulumi.StringRef("8.0"),
PayType: "PostPaid",
Category: pulumi.StringRef("Normal"),
}, nil);
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String("terraform-example"),
CidrBlock: pulumi.String("172.16.0.0/16"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String("172.16.0.0/24"),
ZoneId: pulumi.String(this.Classes[0].ZoneId),
VswitchName: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
cluster, err := polardb.NewCluster(ctx, "cluster", &polardb.ClusterArgs{
DbType: pulumi.String("MySQL"),
DbVersion: pulumi.String("8.0"),
PayType: pulumi.String("PostPaid"),
DbNodeCount: pulumi.Int(2),
DbNodeClass: pulumi.String(this.Classes[0].SupportedEngines[0].AvailableResources[0].DbNodeClass),
VswitchId: defaultSwitch.ID(),
})
if err != nil {
return err
}
polardbClustersDs := polardb.GetClustersOutput(ctx, polardb.GetClustersOutputArgs{
DescriptionRegex: cluster.Description,
Status: pulumi.String("Running"),
}, nil);
_default := polardbClustersDs.ApplyT(func(polardbClustersDs polardb.GetClustersResult) (polardb.GetEndpointsResult, error) {
return polardb.GetEndpointsResult(interface{}(polardb.GetEndpoints(ctx, &polardb.GetEndpointsArgs{
DbClusterId: polardbClustersDs.Clusters[0].Id,
}, nil))), nil
}).(polardb.GetEndpointsResultOutput)
ctx.Export("endpoint", _default.ApplyT(func(_default polardb.GetEndpointsResult) (*string, error) {
return &default.Endpoints[0].DbEndpointId, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @this = AliCloud.PolarDB.GetNodeClasses.Invoke(new()
{
DbType = "MySQL",
DbVersion = "8.0",
PayType = "PostPaid",
Category = "Normal",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = "terraform-example",
CidrBlock = "172.16.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/24",
ZoneId = @this.Apply(@this => @this.Apply(getNodeClassesResult => getNodeClassesResult.Classes[0]?.ZoneId)),
VswitchName = "terraform-example",
});
var cluster = new AliCloud.PolarDB.Cluster("cluster", new()
{
DbType = "MySQL",
DbVersion = "8.0",
PayType = "PostPaid",
DbNodeCount = 2,
DbNodeClass = @this.Apply(@this => @this.Apply(getNodeClassesResult => getNodeClassesResult.Classes[0]?.SupportedEngines[0]?.AvailableResources[0]?.DbNodeClass)),
VswitchId = defaultSwitch.Id,
});
var polardbClustersDs = AliCloud.PolarDB.GetClusters.Invoke(new()
{
DescriptionRegex = cluster.Description,
Status = "Running",
});
var @default = AliCloud.PolarDB.GetEndpoints.Invoke(new()
{
DbClusterId = polardbClustersDs.Apply(getClustersResult => getClustersResult.Clusters[0]?.Id),
});
return new Dictionary<string, object?>
{
["endpoint"] = @default.Apply(@default => @default.Apply(getEndpointsResult => getEndpointsResult.Endpoints[0]?.DbEndpointId)),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.polardb.PolardbFunctions;
import com.pulumi.alicloud.polardb.inputs.GetNodeClassesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.polardb.Cluster;
import com.pulumi.alicloud.polardb.ClusterArgs;
import com.pulumi.alicloud.polardb.inputs.GetClustersArgs;
import com.pulumi.alicloud.polardb.inputs.GetEndpointsArgs;
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 this = PolardbFunctions.getNodeClasses(GetNodeClassesArgs.builder()
.dbType("MySQL")
.dbVersion("8.0")
.payType("PostPaid")
.category("Normal")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName("terraform-example")
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(this_.classes()[0].zoneId())
.vswitchName("terraform-example")
.build());
var cluster = new Cluster("cluster", ClusterArgs.builder()
.dbType("MySQL")
.dbVersion("8.0")
.payType("PostPaid")
.dbNodeCount(2)
.dbNodeClass(this_.classes()[0].supportedEngines()[0].availableResources()[0].dbNodeClass())
.vswitchId(defaultSwitch.id())
.build());
final var polardbClustersDs = PolardbFunctions.getClusters(GetClustersArgs.builder()
.descriptionRegex(cluster.description())
.status("Running")
.build());
final var default = polardbClustersDs.applyValue(_polardbClustersDs -> PolardbFunctions.getEndpoints(GetEndpointsArgs.builder()
.dbClusterId(_polardbClustersDs.clusters()[0].id())
.build()));
ctx.export("endpoint", default_.applyValue(_default_ -> _default_.endpoints()[0].dbEndpointId()));
}
}
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: terraform-example
cidrBlock: 172.16.0.0/16
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vpcId: ${defaultNetwork.id}
cidrBlock: 172.16.0.0/24
zoneId: ${this.classes[0].zoneId}
vswitchName: terraform-example
cluster:
type: alicloud:polardb:Cluster
properties:
dbType: MySQL
dbVersion: '8.0'
payType: PostPaid
dbNodeCount: '2'
dbNodeClass: ${this.classes[0].supportedEngines[0].availableResources[0].dbNodeClass}
vswitchId: ${defaultSwitch.id}
variables:
this:
fn::invoke:
function: alicloud:polardb:getNodeClasses
arguments:
dbType: MySQL
dbVersion: '8.0'
payType: PostPaid
category: Normal
polardbClustersDs:
fn::invoke:
function: alicloud:polardb:getClusters
arguments:
descriptionRegex: ${cluster.description}
status: Running
default:
fn::invoke:
function: alicloud:polardb:getEndpoints
arguments:
dbClusterId: ${polardbClustersDs.clusters[0].id}
outputs:
endpoint: ${default.endpoints[0].dbEndpointId}
Using getEndpoints
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 getEndpoints(args: GetEndpointsArgs, opts?: InvokeOptions): Promise<GetEndpointsResult>
function getEndpointsOutput(args: GetEndpointsOutputArgs, opts?: InvokeOptions): Output<GetEndpointsResult>def get_endpoints(db_cluster_id: Optional[str] = None,
db_endpoint_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetEndpointsResult
def get_endpoints_output(db_cluster_id: Optional[pulumi.Input[str]] = None,
db_endpoint_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetEndpointsResult]func GetEndpoints(ctx *Context, args *GetEndpointsArgs, opts ...InvokeOption) (*GetEndpointsResult, error)
func GetEndpointsOutput(ctx *Context, args *GetEndpointsOutputArgs, opts ...InvokeOption) GetEndpointsResultOutput> Note: This function is named GetEndpoints in the Go SDK.
public static class GetEndpoints
{
public static Task<GetEndpointsResult> InvokeAsync(GetEndpointsArgs args, InvokeOptions? opts = null)
public static Output<GetEndpointsResult> Invoke(GetEndpointsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetEndpointsResult> getEndpoints(GetEndpointsArgs args, InvokeOptions options)
public static Output<GetEndpointsResult> getEndpoints(GetEndpointsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:polardb/getEndpoints:getEndpoints
arguments:
# arguments dictionaryThe following arguments are supported:
- Db
Cluster stringId - PolarDB cluster ID.
- Db
Endpoint stringId - endpoint of the cluster.
- Db
Cluster stringId - PolarDB cluster ID.
- Db
Endpoint stringId - endpoint of the cluster.
- db
Cluster StringId - PolarDB cluster ID.
- db
Endpoint StringId - endpoint of the cluster.
- db
Cluster stringId - PolarDB cluster ID.
- db
Endpoint stringId - endpoint of the cluster.
- db_
cluster_ strid - PolarDB cluster ID.
- db_
endpoint_ strid - endpoint of the cluster.
- db
Cluster StringId - PolarDB cluster ID.
- db
Endpoint StringId - endpoint of the cluster.
getEndpoints Result
The following output properties are available:
- Db
Cluster stringId - Endpoints
List<Pulumi.
Ali Cloud. Polar DB. Outputs. Get Endpoints Endpoint> - A list of PolarDB cluster endpoints. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Db
Endpoint stringId - The endpoint ID.
- Db
Cluster stringId - Endpoints
[]Get
Endpoints Endpoint - A list of PolarDB cluster endpoints. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Db
Endpoint stringId - The endpoint ID.
- db
Cluster StringId - endpoints
List<Get
Endpoints Endpoint> - A list of PolarDB cluster endpoints. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- db
Endpoint StringId - The endpoint ID.
- db
Cluster stringId - endpoints
Get
Endpoints Endpoint[] - A list of PolarDB cluster endpoints. Each element contains the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- db
Endpoint stringId - The endpoint ID.
- db_
cluster_ strid - endpoints
Sequence[Get
Endpoints Endpoint] - A list of PolarDB cluster endpoints. Each element contains the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- db_
endpoint_ strid - The endpoint ID.
- db
Cluster StringId - endpoints List<Property Map>
- A list of PolarDB cluster endpoints. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- db
Endpoint StringId - The endpoint ID.
Supporting Types
GetEndpointsEndpoint
- Address
Items List<Pulumi.Ali Cloud. Polar DB. Inputs. Get Endpoints Endpoint Address Item> - A list of endpoint addresses. Each element contains the following attributes.
- Auto
Add stringNew Nodes - Whether the new node is automatically added to the default cluster address.Options are
EnableandDisable. - Db
Endpoint stringId - endpoint of the cluster.
- Endpoint
Config string - The Endpoint configuration.
ConsistLevel: session consistency level, value:0: final consistency,1: session consistency;LoadBalanceStrategy: load balancing strategy. Based on the automatic scheduling of load, the value is:load. - Endpoint
Type string - Cluster address type.
Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses. - Nodes string
- A list of nodes that connect to the address configuration.
- Read
Write stringMode - Read-write mode:
ReadWrite: readable and writable (automatic read-write separation).ReadOnly: ReadOnly.
- Address
Items []GetEndpoints Endpoint Address Item - A list of endpoint addresses. Each element contains the following attributes.
- Auto
Add stringNew Nodes - Whether the new node is automatically added to the default cluster address.Options are
EnableandDisable. - Db
Endpoint stringId - endpoint of the cluster.
- Endpoint
Config string - The Endpoint configuration.
ConsistLevel: session consistency level, value:0: final consistency,1: session consistency;LoadBalanceStrategy: load balancing strategy. Based on the automatic scheduling of load, the value is:load. - Endpoint
Type string - Cluster address type.
Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses. - Nodes string
- A list of nodes that connect to the address configuration.
- Read
Write stringMode - Read-write mode:
ReadWrite: readable and writable (automatic read-write separation).ReadOnly: ReadOnly.
- address
Items List<GetEndpoints Endpoint Address Item> - A list of endpoint addresses. Each element contains the following attributes.
- auto
Add StringNew Nodes - Whether the new node is automatically added to the default cluster address.Options are
EnableandDisable. - db
Endpoint StringId - endpoint of the cluster.
- endpoint
Config String - The Endpoint configuration.
ConsistLevel: session consistency level, value:0: final consistency,1: session consistency;LoadBalanceStrategy: load balancing strategy. Based on the automatic scheduling of load, the value is:load. - endpoint
Type String - Cluster address type.
Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses. - nodes String
- A list of nodes that connect to the address configuration.
- read
Write StringMode - Read-write mode:
ReadWrite: readable and writable (automatic read-write separation).ReadOnly: ReadOnly.
- address
Items GetEndpoints Endpoint Address Item[] - A list of endpoint addresses. Each element contains the following attributes.
- auto
Add stringNew Nodes - Whether the new node is automatically added to the default cluster address.Options are
EnableandDisable. - db
Endpoint stringId - endpoint of the cluster.
- endpoint
Config string - The Endpoint configuration.
ConsistLevel: session consistency level, value:0: final consistency,1: session consistency;LoadBalanceStrategy: load balancing strategy. Based on the automatic scheduling of load, the value is:load. - endpoint
Type string - Cluster address type.
Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses. - nodes string
- A list of nodes that connect to the address configuration.
- read
Write stringMode - Read-write mode:
ReadWrite: readable and writable (automatic read-write separation).ReadOnly: ReadOnly.
- address_
items Sequence[GetEndpoints Endpoint Address Item] - A list of endpoint addresses. Each element contains the following attributes.
- auto_
add_ strnew_ nodes - Whether the new node is automatically added to the default cluster address.Options are
EnableandDisable. - db_
endpoint_ strid - endpoint of the cluster.
- endpoint_
config str - The Endpoint configuration.
ConsistLevel: session consistency level, value:0: final consistency,1: session consistency;LoadBalanceStrategy: load balancing strategy. Based on the automatic scheduling of load, the value is:load. - endpoint_
type str - Cluster address type.
Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses. - nodes str
- A list of nodes that connect to the address configuration.
- read_
write_ strmode - Read-write mode:
ReadWrite: readable and writable (automatic read-write separation).ReadOnly: ReadOnly.
- address
Items List<Property Map> - A list of endpoint addresses. Each element contains the following attributes.
- auto
Add StringNew Nodes - Whether the new node is automatically added to the default cluster address.Options are
EnableandDisable. - db
Endpoint StringId - endpoint of the cluster.
- endpoint
Config String - The Endpoint configuration.
ConsistLevel: session consistency level, value:0: final consistency,1: session consistency;LoadBalanceStrategy: load balancing strategy. Based on the automatic scheduling of load, the value is:load. - endpoint
Type String - Cluster address type.
Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses. - nodes String
- A list of nodes that connect to the address configuration.
- read
Write StringMode - Read-write mode:
ReadWrite: readable and writable (automatic read-write separation).ReadOnly: ReadOnly.
GetEndpointsEndpointAddressItem
- connection_
string str - Connection instance string.
- ip_
address str - The ip address of connection string.
- net_
type str - IP network type:
PublicorPrivate. - port str
- Intranet connection port.
- vpc_
id str - ID of the VPC the instance belongs to.
- vswitch_
id str - ID of the vSwitch the cluster belongs to.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
Viewing docs for Alibaba Cloud v3.96.0
published on Tuesday, Mar 3, 2026 by Pulumi
published on Tuesday, Mar 3, 2026 by Pulumi
