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 This property is required. string - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Backup
Begin Time This property is required. double - Specifies when the backup starts, measured in hour.
- Backup
Black Lists This property is required. List<string> - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- Backup
Count This property is required. double - Specifies the number of backup saved per week.
- Backup
Date This property is required. 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 This property is required. string - The charge type of db instance.
- Create
Time This property is required. string - The creation time of database instance , formatted by RFC3339 time string.
- Engine
This property is required. string - The type of database instance engine.
- Engine
Version This property is required. string - The database instance engine version.
- Expire
Time This property is required. string - The expiration time of database instance , formatted by RFC3339 time string.
- Id
This property is required. string - The ID of database instance.
- Instance
Storage This property is required. double - Specifies the allocated storage size in gigabytes (GB).
- Instance
Type This property is required. string - Specifies the type of database instance.
- Modify
Time This property is required. string - The modification time of database instance , formatted by RFC3339 time string.
- Name
This property is required. string - The name of database instance.
- Port
This property is required. double - The port on which the database instance accepts connections.
- Private
Ip This property is required. string - The private IP address assigned to the database instance.
- Standby
Zone This property is required. string - Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
- Status
This property is required. string - Specifies the status of database instance , possible values are:
Init
,Fail
,Starting
,Running
,Shutdown
,Shutoff
,Delete
,Upgrading
,Promoting
,Recovering
andRecover fail
. - Subnet
Id This property is required. string - The ID of subnet linked to the database instances.
- Tag
This property is required. string - A tag assigned to database instance.
- Vpc
Id This property is required. string - The ID of VPC linked to the database instances.
- Availability
Zone This property is required. string - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Backup
Begin Time This property is required. float64 - Specifies when the backup starts, measured in hour.
- Backup
Black Lists This property is required. []string - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- Backup
Count This property is required. float64 - Specifies the number of backup saved per week.
- Backup
Date This property is required. 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 This property is required. string - The charge type of db instance.
- Create
Time This property is required. string - The creation time of database instance , formatted by RFC3339 time string.
- Engine
This property is required. string - The type of database instance engine.
- Engine
Version This property is required. string - The database instance engine version.
- Expire
Time This property is required. string - The expiration time of database instance , formatted by RFC3339 time string.
- Id
This property is required. string - The ID of database instance.
- Instance
Storage This property is required. float64 - Specifies the allocated storage size in gigabytes (GB).
- Instance
Type This property is required. string - Specifies the type of database instance.
- Modify
Time This property is required. string - The modification time of database instance , formatted by RFC3339 time string.
- Name
This property is required. string - The name of database instance.
- Port
This property is required. float64 - The port on which the database instance accepts connections.
- Private
Ip This property is required. string - The private IP address assigned to the database instance.
- Standby
Zone This property is required. string - Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
- Status
This property is required. string - Specifies the status of database instance , possible values are:
Init
,Fail
,Starting
,Running
,Shutdown
,Shutoff
,Delete
,Upgrading
,Promoting
,Recovering
andRecover fail
. - Subnet
Id This property is required. string - The ID of subnet linked to the database instances.
- Tag
This property is required. string - A tag assigned to database instance.
- Vpc
Id This property is required. string - The ID of VPC linked to the database instances.
- availability
Zone This property is required. String - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup
Begin Time This property is required. Double - Specifies when the backup starts, measured in hour.
- backup
Black Lists This property is required. List<String> - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- backup
Count This property is required. Double - Specifies the number of backup saved per week.
- backup
Date This property is required. 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 This property is required. String - The charge type of db instance.
- create
Time This property is required. String - The creation time of database instance , formatted by RFC3339 time string.
- engine
This property is required. String - The type of database instance engine.
- engine
Version This property is required. String - The database instance engine version.
- expire
Time This property is required. String - The expiration time of database instance , formatted by RFC3339 time string.
- id
This property is required. String - The ID of database instance.
- instance
Storage This property is required. Double - Specifies the allocated storage size in gigabytes (GB).
- instance
Type This property is required. String - Specifies the type of database instance.
- modify
Time This property is required. String - The modification time of database instance , formatted by RFC3339 time string.
- name
This property is required. String - The name of database instance.
- port
This property is required. Double - The port on which the database instance accepts connections.
- private
Ip This property is required. String - The private IP address assigned to the database instance.
- standby
Zone This property is required. String - Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
- status
This property is required. String - Specifies the status of database instance , possible values are:
Init
,Fail
,Starting
,Running
,Shutdown
,Shutoff
,Delete
,Upgrading
,Promoting
,Recovering
andRecover fail
. - subnet
Id This property is required. String - The ID of subnet linked to the database instances.
- tag
This property is required. String - A tag assigned to database instance.
- vpc
Id This property is required. String - The ID of VPC linked to the database instances.
- availability
Zone This property is required. string - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup
Begin Time This property is required. number - Specifies when the backup starts, measured in hour.
- backup
Black Lists This property is required. string[] - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- backup
Count This property is required. number - Specifies the number of backup saved per week.
- backup
Date This property is required. 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 This property is required. string - The charge type of db instance.
- create
Time This property is required. string - The creation time of database instance , formatted by RFC3339 time string.
- engine
This property is required. string - The type of database instance engine.
- engine
Version This property is required. string - The database instance engine version.
- expire
Time This property is required. string - The expiration time of database instance , formatted by RFC3339 time string.
- id
This property is required. string - The ID of database instance.
- instance
Storage This property is required. number - Specifies the allocated storage size in gigabytes (GB).
- instance
Type This property is required. string - Specifies the type of database instance.
- modify
Time This property is required. string - The modification time of database instance , formatted by RFC3339 time string.
- name
This property is required. string - The name of database instance.
- port
This property is required. number - The port on which the database instance accepts connections.
- private
Ip This property is required. string - The private IP address assigned to the database instance.
- standby
Zone This property is required. string - Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
- status
This property is required. string - Specifies the status of database instance , possible values are:
Init
,Fail
,Starting
,Running
,Shutdown
,Shutoff
,Delete
,Upgrading
,Promoting
,Recovering
andRecover fail
. - subnet
Id This property is required. string - The ID of subnet linked to the database instances.
- tag
This property is required. string - A tag assigned to database instance.
- vpc
Id This property is required. string - The ID of VPC linked to the database instances.
- availability_
zone This property is required. str - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup_
begin_ time This property is required. float - Specifies when the backup starts, measured in hour.
- backup_
black_ lists This property is required. 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 This property is required. float - Specifies the number of backup saved per week.
- backup_
date This property is required. 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 This property is required. str - The charge type of db instance.
- create_
time This property is required. str - The creation time of database instance , formatted by RFC3339 time string.
- engine
This property is required. str - The type of database instance engine.
- engine_
version This property is required. str - The database instance engine version.
- expire_
time This property is required. str - The expiration time of database instance , formatted by RFC3339 time string.
- id
This property is required. str - The ID of database instance.
- instance_
storage This property is required. float - Specifies the allocated storage size in gigabytes (GB).
- instance_
type This property is required. str - Specifies the type of database instance.
- modify_
time This property is required. str - The modification time of database instance , formatted by RFC3339 time string.
- name
This property is required. str - The name of database instance.
- port
This property is required. float - The port on which the database instance accepts connections.
- private_
ip This property is required. str - The private IP address assigned to the database instance.
- standby_
zone This property is required. str - Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
- status
This property is required. str - Specifies the status of database instance , possible values are:
Init
,Fail
,Starting
,Running
,Shutdown
,Shutoff
,Delete
,Upgrading
,Promoting
,Recovering
andRecover fail
. - subnet_
id This property is required. str - The ID of subnet linked to the database instances.
- tag
This property is required. str - A tag assigned to database instance.
- vpc_
id This property is required. str - The ID of VPC linked to the database instances.
- availability
Zone This property is required. String - Availability zone where database instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- backup
Begin Time This property is required. Number - Specifies when the backup starts, measured in hour.
- backup
Black Lists This property is required. List<String> - The backup for database instance such as "test.%" or table such as "city.address" specified in the black lists are not supported.
- backup
Count This property is required. Number - Specifies the number of backup saved per week.
- backup
Date This property is required. 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 This property is required. String - The charge type of db instance.
- create
Time This property is required. String - The creation time of database instance , formatted by RFC3339 time string.
- engine
This property is required. String - The type of database instance engine.
- engine
Version This property is required. String - The database instance engine version.
- expire
Time This property is required. String - The expiration time of database instance , formatted by RFC3339 time string.
- id
This property is required. String - The ID of database instance.
- instance
Storage This property is required. Number - Specifies the allocated storage size in gigabytes (GB).
- instance
Type This property is required. String - Specifies the type of database instance.
- modify
Time This property is required. String - The modification time of database instance , formatted by RFC3339 time string.
- name
This property is required. String - The name of database instance.
- port
This property is required. Number - The port on which the database instance accepts connections.
- private
Ip This property is required. String - The private IP address assigned to the database instance.
- standby
Zone This property is required. String - Availability zone where the standby database instance is located for the high availability database instance with multiple zone.
- status
This property is required. String - Specifies the status of database instance , possible values are:
Init
,Fail
,Starting
,Running
,Shutdown
,Shutoff
,Delete
,Upgrading
,Promoting
,Recovering
andRecover fail
. - subnet
Id This property is required. String - The ID of subnet linked to the database instances.
- tag
This property is required. String - A tag assigned to database instance.
- vpc
Id This property is required. 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.