RdsDbProxy

class RdsDbProxy : KotlinCustomResource

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

Properties

Link copied to clipboard

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

Link copied to clipboard

Connection instance string.

Link copied to clipboard

The port number that is associated with the proxy endpoint.

Link copied to clipboard

Remarks of agent terminal.

Link copied to clipboard

Proxy connection address ID.

Link copied to clipboard

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

Link copied to clipboard
val dbProxyFeatures: Output<String>

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>

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

Link copied to clipboard

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

Link copied to clipboard

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>

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 id: Output<String>
Link copied to clipboard
val instanceId: Output<String>

The Id of instance that can run database.

Link copied to clipboard

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

Link copied to clipboard
val netType: Output<String>

Network type of proxy connection address.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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>

The ID of the resource group.

Link copied to clipboard
val sslExpiredTime: Output<String>

The time when the certificate expires.

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

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>?

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

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>

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

Link copied to clipboard
val vswitchId: Output<String>

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