ReadWriteSplittingConnection

Provides an RDS read write splitting connection resource to allocate an Intranet connection string for RDS instance.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var creation = config.Get("creation") ?? "Rds";
        var name = config.Get("name") ?? "dbInstancevpc";
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = creation,
        }));
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/16",
        });
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
        {
            AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
            CidrBlock = "172.16.0.0/24",
            VpcId = defaultNetwork.Id,
        });
        var defaultInstance = new AliCloud.Rds.Instance("defaultInstance", new AliCloud.Rds.InstanceArgs
        {
            Engine = "MySQL",
            EngineVersion = "5.6",
            InstanceChargeType = "Postpaid",
            InstanceName = name,
            InstanceStorage = 20,
            InstanceType = "rds.mysql.t1.small",
            SecurityIps = 
            {
                "10.168.1.12",
                "100.69.7.112",
            },
            VswitchId = defaultSwitch.Id,
        });
        var defaultReadOnlyInstance = new AliCloud.Rds.ReadOnlyInstance("defaultReadOnlyInstance", new AliCloud.Rds.ReadOnlyInstanceArgs
        {
            EngineVersion = defaultInstance.EngineVersion,
            InstanceName = $"{name}ro",
            InstanceStorage = 30,
            InstanceType = defaultInstance.InstanceType,
            MasterDbInstanceId = defaultInstance.Id,
            VswitchId = defaultSwitch.Id,
            ZoneId = defaultInstance.ZoneId,
        });
        var defaultReadWriteSplittingConnection = new AliCloud.Rds.ReadWriteSplittingConnection("defaultReadWriteSplittingConnection", new AliCloud.Rds.ReadWriteSplittingConnectionArgs
        {
            ConnectionPrefix = "t-con-123",
            DistributionType = "Standard",
            InstanceId = defaultInstance.Id,
        });
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
creation = config.get("creation")
if creation is None:
    creation = "Rds"
name = config.get("name")
if name is None:
    name = "dbInstancevpc"
default_zones = alicloud.get_zones(available_resource_creation=creation)
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    availability_zone=default_zones.zones[0]["id"],
    cidr_block="172.16.0.0/24",
    vpc_id=default_network.id)
default_instance = alicloud.rds.Instance("defaultInstance",
    engine="MySQL",
    engine_version="5.6",
    instance_charge_type="Postpaid",
    instance_name=name,
    instance_storage="20",
    instance_type="rds.mysql.t1.small",
    security_ips=[
        "10.168.1.12",
        "100.69.7.112",
    ],
    vswitch_id=default_switch.id)
default_read_only_instance = alicloud.rds.ReadOnlyInstance("defaultReadOnlyInstance",
    engine_version=default_instance.engine_version,
    instance_name=f"{name}ro",
    instance_storage="30",
    instance_type=default_instance.instance_type,
    master_db_instance_id=default_instance.id,
    vswitch_id=default_switch.id,
    zone_id=default_instance.zone_id)
