ReadOnlyInstance

Provides an RDS readonly instance resource.

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

}

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

Create a ReadOnlyInstance Resource

def ReadOnlyInstance(resource_name, opts=None, engine_version=None, instance_name=None, instance_storage=None, instance_type=None, master_db_instance_id=None, parameters=None, resource_group_id=None, tags=None, vswitch_id=None, zone_id=None, __props__=None);
name string
The unique name of the resource.
args ReadOnlyInstanceArgs
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 ReadOnlyInstanceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ReadOnlyInstanceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ReadOnlyInstance Resource Properties

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

Inputs

The ReadOnlyInstance resource accepts the following input properties:

EngineVersion string

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

InstanceStorage int

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

InstanceType string

DB Instance type. For details, see Instance type table.

MasterDbInstanceId string

ID of the master instance.

InstanceName string

The name of DB instance. It a string of 2 to 256 characters.

Parameters List<Pulumi.AliCloud.Rds.Inputs.ReadOnlyInstanceParameterArgs>

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

ResourceGroupId string

The ID of resource group which the DB read-only instance belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

VswitchId string

The virtual switch ID to launch DB instances in one VPC.

ZoneId string

The Zone to launch the DB instance.

EngineVersion string

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

InstanceStorage int

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

InstanceType string

DB Instance type. For details, see Instance type table.

MasterDbInstanceId string

ID of the master instance.

InstanceName string

The name of DB instance. It a string of 2 to 256 characters.

Parameters []ReadOnlyInstanceParameter

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

ResourceGroupId string

The ID of resource group which the DB read-only instance belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

VswitchId string

The virtual switch ID to launch DB instances in one VPC.

ZoneId string

The Zone to launch the DB instance.

engineVersion string

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

instanceStorage number

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

instanceType string

DB Instance type. For details, see Instance type table.

masterDbInstanceId string

ID of the master instance.

instanceName string

The name of DB instance. It a string of 2 to 256 characters.

parameters ReadOnlyInstanceParameter[]

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

resourceGroupId string

The ID of resource group which the DB read-only instance belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

vswitchId string

The virtual switch ID to launch DB instances in one VPC.

zoneId string

The Zone to launch the DB instance.

engine_version str

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

instance_storage float

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

instance_type str

DB Instance type. For details, see Instance type table.

master_db_instance_id str

ID of the master instance.

instance_name str

The name of DB instance. It a string of 2 to 256 characters.

parameters List[ReadOnlyInstanceParameter]

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

resource_group_id str

The ID of resource group which the DB read-only instance belongs.

tags Dict[str, Any]

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

vswitch_id str

The virtual switch ID to launch DB instances in one VPC.

zone_id str

The Zone to launch the DB instance.

Outputs

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

ConnectionString string

RDS database connection string.

Engine string

Database type.

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

RDS database connection port.

ConnectionString string

RDS database connection string.

Engine string

Database type.

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

RDS database connection port.

connectionString string

RDS database connection string.

engine string

Database type.

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

RDS database connection port.

connection_string str

RDS database connection string.

engine str

Database type.

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

RDS database connection port.

Look up an Existing ReadOnlyInstance Resource

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

public static get(name: string, id: Input<ID>, state?: ReadOnlyInstanceState, opts?: CustomResourceOptions): ReadOnlyInstance
static get(resource_name, id, opts=None, connection_string=None, engine=None, engine_version=None, instance_name=None, instance_storage=None, instance_type=None, master_db_instance_id=None, parameters=None, port=None, resource_group_id=None, tags=None, vswitch_id=None, zone_id=None, __props__=None);
func GetReadOnlyInstance(ctx *Context, name string, id IDInput, state *ReadOnlyInstanceState, opts ...ResourceOption) (*ReadOnlyInstance, error)
public static ReadOnlyInstance Get(string name, Input<string> id, ReadOnlyInstanceState? state, CustomResourceOptions? opts = null)
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:

ConnectionString string

RDS database connection string.

Engine string

Database type.

EngineVersion string

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

InstanceName string

The name of DB instance. It a string of 2 to 256 characters.

InstanceStorage int

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

InstanceType string

DB Instance type. For details, see Instance type table.

MasterDbInstanceId string

ID of the master instance.

Parameters List<Pulumi.AliCloud.Rds.Inputs.ReadOnlyInstanceParameterArgs>

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

Port string

RDS database connection port.

ResourceGroupId string

The ID of resource group which the DB read-only instance belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

VswitchId string

The virtual switch ID to launch DB instances in one VPC.

ZoneId string

The Zone to launch the DB instance.

ConnectionString string

RDS database connection string.

Engine string

Database type.

EngineVersion string

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

InstanceName string

The name of DB instance. It a string of 2 to 256 characters.

InstanceStorage int

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

InstanceType string

DB Instance type. For details, see Instance type table.

MasterDbInstanceId string

ID of the master instance.

Parameters []ReadOnlyInstanceParameter

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

Port string

RDS database connection port.

ResourceGroupId string

The ID of resource group which the DB read-only instance belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

VswitchId string

The virtual switch ID to launch DB instances in one VPC.

ZoneId string

The Zone to launch the DB instance.

connectionString string

RDS database connection string.

engine string

Database type.

engineVersion string

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

instanceName string

The name of DB instance. It a string of 2 to 256 characters.

instanceStorage number

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

instanceType string

DB Instance type. For details, see Instance type table.

masterDbInstanceId string

ID of the master instance.

parameters ReadOnlyInstanceParameter[]

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

port string

RDS database connection port.

resourceGroupId string

The ID of resource group which the DB read-only instance belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

vswitchId string

The virtual switch ID to launch DB instances in one VPC.

zoneId string

The Zone to launch the DB instance.

connection_string str

RDS database connection string.

engine str

Database type.

engine_version str

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

instance_name str

The name of DB instance. It a string of 2 to 256 characters.

instance_storage float

User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.

instance_type str

DB Instance type. For details, see Instance type table.

master_db_instance_id str

ID of the master instance.

parameters List[ReadOnlyInstanceParameter]

Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.

port str

RDS database connection port.

resource_group_id str

The ID of resource group which the DB read-only instance belongs.

tags Dict[str, Any]

A mapping of tags to assign to the resource. - Key: It can be up to 64 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It cannot be a null string. - Value: It can be up to 128 characters in length. It cannot begin with “aliyun”, “acs:“, “http://“, or “https://“. It can be a null string.

vswitch_id str

The virtual switch ID to launch DB instances in one VPC.

zone_id str

The Zone to launch the DB instance.

Supporting Types

ReadOnlyInstanceParameter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string
Value string
Name string
Value string
name string
value string
name str
value str

Package Details

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