get Instances
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
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.rds.RdsFunctions;
import com.pulumi.alicloud.rds.inputs.GetInstancesArgs;
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 dbInstancesDs = RdsFunctions.getInstances(GetInstancesArgs.builder()
.nameRegex("data-\\d+")
.status("Running")
.tags(Map.ofEntries(
Map.entry("size", "tiny"),
Map.entry("type", "database")
))
.build());
ctx.export("firstDbInstanceId", dbInstancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()));
}
}
Return
A collection of values returned by getInstances.
Parameters
A collection of arguments for invoking getInstances.
Return
A collection of values returned by getInstances.
See also
Parameters
Standard
for standard access mode and Safe
for high security access mode.
Primary
for primary instance, Readonly
for read-only instance, Guard
for disaster recovery instance, and Temp
for temporary instance.
Default to false
. Set it to true
can output parameter template about resource attributes.
Database type. Options are MySQL
, SQLServer
, PostgreSQL
and PPAS
. If no value is specified, all types are returned.
A list of RDS instance IDs.
A regex string to filter results by instance name.
Status of the instance.
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\"}"
Used to retrieve instances belong to specified VPC.
Used to retrieve instances belong to specified vswitch
resources.
Return
A collection of values returned by getInstances.
See also
Parameters
Builder for com.pulumi.alicloud.rds.kotlin.inputs.GetInstancesPlainArgs.