default_read_write_splitting_connection = alicloud.rds.ReadWriteSplittingConnection("defaultReadWriteSplittingConnection",
    connection_prefix="t-con-123",
    distribution_type="Standard",
    instance_id=default_instance.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const creation = config.get("creation") || "Rds";
const name = config.get("name") || "dbInstancevpc";

const defaultZones = pulumi.output(alicloud.getZones({
    availableResourceCreation: creation,
}, { async: true }));
const defaultNetwork = new alicloud.vpc.Network("default", {
    cidrBlock: "172.16.0.0/16",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
    availabilityZone: defaultZones.zones[0].id,
    cidrBlock: "172.16.0.0/24",
    vpcId: defaultNetwork.id,
});
const defaultInstance = new alicloud.rds.Instance("default", {
    engine: "MySQL",
    engineVersion: "5.6",
    instanceChargeType: "Postpaid",
    instanceName: name,
    instanceStorage: 20,
    instanceType: "rds.mysql.t1.small",
    securityIps: [
        "10.168.1.12",
        "100.69.7.112",
    ],
    vswitchId: defaultSwitch.id,
});
const defaultReadOnlyInstance = new alicloud.rds.ReadOnlyInstance("default", {
    engineVersion: defaultInstance.engineVersion,
    instanceName: `${name}ro`,
    instanceStorage: 30,
    instanceType: defaultInstance.instanceType,
    masterDbInstanceId: defaultInstance.id,
    vswitchId: defaultSwitch.id,
    zoneId: defaultInstance.zoneId,
});
const defaultReadWriteSplittingConnection = new alicloud.rds.ReadWriteSplittingConnection("default", {
    connectionPrefix: "t-con-123",
    distributionType: "Standard",
    instanceId: defaultInstance.id,
}, { dependsOn: [defaultReadOnlyInstance] });

Create a ReadWriteSplittingConnection Resource

def ReadWriteSplittingConnection(resource_name, opts=None, connection_prefix=None, distribution_type=None, instance_id=None, max_delay_time=None, port=None, weight=None, __props__=None);
name string
The unique name of the resource.
args ReadWriteSplittingConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ReadWriteSplittingConnectionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ReadWriteSplittingConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ReadWriteSplittingConnection Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The ReadWriteSplittingConnection resource accepts the following input properties:

DistributionType string

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

InstanceId string

The Id of instance that can run database.

ConnectionPrefix string

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

MaxDelayTime int

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

Port int

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

Weight Dictionary<string, object>

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

DistributionType string

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

InstanceId string

The Id of instance that can run database.

ConnectionPrefix string

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

MaxDelayTime int

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

Port int

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

Weight map[string]interface{}

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

distributionType string

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

instanceId string

The Id of instance that can run database.

connectionPrefix string

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

maxDelayTime number

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

port number

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

weight {[key: string]: any}

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

distribution_type str

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

instance_id str

The Id of instance that can run database.

connection_prefix str

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

max_delay_time float

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

port float

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

weight Dict[str, Any]

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

Outputs

All input properties are implicitly available as output properties. Additionally, the ReadWriteSplittingConnection resource produces the following output properties:

ConnectionString string

Connection instance string.

Id string
The provider-assigned unique ID for this managed resource.
ConnectionString string

Connection instance string.

Id string
The provider-assigned unique ID for this managed resource.
connectionString string

Connection instance string.

id string
The provider-assigned unique ID for this managed resource.
connection_string str

Connection instance string.

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing ReadWriteSplittingConnection Resource

Get an existing ReadWriteSplittingConnection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

static get(resource_name, id, opts=None, connection_prefix=None, connection_string=None, distribution_type=None, instance_id=None, max_delay_time=None, port=None, weight=None, __props__=None);
func GetReadWriteSplittingConnection(ctx *Context, name string, id IDInput, state *ReadWriteSplittingConnectionState, opts ...ResourceOption) (*ReadWriteSplittingConnection, error)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

ConnectionPrefix string

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

ConnectionString string

Connection instance string.

DistributionType string

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

InstanceId string

The Id of instance that can run database.

MaxDelayTime int

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

Port int

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

Weight Dictionary<string, object>

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

ConnectionPrefix string

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

ConnectionString string

Connection instance string.

DistributionType string

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

InstanceId string

The Id of instance that can run database.

MaxDelayTime int

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

Port int

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

Weight map[string]interface{}

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

connectionPrefix string

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

connectionString string

Connection instance string.

distributionType string

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

instanceId string

The Id of instance that can run database.

maxDelayTime number

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

port number

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

weight {[key: string]: any}

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

connection_prefix str

Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to + ‘rw’.

connection_string str

Connection instance string.

distribution_type str

Read weight distribution mode. Values are as follows: Standard indicates automatic weight distribution based on types, Custom indicates custom weight distribution.

instance_id str

The Id of instance that can run database.

max_delay_time float

Delay threshold, in seconds. The value range is 0 to 7200. Default to 30. Read requests are not routed to the read-only instances with a delay greater than the threshold.

port float

Intranet connection port. Valid value: [3001-3999]. Default to 3306.

weight Dict[str, Any]

Read weight distribution. Read weights increase at a step of 100 up to 10,000. Enter weights in the following format: {“Instanceid”:“Weight”,“Instanceid”:“Weight”}. This parameter must be set when distribution_type is set to Custom.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.