GetInstances

The alicloud.rds.getInstances data source provides a collection of RDS instances available in Alibaba Cloud account. Filters support regular expression for the instance name, searches by tags, and other filters which are listed below.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var dbInstancesDs = Output.Create(AliCloud.Rds.GetInstances.InvokeAsync(new AliCloud.Rds.GetInstancesArgs
        {
            NameRegex = "data-\\d+",
            Status = "Running",
            Tags = 
            {
                { "size", "tiny" },
                { "type", "database" },
            },
        }));
        this.FirstDbInstanceId = dbInstancesDs.Apply(dbInstancesDs => dbInstancesDs.Instances[0].Id);
    }

    [Output("firstDbInstanceId")]
    public Output<string> FirstDbInstanceId { get; set; }
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

db_instances_ds = alicloud.rds.get_instances(name_regex="data-\\d+",
    status="Running",
    tags={
        "size": "tiny",
        "type": "database",
    })
pulumi.export("firstDbInstanceId", db_instances_ds.instances[0]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const dbInstancesDs = pulumi.output(alicloud.rds.getInstances({
    nameRegex: "data-\\d+",
    status: "Running",
    tags: {
        size: "tiny",
        type: "database",
    },
}, { async: true }));

export const firstDbInstanceId = dbInstancesDs.instances[0].id;

Using GetInstances

function getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
function  get_instances(connection_mode=None, db_type=None, engine=None, ids=None, name_regex=None, output_file=None, status=None, tags=None, vpc_id=None, vswitch_id=None, opts=None)
func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
public static class GetInstances {
    public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ConnectionMode string

Standard for standard access mode and Safe for high security access mode.

DbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

Engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

Ids List<string>

A list of RDS instance IDs.

NameRegex string

A regex string to filter results by instance name.

OutputFile string
Status string

Status of the instance.

Tags Dictionary<string, object>

A map of tags assigned to the DB instances. Note: Before 1.60.0, the value’s format is a json string which including TagKey and TagValue. TagKey cannot be null, and TagValue can be empty. Format example "{\"key1\":\"value1\"}"

VpcId string

Used to retrieve instances belong to specified VPC.

VswitchId string

Used to retrieve instances belong to specified vswitch resources.

ConnectionMode string

Standard for standard access mode and Safe for high security access mode.

DbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

Engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

Ids []string

A list of RDS instance IDs.

NameRegex string

A regex string to filter results by instance name.

OutputFile string
Status string

Status of the instance.

Tags map[string]interface{}

A map of tags assigned to the DB instances. Note: Before 1.60.0, the value’s format is a json string which including TagKey and TagValue. TagKey cannot be null, and TagValue can be empty. Format example "{\"key1\":\"value1\"}"

VpcId string

Used to retrieve instances belong to specified VPC.

VswitchId string

Used to retrieve instances belong to specified vswitch resources.

connectionMode string

Standard for standard access mode and Safe for high security access mode.

dbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

ids string[]

A list of RDS instance IDs.

nameRegex string

A regex string to filter results by instance name.

outputFile string
status string

Status of the instance.

tags {[key: string]: any}

A map of tags assigned to the DB instances. Note: Before 1.60.0, the value’s format is a json string which including TagKey and TagValue. TagKey cannot be null, and TagValue can be empty. Format example "{\"key1\":\"value1\"}"

vpcId string

Used to retrieve instances belong to specified VPC.

vswitchId string

Used to retrieve instances belong to specified vswitch resources.

connection_mode str

Standard for standard access mode and Safe for high security access mode.

db_type str

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

engine str

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

ids List[str]

A list of RDS instance IDs.

name_regex str

A regex string to filter results by instance name.

output_file str
status str

Status of the instance.

tags Dict[str, Any]

A map of tags assigned to the DB instances. Note: Before 1.60.0, the value’s format is a json string which including TagKey and TagValue. TagKey cannot be null, and TagValue can be empty. Format example "{\"key1\":\"value1\"}"

vpc_id str

Used to retrieve instances belong to specified VPC.

vswitch_id str

Used to retrieve instances belong to specified vswitch resources.

GetInstances Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of RDS instance IDs.

Instances List<Pulumi.AliCloud.Rds.Outputs.GetInstancesInstance>

A list of RDS instances. Each element contains the following attributes:

Names List<string>

A list of RDS instance names.

ConnectionMode string

Standard for standard access mode and Safe for high security access mode.

DbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

Engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

NameRegex string
OutputFile string
Status string

Status of the instance.

Tags Dictionary<string, object>
VpcId string

ID of the VPC the instance belongs to.

VswitchId string

ID of the VSwitch the instance belongs to.

Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of RDS instance IDs.

Instances []GetInstancesInstance

A list of RDS instances. Each element contains the following attributes:

Names []string

A list of RDS instance names.

ConnectionMode string

Standard for standard access mode and Safe for high security access mode.

DbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

Engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

NameRegex string
OutputFile string
Status string

Status of the instance.

Tags map[string]interface{}
VpcId string

ID of the VPC the instance belongs to.

VswitchId string

ID of the VSwitch the instance belongs to.

id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of RDS instance IDs.

instances GetInstancesInstance[]

A list of RDS instances. Each element contains the following attributes:

names string[]

A list of RDS instance names.

connectionMode string

Standard for standard access mode and Safe for high security access mode.

dbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

nameRegex string
outputFile string
status string

Status of the instance.

tags {[key: string]: any}
vpcId string

ID of the VPC the instance belongs to.

vswitchId string

ID of the VSwitch the instance belongs to.

id str

The provider-assigned unique ID for this managed resource.

ids List[str]

A list of RDS instance IDs.

instances List[GetInstancesInstance]

A list of RDS instances. Each element contains the following attributes:

names List[str]

A list of RDS instance names.

connection_mode str

Standard for standard access mode and Safe for high security access mode.

db_type str

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

engine str

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

name_regex str
output_file str
status str

Status of the instance.

tags Dict[str, Any]
vpc_id str

ID of the VPC the instance belongs to.

vswitch_id str

ID of the VSwitch the instance belongs to.

Supporting Types

GetInstancesInstance

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

AvailabilityZone string

Availability zone.

ChargeType string

Billing method. Value options: Postpaid for Pay-As-You-Go and Prepaid for subscription.

ConnectionMode string

Standard for standard access mode and Safe for high security access mode.

ConnectionString string

(Available in 1.70.3+) RDS database connection string.

CreateTime string

Creation time of the instance.

DbInstanceStorageType string

(Available in 1.70.3+) The storage type of the instance.

DbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

Engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

EngineVersion string

Database version.

ExpireTime string

Expiration time. Pay-As-You-Go instances never expire.

GuardInstanceId string

If a disaster recovery instance is attached to the current instance, the ID of the disaster recovery instance applies.

Id string

The ID of the RDS instance.

InstanceStorage int

(Available in 1.70.3+) User-defined DB instance storage space.

InstanceType string

Sizing of the RDS instance.

MasterInstanceId string

ID of the primary instance. If this parameter is not returned, the current instance is a primary instance.

Name string

The name of the RDS instance.

NetType string

Internet for public network or Intranet for private network.

Port string

(Available in 1.70.3+) RDS database connection port.

ReadonlyInstanceIds List<string>

A list of IDs of read-only instances attached to the primary instance.

RegionId string

Region ID the instance belongs to.

Status string

Status of the instance.

TempInstanceId string

If a temporary instance is attached to the current instance, the ID of the temporary instance applies.

VpcId string

Used to retrieve instances belong to specified VPC.

VswitchId string

Used to retrieve instances belong to specified vswitch resources.

AvailabilityZone string

Availability zone.

ChargeType string

Billing method. Value options: Postpaid for Pay-As-You-Go and Prepaid for subscription.

ConnectionMode string

Standard for standard access mode and Safe for high security access mode.

ConnectionString string

(Available in 1.70.3+) RDS database connection string.

CreateTime string

Creation time of the instance.

DbInstanceStorageType string

(Available in 1.70.3+) The storage type of the instance.

DbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

Engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

EngineVersion string

Database version.

ExpireTime string

Expiration time. Pay-As-You-Go instances never expire.

GuardInstanceId string

If a disaster recovery instance is attached to the current instance, the ID of the disaster recovery instance applies.

Id string

The ID of the RDS instance.

InstanceStorage int

(Available in 1.70.3+) User-defined DB instance storage space.

InstanceType string

Sizing of the RDS instance.

MasterInstanceId string

ID of the primary instance. If this parameter is not returned, the current instance is a primary instance.

Name string

The name of the RDS instance.

NetType string

Internet for public network or Intranet for private network.

Port string

(Available in 1.70.3+) RDS database connection port.

ReadonlyInstanceIds []string

A list of IDs of read-only instances attached to the primary instance.

RegionId string

Region ID the instance belongs to.

Status string

Status of the instance.

TempInstanceId string

If a temporary instance is attached to the current instance, the ID of the temporary instance applies.

VpcId string

Used to retrieve instances belong to specified VPC.

VswitchId string

Used to retrieve instances belong to specified vswitch resources.

availabilityZone string

Availability zone.

chargeType string

Billing method. Value options: Postpaid for Pay-As-You-Go and Prepaid for subscription.

connectionMode string

Standard for standard access mode and Safe for high security access mode.

connectionString string

(Available in 1.70.3+) RDS database connection string.

createTime string

Creation time of the instance.

dbInstanceStorageType string

(Available in 1.70.3+) The storage type of the instance.

dbType string

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

engine string

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

engineVersion string

Database version.

expireTime string

Expiration time. Pay-As-You-Go instances never expire.

guardInstanceId string

If a disaster recovery instance is attached to the current instance, the ID of the disaster recovery instance applies.

id string

The ID of the RDS instance.

instanceStorage number

(Available in 1.70.3+) User-defined DB instance storage space.

instanceType string

Sizing of the RDS instance.

masterInstanceId string

ID of the primary instance. If this parameter is not returned, the current instance is a primary instance.

name string

The name of the RDS instance.

netType string

Internet for public network or Intranet for private network.

port string

(Available in 1.70.3+) RDS database connection port.

readonlyInstanceIds string[]

A list of IDs of read-only instances attached to the primary instance.

regionId string

Region ID the instance belongs to.

status string

Status of the instance.

tempInstanceId string

If a temporary instance is attached to the current instance, the ID of the temporary instance applies.

vpcId string

Used to retrieve instances belong to specified VPC.

vswitchId string

Used to retrieve instances belong to specified vswitch resources.

availability_zone str

Availability zone.

charge_type str

Billing method. Value options: Postpaid for Pay-As-You-Go and Prepaid for subscription.

connectionMode str

Standard for standard access mode and Safe for high security access mode.

connection_string str

(Available in 1.70.3+) RDS database connection string.

create_time str

Creation time of the instance.

db_instance_storage_type str

(Available in 1.70.3+) The storage type of the instance.

db_type str

Primary for primary instance, Readonly for read-only instance, Guard for disaster recovery instance, and Temp for temporary instance.

engine str

Database type. Options are MySQL, SQLServer, PostgreSQL and PPAS. If no value is specified, all types are returned.

engine_version str

Database version.

expire_time str

Expiration time. Pay-As-You-Go instances never expire.

guardInstanceId str

If a disaster recovery instance is attached to the current instance, the ID of the disaster recovery instance applies.

id str

The ID of the RDS instance.

instance_storage float

(Available in 1.70.3+) User-defined DB instance storage space.

instance_type str

Sizing of the RDS instance.

masterInstanceId str

ID of the primary instance. If this parameter is not returned, the current instance is a primary instance.

name str

The name of the RDS instance.

net_type str

Internet for public network or Intranet for private network.

port str

(Available in 1.70.3+) RDS database connection port.

readonlyInstanceIds List[str]

A list of IDs of read-only instances attached to the primary instance.

regionId str

Region ID the instance belongs to.

status str

Status of the instance.

tempInstanceId str

If a temporary instance is attached to the current instance, the ID of the temporary instance applies.

vpc_id str

Used to retrieve instances belong to specified VPC.

vswitch_id str

Used to retrieve instances belong to specified vswitch resources.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.