Show / Hide Table of Contents

Class 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,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
ReadWriteSplittingConnection
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.AliCloud.Rds
Assembly: Pulumi.AliCloud.dll
Syntax
public class ReadWriteSplittingConnection : CustomResource

Constructors

View Source

ReadWriteSplittingConnection(String, ReadWriteSplittingConnectionArgs, CustomResourceOptions)

Create a ReadWriteSplittingConnection resource with the given unique name, arguments, and options.

Declaration
public ReadWriteSplittingConnection(string name, ReadWriteSplittingConnectionArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ReadWriteSplittingConnectionArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

ConnectionPrefix

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 <instance_id> + 'rw'.

Declaration
public Output<string> ConnectionPrefix { get; }
Property Value
Type Description
Output<System.String>
View Source

ConnectionString

Connection instance string.

Declaration
public Output<string> ConnectionString { get; }
Property Value
Type Description
Output<System.String>
View Source

DistributionType

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

Declaration
public Output<string> DistributionType { get; }
Property Value
Type Description
Output<System.String>
View Source

InstanceId

The Id of instance that can run database.

Declaration
public Output<string> InstanceId { get; }
Property Value
Type Description
Output<System.String>
View Source

MaxDelayTime

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.

Declaration
public Output<int> MaxDelayTime { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Port

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

Declaration
public Output<int> Port { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Weight

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.

Declaration
public Output<ImmutableDictionary<string, object>> Weight { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>

Methods

View Source

Get(String, Input<String>, ReadWriteSplittingConnectionState, CustomResourceOptions)

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

Declaration
public static ReadWriteSplittingConnection Get(string name, Input<string> id, ReadWriteSplittingConnectionState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ReadWriteSplittingConnectionState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
ReadWriteSplittingConnection
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.