1. Packages
  2. Ucloud Provider
  3. API Docs
  4. getDbInstances
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.getDbInstances

Explore with Pulumi AI

ucloud logo
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

    This data source provides a list of database instance resources according to their database instance ID and name.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const example = ucloud.getDbInstances({});
    export const first = example.then(example => example.dbInstances?.[0]?.id);
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    example = ucloud.get_db_instances()
    pulumi.export("first", example.db_instances[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ucloud.GetDbInstances(ctx, &ucloud.GetDbInstancesArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("first", example.DbInstances[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ucloud.GetDbInstances.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["first"] = example.Apply(getDbInstancesResult => getDbInstancesResult.DbInstances[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ucloud.UcloudFunctions;
    import com.pulumi.ucloud.inputs.GetDbInstancesArgs;
    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 example = UcloudFunctions.getDbInstances();
    
            ctx.export("first", example.applyValue(getDbInstancesResult -> getDbInstancesResult.dbInstances()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ucloud:getDbInstances
          arguments: {}
    outputs:
      first: ${example.dbInstances[0].id}
    

    Using getDbInstances

    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 getDbInstances(args: GetDbInstancesArgs, opts?: InvokeOptions): Promise<GetDbInstancesResult>
    function getDbInstancesOutput(args: GetDbInstancesOutputArgs, opts?: InvokeOptions): Output<GetDbInstancesResult>
    def get_db_instances(availability_zone: Optional[str] = None,
                         id: Optional[str] = None,
                         ids: Optional[Sequence[str]] = None,
                         name_regex: Optional[str] = None,
                         output_file: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetDbInstancesResult
    def get_db_instances_output(availability_zone: Optional[pulumi.Input[str]] = None,
                         id: Optional[pulumi.Input[str]] = None,
                         ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                         name_regex: Optional[pulumi.Input[str]] = None,
                         output_file: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetDbInstancesResult]
    func GetDbInstances(ctx *Context, args *GetDbInstancesArgs, opts ...InvokeOption) (*GetDbInstancesResult, error)
    func GetDbInstancesOutput(ctx *Context, args *GetDbInstancesOutputArgs, opts ...InvokeOption) GetDbInstancesResultOutput

    > Note: This function is named GetDbInstances in the Go SDK.

    public static class GetDbInstances 
    {
        public static Task<GetDbInstancesResult> InvokeAsync(GetDbInstancesArgs args, InvokeOptions? opts = null)
        public static Output<GetDbInstancesResult> Invoke(GetDbInstancesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDbInstancesResult> getDbInstances(GetDbInstancesArgs args, InvokeOptions options)
    public static Output<GetDbInstancesResult> getDbInstances(GetDbInstancesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ucloud:index/getDbInstances:getDbInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AvailabilityZone string
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    Id string
    The ID of database instance.
    Ids List<string>
    A list of database instance IDs, all the database instances belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter resulting database instances by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    AvailabilityZone string
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    Id string
    The ID of database instance.
    Ids []string
    A list of database instance IDs, all the database instances belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter resulting database instances by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    id String
    The ID of database instance.
    ids List<String>
    A list of database instance IDs, all the database instances belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter resulting database instances by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    availabilityZone string
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    id string
    The ID of database instance.
    ids string[]
    A list of database instance IDs, all the database instances belong to this region will be retrieved if the ID is [].
    nameRegex string
    A regex string to filter resulting database instances by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    availability_zone str
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    id str
    The ID of database instance.
    ids Sequence[str]
    A list of database instance IDs, all the database instances belong to this region will be retrieved if the ID is [].
    name_regex str
    A regex string to filter resulting database instances by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    id String
    The ID of database instance.
    ids List<String>
    A list of database instance IDs, all the database instances belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter resulting database instances by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getDbInstances Result

    The following output properties are available:

    DbInstances List<GetDbInstancesDbInstance>
    It is a nested type which documented below.
    Id string
    The ID of database instance.
    Ids List<string>
    TotalCount double
    Total number of database instances that satisfy the condition.
    AvailabilityZone string
    Availability zone where database instance is located.
    NameRegex string
    OutputFile string
    DbInstances []GetDbInstancesDbInstance
    It is a nested type which documented below.
    Id string
    The ID of database instance.
    Ids []string
    TotalCount float64
    Total number of database instances that satisfy the condition.
    AvailabilityZone string
    Availability zone where database instance is located.
    NameRegex string
    OutputFile string
    dbInstances List<GetDbInstancesDbInstance>
    It is a nested type which documented below.
    id String
    The ID of database instance.
    ids List<String>
    totalCount Double
    Total number of database instances that satisfy the condition.
    availabilityZone String
    Availability zone where database instance is located.
    nameRegex String
    outputFile String
    dbInstances GetDbInstancesDbInstance[]
    It is a nested type which documented below.
    id string
    The ID of database instance.
    ids string[]
    totalCount number
    Total number of database instances that satisfy the condition.
    availabilityZone string
    Availability zone where database instance is located.
    nameRegex string
    outputFile string
    db_instances Sequence[GetDbInstancesDbInstance]
    It is a nested type which documented below.
    id str
    The ID of database instance.
    ids Sequence[str]
    total_count float
    Total number of database instances that satisfy the condition.
    availability_zone str
    Availability zone where database instance is located.
    name_regex str
    output_file str
    dbInstances List<Property Map>
    It is a nested type which documented below.
    id String
    The ID of database instance.
    ids List<String>
    totalCount Number
    Total number of database instances that satisfy the condition.
    availabilityZone String
    Availability zone where database instance is located.
    nameRegex String
    outputFile String

    Supporting Types

    GetDbInstancesDbInstance

    AvailabilityZone string
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    BackupBeginTime double
    Specifies when the backup starts, measured in hour.
    BackupBlackLists List<string>
    The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
    BackupCount double
    Specifies the number of backup saved per week.
    BackupDate string
    Specifies whether the backup took place from Sunday to Saturday by displaying 7 digits. 0 stands for backup disabled and 1 stands for backup enabled. The rightmost digit specifies whether the backup took place on Sunday, and the digits from right to left specify whether the backup took place from Monday to Saturday, it's mandatory required to backup twice per week at least. such as: digits "1100000" stands for the backup took place on Saturday and Friday.
    ChargeType string
    The charge type of db instance.
    CreateTime string
    The creation time of database instance , formatted by RFC3339 time string.
    Engine string
    The type of database instance engine.
    EngineVersion string
    The database instance engine version.
    ExpireTime string
    The expiration time of database instance , formatted by RFC3339 time string.
    Id string
    The ID of database instance.
    InstanceStorage double
    Specifies the allocated storage size in gigabytes (GB).
    InstanceType string
    Specifies the type of database instance.
    ModifyTime string
    The modification time of database instance , formatted by RFC3339 time string.
    Name string
    The name of database instance.
    Port double
    The port on which the database instance accepts connections.
    PrivateIp string
    The private IP address assigned to the database instance.
    StandbyZone string
    Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
    Status string
    Specifies the status of database instance , possible values are: Init, Fail, Starting, Running, Shutdown, Shutoff, Delete, Upgrading, Promoting, Recovering and Recover fail.
    SubnetId string
    The ID of subnet linked to the database instances.
    Tag string
    A tag assigned to database instance.
    VpcId string
    The ID of VPC linked to the database instances.
    AvailabilityZone string
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    BackupBeginTime float64
    Specifies when the backup starts, measured in hour.
    BackupBlackLists []string
    The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
    BackupCount float64
    Specifies the number of backup saved per week.
    BackupDate string
    Specifies whether the backup took place from Sunday to Saturday by displaying 7 digits. 0 stands for backup disabled and 1 stands for backup enabled. The rightmost digit specifies whether the backup took place on Sunday, and the digits from right to left specify whether the backup took place from Monday to Saturday, it's mandatory required to backup twice per week at least. such as: digits "1100000" stands for the backup took place on Saturday and Friday.
    ChargeType string
    The charge type of db instance.
    CreateTime string
    The creation time of database instance , formatted by RFC3339 time string.
    Engine string
    The type of database instance engine.
    EngineVersion string
    The database instance engine version.
    ExpireTime string
    The expiration time of database instance , formatted by RFC3339 time string.
    Id string
    The ID of database instance.
    InstanceStorage float64
    Specifies the allocated storage size in gigabytes (GB).
    InstanceType string
    Specifies the type of database instance.
    ModifyTime string
    The modification time of database instance , formatted by RFC3339 time string.
    Name string
    The name of database instance.
    Port float64
    The port on which the database instance accepts connections.
    PrivateIp string
    The private IP address assigned to the database instance.
    StandbyZone string
    Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
    Status string
    Specifies the status of database instance , possible values are: Init, Fail, Starting, Running, Shutdown, Shutoff, Delete, Upgrading, Promoting, Recovering and Recover fail.
    SubnetId string
    The ID of subnet linked to the database instances.
    Tag string
    A tag assigned to database instance.
    VpcId string
    The ID of VPC linked to the database instances.
    availabilityZone String
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    backupBeginTime Double
    Specifies when the backup starts, measured in hour.
    backupBlackLists List<String>
    The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
    backupCount Double
    Specifies the number of backup saved per week.
    backupDate String
    Specifies whether the backup took place from Sunday to Saturday by displaying 7 digits. 0 stands for backup disabled and 1 stands for backup enabled. The rightmost digit specifies whether the backup took place on Sunday, and the digits from right to left specify whether the backup took place from Monday to Saturday, it's mandatory required to backup twice per week at least. such as: digits "1100000" stands for the backup took place on Saturday and Friday.
    chargeType String
    The charge type of db instance.
    createTime String
    The creation time of database instance , formatted by RFC3339 time string.
    engine String
    The type of database instance engine.
    engineVersion String
    The database instance engine version.
    expireTime String
    The expiration time of database instance , formatted by RFC3339 time string.
    id String
    The ID of database instance.
    instanceStorage Double
    Specifies the allocated storage size in gigabytes (GB).
    instanceType String
    Specifies the type of database instance.
    modifyTime String
    The modification time of database instance , formatted by RFC3339 time string.
    name String
    The name of database instance.
    port Double
    The port on which the database instance accepts connections.
    privateIp String
    The private IP address assigned to the database instance.
    standbyZone String
    Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
    status String
    Specifies the status of database instance , possible values are: Init, Fail, Starting, Running, Shutdown, Shutoff, Delete, Upgrading, Promoting, Recovering and Recover fail.
    subnetId String
    The ID of subnet linked to the database instances.
    tag String
    A tag assigned to database instance.
    vpcId String
    The ID of VPC linked to the database instances.
    availabilityZone string
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    backupBeginTime number
    Specifies when the backup starts, measured in hour.
    backupBlackLists string[]
    The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
    backupCount number
    Specifies the number of backup saved per week.
    backupDate string
    Specifies whether the backup took place from Sunday to Saturday by displaying 7 digits. 0 stands for backup disabled and 1 stands for backup enabled. The rightmost digit specifies whether the backup took place on Sunday, and the digits from right to left specify whether the backup took place from Monday to Saturday, it's mandatory required to backup twice per week at least. such as: digits "1100000" stands for the backup took place on Saturday and Friday.
    chargeType string
    The charge type of db instance.
    createTime string
    The creation time of database instance , formatted by RFC3339 time string.
    engine string
    The type of database instance engine.
    engineVersion string
    The database instance engine version.
    expireTime string
    The expiration time of database instance , formatted by RFC3339 time string.
    id string
    The ID of database instance.
    instanceStorage number
    Specifies the allocated storage size in gigabytes (GB).
    instanceType string
    Specifies the type of database instance.
    modifyTime string
    The modification time of database instance , formatted by RFC3339 time string.
    name string
    The name of database instance.
    port number
    The port on which the database instance accepts connections.
    privateIp string
    The private IP address assigned to the database instance.
    standbyZone string
    Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
    status string
    Specifies the status of database instance , possible values are: Init, Fail, Starting, Running, Shutdown, Shutoff, Delete, Upgrading, Promoting, Recovering and Recover fail.
    subnetId string
    The ID of subnet linked to the database instances.
    tag string
    A tag assigned to database instance.
    vpcId string
    The ID of VPC linked to the database instances.
    availability_zone str
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    backup_begin_time float
    Specifies when the backup starts, measured in hour.
    backup_black_lists Sequence[str]
    The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
    backup_count float
    Specifies the number of backup saved per week.
    backup_date str
    Specifies whether the backup took place from Sunday to Saturday by displaying 7 digits. 0 stands for backup disabled and 1 stands for backup enabled. The rightmost digit specifies whether the backup took place on Sunday, and the digits from right to left specify whether the backup took place from Monday to Saturday, it's mandatory required to backup twice per week at least. such as: digits "1100000" stands for the backup took place on Saturday and Friday.
    charge_type str
    The charge type of db instance.
    create_time str
    The creation time of database instance , formatted by RFC3339 time string.
    engine str
    The type of database instance engine.
    engine_version str
    The database instance engine version.
    expire_time str
    The expiration time of database instance , formatted by RFC3339 time string.
    id str
    The ID of database instance.
    instance_storage float
    Specifies the allocated storage size in gigabytes (GB).
    instance_type str
    Specifies the type of database instance.
    modify_time str
    The modification time of database instance , formatted by RFC3339 time string.
    name str
    The name of database instance.
    port float
    The port on which the database instance accepts connections.
    private_ip str
    The private IP address assigned to the database instance.
    standby_zone str
    Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
    status str
    Specifies the status of database instance , possible values are: Init, Fail, Starting, Running, Shutdown, Shutoff, Delete, Upgrading, Promoting, Recovering and Recover fail.
    subnet_id str
    The ID of subnet linked to the database instances.
    tag str
    A tag assigned to database instance.
    vpc_id str
    The ID of VPC linked to the database instances.
    availabilityZone String
    Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    backupBeginTime Number
    Specifies when the backup starts, measured in hour.
    backupBlackLists List<String>
    The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
    backupCount Number
    Specifies the number of backup saved per week.
    backupDate String
    Specifies whether the backup took place from Sunday to Saturday by displaying 7 digits. 0 stands for backup disabled and 1 stands for backup enabled. The rightmost digit specifies whether the backup took place on Sunday, and the digits from right to left specify whether the backup took place from Monday to Saturday, it's mandatory required to backup twice per week at least. such as: digits "1100000" stands for the backup took place on Saturday and Friday.
    chargeType String
    The charge type of db instance.
    createTime String
    The creation time of database instance , formatted by RFC3339 time string.
    engine String
    The type of database instance engine.
    engineVersion String
    The database instance engine version.
    expireTime String
    The expiration time of database instance , formatted by RFC3339 time string.
    id String
    The ID of database instance.
    instanceStorage Number
    Specifies the allocated storage size in gigabytes (GB).
    instanceType String
    Specifies the type of database instance.
    modifyTime String
    The modification time of database instance , formatted by RFC3339 time string.
    name String
    The name of database instance.
    port Number
    The port on which the database instance accepts connections.
    privateIp String
    The private IP address assigned to the database instance.
    standbyZone String
    Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
    status String
    Specifies the status of database instance , possible values are: Init, Fail, Starting, Running, Shutdown, Shutoff, Delete, Upgrading, Promoting, Recovering and Recover fail.
    subnetId String
    The ID of subnet linked to the database instances.
    tag String
    A tag assigned to database instance.
    vpcId String
    The ID of VPC linked to the database instances.

    Package Details

    Repository
    ucloud ucloud/terraform-provider-ucloud
    License
    Notes
    This Pulumi package is based on the ucloud Terraform Provider.
    ucloud logo
    ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud