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
new ReadOnlyInstance(name: string, args: ReadOnlyInstanceArgs, opts?: CustomResourceOptions);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);func NewReadOnlyInstance(ctx *Context, name string, args ReadOnlyInstanceArgs, opts ...ResourceOption) (*ReadOnlyInstance, error)public ReadOnlyInstance(string name, ReadOnlyInstanceArgs args, CustomResourceOptions? opts = null)- 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:
- Engine
Version string Database version. Value options can refer to the latest docs CreateDBInstance
EngineVersion.- Instance
Storage 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.
- Instance
Type string DB Instance type. For details, see Instance type table.
- Master
Db stringInstance Id ID of the master instance.
- Instance
Name string The name of DB instance. It a string of 2 to 256 characters.
- Parameters
List<Pulumi.
Ali Cloud. Rds. Inputs. Read Only Instance Parameter Args> 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 stringId The ID of resource group which the DB read-only instance belongs.
- 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.
- Vswitch
Id string The virtual switch ID to launch DB instances in one VPC.
- Zone
Id string The Zone to launch the DB instance.
- Engine
Version string Database version. Value options can refer to the latest docs CreateDBInstance
EngineVersion.- Instance
Storage 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.
- Instance
Type string DB Instance type. For details, see Instance type table.
- Master
Db stringInstance Id ID of the master instance.
- Instance
Name string The name of DB instance. It a string of 2 to 256 characters.
- Parameters
[]Read
Only Instance Parameter 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 stringId The ID of resource group which the DB read-only instance belongs.
- 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.
- Vswitch
Id string The virtual switch ID to launch DB instances in one VPC.
- Zone
Id string The Zone to launch the DB instance.
- engine
Version string Database version. Value options can refer to the latest docs CreateDBInstance
EngineVersion.- instance
Storage 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.
- instance
Type string DB Instance type. For details, see Instance type table.
- master
Db stringInstance Id ID of the master instance.
- instance
Name string The name of DB instance. It a string of 2 to 256 characters.
- parameters
Read
Only Instance Parameter[] 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 stringId The ID of resource group which the DB read-only instance belongs.
- {[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.
- vswitch
Id string The virtual switch ID to launch DB instances in one VPC.
- zone
Id 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_ strinstance_ id ID of the master instance.
- instance_
name str The name of DB instance. It a string of 2 to 256 characters.
- parameters
List[Read
Only Instance Parameter] 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_ strid The ID of resource group which the DB read-only instance belongs.
- 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:
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): ReadOnlyInstancestatic 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:
- Connection
String string RDS database connection string.
- Engine string
Database type.
- Engine
Version string Database version. Value options can refer to the latest docs CreateDBInstance
EngineVersion.- Instance
Name string The name of DB instance. It a string of 2 to 256 characters.
- Instance
Storage 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.
- Instance
Type string DB Instance type. For details, see Instance type table.
- Master
Db stringInstance Id ID of the master instance.
- Parameters
List<Pulumi.
Ali Cloud. Rds. Inputs. Read Only Instance Parameter Args> 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.
- Resource
Group stringId The ID of resource group which the DB read-only instance belongs.
- 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.
- Vswitch
Id string The virtual switch ID to launch DB instances in one VPC.
- Zone
Id string The Zone to launch the DB instance.
- Connection
String string RDS database connection string.
- Engine string
Database type.
- Engine
Version string Database version. Value options can refer to the latest docs CreateDBInstance
EngineVersion.- Instance
Name string The name of DB instance. It a string of 2 to 256 characters.
- Instance
Storage 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.
- Instance
Type string DB Instance type. For details, see Instance type table.
- Master
Db stringInstance Id ID of the master instance.
- Parameters
[]Read
Only Instance Parameter 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.
- Resource
Group stringId The ID of resource group which the DB read-only instance belongs.
- 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.
- Vswitch
Id string The virtual switch ID to launch DB instances in one VPC.
- Zone
Id string The Zone to launch the DB instance.
- connection
String string RDS database connection string.
- engine string
Database type.
- engine
Version string Database version. Value options can refer to the latest docs CreateDBInstance
EngineVersion.- instance
Name string The name of DB instance. It a string of 2 to 256 characters.
- instance
Storage 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.
- instance
Type string DB Instance type. For details, see Instance type table.
- master
Db stringInstance Id ID of the master instance.
- parameters
Read
Only Instance Parameter[] 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.
- resource
Group stringId The ID of resource group which the DB read-only instance belongs.
- {[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.
- vswitch
Id string The virtual switch ID to launch DB instances in one VPC.
- zone
Id 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_ strinstance_ id ID of the master instance.
- parameters
List[Read
Only Instance Parameter] 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_ strid The ID of resource group which the DB read-only instance belongs.
- 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
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.