Class Instance
Provides an RDS instance resource. A DB instance is an isolated database environment in the cloud. A DB instance can contain multiple user-created databases.
Example Usage
Create a RDS MySQL instance
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.Get("name") ?? "dbInstanceconfig";
var creation = config.Get("creation") ?? "Rds";
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 = "30",
InstanceType = "rds.mysql.s2.large",
MonitoringPeriod = "60",
VswitchId = defaultSwitch.Id,
});
}
}
Inherited Members
Namespace: Pulumi.AliCloud.Rds
Assembly: Pulumi.AliCloud.dll
Syntax
public class Instance : CustomResource
Constructors
View SourceInstance(String, InstanceArgs, CustomResourceOptions)
Create a Instance resource with the given unique name, arguments, and options.
Declaration
public Instance(string name, InstanceArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| InstanceArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAutoRenew
Whether to renewal a DB instance automatically or not. It is valid when instance_charge_type is PrePaid. Default to false.
Declaration
public Output<bool?> AutoRenew { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
AutoRenewPeriod
Auto-renewal period of an instance, in the unit of the month. It is valid when instance_charge_type is PrePaid. Valid value:[1~12], Default to 1.
Declaration
public Output<int?> AutoRenewPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
AutoUpgradeMinorVersion
The upgrade method to use. Valid values:
- Auto: Instances are automatically upgraded to a higher minor version.
- Manual: Instances are forcibly upgraded to a higher minor version when the current version is unpublished.
Declaration
public Output<string> AutoUpgradeMinorVersion { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ConnectionString
RDS database connection string.
Declaration
public Output<string> ConnectionString { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DbInstanceStorageType
The storage type of the instance. Valid values:
- local_ssd: specifies to use local SSDs. This value is recommended.
- cloud_ssd: specifies to use standard SSDs.
- cloud_essd: specifies to use enhanced SSDs (ESSDs).
- cloud_essd2: specifies to use enhanced SSDs (ESSDs).
- cloud_essd3: specifies to use enhanced SSDs (ESSDs).
Declaration
public Output<string> DbInstanceStorageType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Engine
Database type. Value options: MySQL, SQLServer, PostgreSQL, and PPAS.
Declaration
public Output<string> Engine { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EngineVersion
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
Declaration
public Output<string> EngineVersion { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ForceRestart
Set it to true to make some parameter efficient when modifying them. Default to false.
Declaration
public Output<bool?> ForceRestart { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
InstanceChargeType
Valid values are Prepaid, Postpaid, Default to Postpaid. Currently, the resource only supports PostPaid to PrePaid.
Declaration
public Output<string> InstanceChargeType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
InstanceName
The name of DB instance. It a string of 2 to 256 characters.
Declaration
public Output<string> InstanceName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
InstanceStorage
User-defined DB instance storage space. Value range:
- [5, 2000] for MySQL/PostgreSQL/PPAS HA dual node edition;
- [20,1000] for MySQL 5.7 basic single node edition;
- [10, 2000] for SQL Server 2008R2;
- [20,2000] for SQL Server 2012 basic single node edition
Increase progressively at a rate of 5 GB. For details, see Instance type table.
Note: There is extra 5 GB storage for SQL Server Instance and it is not in specified
instance_storage.
Declaration
public Output<int> InstanceStorage { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
InstanceType
DB Instance type. For details, see Instance type table.
Declaration
public Output<string> InstanceType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MaintainTime
Maintainable time period format of the instance: HH:MMZ-HH:MMZ (UTC time)
Declaration
public Output<string> MaintainTime { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MonitoringPeriod
The monitoring frequency in seconds. Valid values are 5, 60, 300. Defaults to 300.
Declaration
public Output<int> MonitoringPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Parameters
Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates .
Declaration
public Output<ImmutableArray<InstanceParameter>> Parameters { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<InstanceParameter>> |
Period
The duration that you will buy DB instance (in month). It is valid when instance_charge_type is PrePaid. Valid values: [1~9], 12, 24, 36. Default to 1.
Declaration
public Output<int?> Period { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
Port
RDS database connection port.
Declaration
public Output<string> Port { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SecurityGroupId
It has been deprecated from 1.69.0 and use security_group_ids instead.
Declaration
public Output<string> SecurityGroupId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SecurityGroupIds
, Available in 1.69.0+) The list IDs to join ECS Security Group. At most supports three security groups.
Declaration
public Output<ImmutableArray<string>> SecurityGroupIds { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
SecurityIpMode
Valid values are normal, safety, Default to normal. support safety switch to high security access mode
Declaration
public Output<string> SecurityIpMode { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SecurityIps
List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]).
Declaration
public Output<ImmutableArray<string>> SecurityIps { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
SqlCollectorConfigValue
The sql collector keep time of the instance. Valid values are 30, 180, 365, 1095, 1825, Default to 30.
Declaration
public Output<int?> SqlCollectorConfigValue { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
SqlCollectorStatus
The sql collector status of the instance. Valid values are Enabled, Disabled, Default to Disabled.
Declaration
public Output<string> SqlCollectorStatus { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
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.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
VswitchId
The virtual switch ID to launch DB instances in one VPC.
Declaration
public Output<string> VswitchId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ZoneId
The Zone to launch the DB instance. From version 1.8.1, it supports multiple zone.
If it is a multi-zone and vswitch_id is specified, the vswitch must in the one of them.
The multiple zone ID can be retrieved by setting multi to "true" in the data source alicloud..getZones.
Declaration
public Output<string> ZoneId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, InstanceState, CustomResourceOptions)
Get an existing Instance resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Instance Get(string name, Input<string> id, InstanceState 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. |
| InstanceState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Instance |