ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud
ucloud.getDbInstances
Explore with Pulumi AI
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:
- Availability
Zone 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
[]
. - Name
Regex string - A regex string to filter resulting database instances by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Availability
Zone 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
[]
. - Name
Regex string - A regex string to filter resulting database instances by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- availability
Zone 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
[]
. - name
Regex String - A regex string to filter resulting database instances by name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- availability
Zone 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
[]
. - name
Regex string - A regex string to filter resulting database instances by name.
- output
File 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
).
- availability
Zone 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
[]
. - name
Regex String - A regex string to filter resulting database instances by name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getDbInstances Result
The following output properties are available:
- Db
Instances List<GetDb Instances Db Instance> - It is a nested type which documented below.
- Id string
- The ID of database instance.
- Ids List<string>
- Total
Count double - Total number of database instances that satisfy the condition.
- Availability
Zone string - Availability zone where database instance is located.
- Name
Regex string - Output
File string
- Db
Instances []GetDb Instances Db Instance - It is a nested type which documented below.
- Id string
- The ID of database instance.
- Ids []string
- Total
Count float64 - Total number of database instances that satisfy the condition.
- Availability
Zone string - Availability zone where database instance is located.
- Name
Regex string - Output
File string
- db
Instances List<GetDb Instances Db Instance> - It is a nested type which documented below.
- id String
- The ID of database instance.
- ids List<String>
- total
Count Double - Total number of database instances that satisfy the condition.
- availability
Zone String - Availability zone where database instance is located.
- name
Regex String - output
File String
- db
Instances GetDb Instances Db Instance[] - It is a nested type which documented below.
- id string
- The ID of database instance.
- ids string[]
- total
Count number - Total number of database instances that satisfy the condition.
- availability
Zone string - Availability zone where database instance is located.
- name
Regex string - output
File string
- db_
instances Sequence[GetDb Instances Db Instance] - 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
- db
Instances List<Property Map> - It is a nested type which documented below.
- id String
- The ID of database instance.
- ids List<String>
- total
Count Number - Total number of database instances that satisfy the condition.
- availability
Zone String - Availability zone where database instance is located.
- name
Regex String - output
File String
Supporting Types
GetDbInstancesDbInstance
- Availability
Zone string - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Backup
Begin doubleTime - Specifies when the backup starts, measured in hour.
- Backup
Black List<string>Lists - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- Backup
Count double - Specifies the number of backup saved per week.
- Backup
Date 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.
- Charge
Type string - The charge type of db instance.
- Create
Time string - The creation time of database instance , formatted by RFC3339 time string.
- Engine string
- The type of database instance engine.
- Engine
Version string - The database instance engine version.
- Expire
Time string - The expiration time of database instance , formatted by RFC3339 time string.
- Id string
- The ID of database instance.
- Instance
Storage double - Specifies the allocated storage size in gigabytes (GB).
- Instance
Type string - Specifies the type of database instance.
- Modify
Time 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.
- Private
Ip string - The private IP address assigned to the database instance.
- Standby
Zone 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
andRecover fail
. - Subnet
Id string - The ID of subnet linked to the database instances.
- Tag string
- A tag assigned to database instance.
- Vpc
Id string - The ID of VPC linked to the database instances.
- Availability
Zone string - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Backup
Begin float64Time - Specifies when the backup starts, measured in hour.
- Backup
Black []stringLists - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- Backup
Count float64 - Specifies the number of backup saved per week.
- Backup
Date 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.
- Charge
Type string - The charge type of db instance.
- Create
Time string - The creation time of database instance , formatted by RFC3339 time string.
- Engine string
- The type of database instance engine.
- Engine
Version string - The database instance engine version.
- Expire
Time string - The expiration time of database instance , formatted by RFC3339 time string.
- Id string
- The ID of database instance.
- Instance
Storage float64 - Specifies the allocated storage size in gigabytes (GB).
- Instance
Type string - Specifies the type of database instance.
- Modify
Time 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.
- Private
Ip string - The private IP address assigned to the database instance.
- Standby
Zone 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
andRecover fail
. - Subnet
Id string - The ID of subnet linked to the database instances.
- Tag string
- A tag assigned to database instance.
- Vpc
Id string - The ID of VPC linked to the database instances.
- availability
Zone String - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup
Begin DoubleTime - Specifies when the backup starts, measured in hour.
- backup
Black List<String>Lists - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- backup
Count Double - Specifies the number of backup saved per week.
- backup
Date 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.
- charge
Type String - The charge type of db instance.
- create
Time String - The creation time of database instance , formatted by RFC3339 time string.
- engine String
- The type of database instance engine.
- engine
Version String - The database instance engine version.
- expire
Time String - The expiration time of database instance , formatted by RFC3339 time string.
- id String
- The ID of database instance.
- instance
Storage Double - Specifies the allocated storage size in gigabytes (GB).
- instance
Type String - Specifies the type of database instance.
- modify
Time 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.
- private
Ip String - The private IP address assigned to the database instance.
- standby
Zone 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
andRecover fail
. - subnet
Id String - The ID of subnet linked to the database instances.
- tag String
- A tag assigned to database instance.
- vpc
Id String - The ID of VPC linked to the database instances.
- availability
Zone string - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup
Begin numberTime - Specifies when the backup starts, measured in hour.
- backup
Black string[]Lists - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- backup
Count number - Specifies the number of backup saved per week.
- backup
Date 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.
- charge
Type string - The charge type of db instance.
- create
Time string - The creation time of database instance , formatted by RFC3339 time string.
- engine string
- The type of database instance engine.
- engine
Version string - The database instance engine version.
- expire
Time string - The expiration time of database instance , formatted by RFC3339 time string.
- id string
- The ID of database instance.
- instance
Storage number - Specifies the allocated storage size in gigabytes (GB).
- instance
Type string - Specifies the type of database instance.
- modify
Time 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.
- private
Ip string - The private IP address assigned to the database instance.
- standby
Zone 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
andRecover fail
. - subnet
Id string - The ID of subnet linked to the database instances.
- tag string
- A tag assigned to database instance.
- vpc
Id 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_ floattime - Specifies when the backup starts, measured in hour.
- backup_
black_ Sequence[str]lists - 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
andRecover 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.
- availability
Zone String - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup
Begin NumberTime - Specifies when the backup starts, measured in hour.
- backup
Black List<String>Lists - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- backup
Count Number - Specifies the number of backup saved per week.
- backup
Date 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.
- charge
Type String - The charge type of db instance.
- create
Time String - The creation time of database instance , formatted by RFC3339 time string.
- engine String
- The type of database instance engine.
- engine
Version String - The database instance engine version.
- expire
Time String - The expiration time of database instance , formatted by RFC3339 time string.
- id String
- The ID of database instance.
- instance
Storage Number - Specifies the allocated storage size in gigabytes (GB).
- instance
Type String - Specifies the type of database instance.
- modify
Time 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.
- private
Ip String - The private IP address assigned to the database instance.
- standby
Zone 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
andRecover fail
. - subnet
Id String - The ID of subnet linked to the database instances.
- tag String
- A tag assigned to database instance.
- vpc
Id 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.