RdsDbProxyArgs

data class RdsDbProxyArgs(val dbProxyConnectStringPort: Output<Int>? = null, val dbProxyConnectionPrefix: Output<String>? = null, val dbProxyEndpointReadWriteMode: Output<String>? = null, val dbProxyFeatures: Output<String>? = null, val dbProxyInstanceNum: Output<Int>? = null, val dbProxySslEnabled: Output<String>? = null, val effectiveSpecificTime: Output<String>? = null, val effectiveTime: Output<String>? = null, val instanceId: Output<String>? = null, val instanceNetworkType: Output<String>? = null, val readOnlyInstanceDistributionType: Output<String>? = null, val readOnlyInstanceMaxDelayTime: Output<Int>? = null, val readOnlyInstanceWeights: Output<List<RdsDbProxyReadOnlyInstanceWeightArgs>>? = null, val resourceGroupId: Output<String>? = null, val switchTime: Output<String>? = null, val upgradeTime: Output<String>? = null, val vpcId: Output<String>? = null, val vswitchId: Output<String>? = null) : ConvertibleToJava<RdsDbProxyArgs>

Information about RDS database exclusive agent and its usage, see What is RDS DB Proxy.

NOTE: Available since v1.193.0.

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.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.rds.Instance;
import com.pulumi.alicloud.rds.InstanceArgs;
import com.pulumi.alicloud.rds.ReadOnlyInstance;
import com.pulumi.alicloud.rds.ReadOnlyInstanceArgs;
import com.pulumi.alicloud.rds.RdsDbProxy;
import com.pulumi.alicloud.rds.RdsDbProxyArgs;
import com.pulumi.alicloud.rds.inputs.RdsDbProxyReadOnlyInstanceWeightArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("tf-example");
final var defaultZones = RdsFunctions.getZones(GetZonesArgs.builder()
.engine("MySQL")
.engineVersion("5.6")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(name)
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.engine("MySQL")
.engineVersion("5.7")
.instanceType("rds.mysql.c1.large")
.instanceStorage("20")
.instanceChargeType("Postpaid")
.instanceName(name)
.vswitchId(defaultSwitch.id())
.dbInstanceStorageType("local_ssd")
.build());
var defaultReadOnlyInstance = new ReadOnlyInstance("defaultReadOnlyInstance", ReadOnlyInstanceArgs.builder()
.zoneId(defaultInstance.zoneId())
.masterDbInstanceId(defaultInstance.id())
.engineVersion(defaultInstance.engineVersion())
.instanceStorage(defaultInstance.instanceStorage())
.instanceType(defaultInstance.instanceType())
.instanceName(String.format("%sreadonly", name))
.vswitchId(defaultSwitch.id())
.build());
var defaultRdsDbProxy = new RdsDbProxy("defaultRdsDbProxy", RdsDbProxyArgs.builder()
.instanceId(defaultInstance.id())
.instanceNetworkType("VPC")
.vpcId(defaultInstance.vpcId())
.vswitchId(defaultInstance.vswitchId())
.dbProxyInstanceNum(2)
.dbProxyConnectionPrefix("example")
.dbProxyConnectStringPort(3306)
.dbProxyEndpointReadWriteMode("ReadWrite")
.readOnlyInstanceMaxDelayTime(90)
.dbProxyFeatures("TransactionReadSqlRouteOptimizeStatus:1;ConnectionPersist:1;ReadWriteSpliting:1")
.readOnlyInstanceDistributionType("Custom")
.readOnlyInstanceWeights(
RdsDbProxyReadOnlyInstanceWeightArgs.builder()
.instanceId(defaultInstance.id())
.weight("100")
.build(),
RdsDbProxyReadOnlyInstanceWeightArgs.builder()
.instanceId(defaultReadOnlyInstance.id())
.weight("500")
.build())
.build());
}
}

Import

RDS database proxy feature can be imported using the id, e.g.

$ pulumi import alicloud:rds/rdsDbProxy:RdsDbProxy example abc12345678

Constructors

Link copied to clipboard
fun RdsDbProxyArgs(dbProxyConnectStringPort: Output<Int>? = null, dbProxyConnectionPrefix: Output<String>? = null, dbProxyEndpointReadWriteMode: Output<String>? = null, dbProxyFeatures: Output<String>? = null, dbProxyInstanceNum: Output<Int>? = null, dbProxySslEnabled: Output<String>? = null, effectiveSpecificTime: Output<String>? = null, effectiveTime: Output<String>? = null, instanceId: Output<String>? = null, instanceNetworkType: Output<String>? = null, readOnlyInstanceDistributionType: Output<String>? = null, readOnlyInstanceMaxDelayTime: Output<Int>? = null, readOnlyInstanceWeights: Output<List<RdsDbProxyReadOnlyInstanceWeightArgs>>? = null, resourceGroupId: Output<String>? = null, switchTime: Output<String>? = null, upgradeTime: Output<String>? = null, vpcId: Output<String>? = null, vswitchId: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): RdsDbProxyArgs

Properties

Link copied to clipboard
val dbProxyConnectionPrefix: Output<String>? = null

The new prefix of the proxy endpoint. Enter a prefix.

Link copied to clipboard
val dbProxyConnectStringPort: Output<Int>? = null

The port number that is associated with the proxy endpoint.

Link copied to clipboard

The read and write attributes of the proxy terminal. Valid values:

Link copied to clipboard
val dbProxyFeatures: Output<String>? = null

The features that you want to enable for the proxy endpoint. If you specify more than one feature, separate the features with semicolons (;). Format: Feature 1:Status;Feature 2:Status;.... Do not add a semicolon (;) at the end of the last value. Valid feature values:

Link copied to clipboard
val dbProxyInstanceNum: Output<Int>? = null

The number of proxy instances that are enabled. Valid values: 1 to 60.

Link copied to clipboard
val dbProxySslEnabled: Output<String>? = null

The SSL configuration setting that you want to apply on the instance. Valid values:

Link copied to clipboard
val effectiveSpecificTime: Output<String>? = null

The point in time at which you want to apply the new database proxy settings. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Link copied to clipboard
val effectiveTime: Output<String>? = null

When modifying the number of proxy instances,The time when you want to apply the new database proxy settings.Valid values:

Link copied to clipboard
val instanceId: Output<String>? = null

The Id of instance that can run database.

Link copied to clipboard
val instanceNetworkType: Output<String>? = null

The network type of the instance. Set the value to VPC.

Link copied to clipboard

The policy that is used to allocate read weights. Valid values:

Link copied to clipboard
val readOnlyInstanceMaxDelayTime: Output<Int>? = null

The maximum latency threshold that is allowed for read/write splitting. If the latency on a read-only instance exceeds the threshold that you specified, ApsaraDB RDS no longer forwards read requests to the read-only instance. If you do not specify this parameter, the default value of this parameter is retained. Unit: seconds. Valid values: 0 to 3600.

Link copied to clipboard

A list of the read weights of the instance and its read-only instances. It contains two sub-fields(instance_id and weight). Read weights increase in increments of 100, and the maximum read weight is 10000. See read_only_instance_weight below.

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the resource group.

Link copied to clipboard
val switchTime: Output<String>? = null

The point in time at which you want to upgrade the database proxy version of the instance. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Link copied to clipboard
val upgradeTime: Output<String>? = null

The time when you want to upgrade the database proxy version of the instance. Valid values:

Link copied to clipboard
val vpcId: Output<String>? = null

The ID of the virtual private cloud (VPC) to which the instance belongs.

Link copied to clipboard
val vswitchId: Output<String>? = null

The ID of the vSwitch that is associated with the specified VPC.