ReadOnlyInstanceArgs

data class ReadOnlyInstanceArgs(val acl: Output<String>? = null, val autoRenew: Output<Boolean>? = null, val autoRenewPeriod: Output<Int>? = null, val caType: Output<String>? = null, val clientCaCert: Output<String>? = null, val clientCaEnabled: Output<Int>? = null, val clientCertRevocationList: Output<String>? = null, val clientCrlEnabled: Output<Int>? = null, val dbInstanceIpArrayAttribute: Output<String>? = null, val dbInstanceIpArrayName: Output<String>? = null, val dbInstanceStorageType: Output<String>? = null, val deletionProtection: Output<Boolean>? = null, val direction: Output<String>? = null, val effectiveTime: Output<String>? = null, val engineVersion: Output<String>? = null, val forceRestart: Output<Boolean>? = null, val instanceChargeType: Output<String>? = null, val instanceName: Output<String>? = null, val instanceStorage: Output<Int>? = null, val instanceType: Output<String>? = null, val masterDbInstanceId: Output<String>? = null, val modifyMode: Output<String>? = null, val parameters: Output<List<ReadOnlyInstanceParameterArgs>>? = null, val period: Output<Int>? = null, val replicationAcl: Output<String>? = null, val resourceGroupId: Output<String>? = null, val securityIpType: Output<String>? = null, val securityIps: Output<List<String>>? = null, val serverCert: Output<String>? = null, val serverKey: Output<String>? = null, val sslEnabled: Output<Int>? = null, val switchTime: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val targetMinorVersion: Output<String>? = null, val upgradeDbInstanceKernelVersion: Output<Boolean>? = null, val upgradeTime: Output<String>? = null, val vswitchId: Output<String>? = null, val whitelistNetworkType: Output<String>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<ReadOnlyInstanceArgs>

Provides an RDS readonly instance resource, see What is DB Readonly Instance.

NOTE: Available since v1.52.1.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const example = alicloud.rds.getZones({
engine: "MySQL",
engineVersion: "5.6",
});
const exampleNetwork = new alicloud.vpc.Network("example", {
vpcName: name,
cidrBlock: "172.16.0.0/16",
});
const exampleSwitch = new alicloud.vpc.Switch("example", {
vpcId: exampleNetwork.id,
cidrBlock: "172.16.0.0/24",
zoneId: example.then(example => example.zones?.[0]?.id),
vswitchName: name,
});
const exampleSecurityGroup = new alicloud.ecs.SecurityGroup("example", {
name: name,
vpcId: exampleNetwork.id,
});
const exampleInstance = new alicloud.rds.Instance("example", {
engine: "MySQL",
engineVersion: "5.6",
instanceType: "rds.mysql.t1.small",
instanceStorage: 20,
instanceChargeType: "Postpaid",
instanceName: name,
vswitchId: exampleSwitch.id,
securityIps: [
"10.168.1.12",
"100.69.7.112",
],
});
const exampleReadOnlyInstance = new alicloud.rds.ReadOnlyInstance("example", {
zoneId: exampleInstance.zoneId,
masterDbInstanceId: exampleInstance.id,
engineVersion: exampleInstance.engineVersion,
instanceStorage: exampleInstance.instanceStorage,
instanceType: exampleInstance.instanceType,
instanceName: `${name}readonly`,
vswitchId: exampleSwitch.id,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
example = alicloud.rds.get_zones(engine="MySQL",
engine_version="5.6")
example_network = alicloud.vpc.Network("example",
vpc_name=name,
cidr_block="172.16.0.0/16")
example_switch = alicloud.vpc.Switch("example",
vpc_id=example_network.id,
cidr_block="172.16.0.0/24",
zone_id=example.zones[0].id,
vswitch_name=name)
example_security_group = alicloud.ecs.SecurityGroup("example",
name=name,
vpc_id=example_network.id)
example_instance = alicloud.rds.Instance("example",
engine="MySQL",
engine_version="5.6",
instance_type="rds.mysql.t1.small",
instance_storage=20,
instance_charge_type="Postpaid",
instance_name=name,
vswitch_id=example_switch.id,
security_ips=[
"10.168.1.12",
"100.69.7.112",
])
example_read_only_instance = alicloud.rds.ReadOnlyInstance("example",
zone_id=example_instance.zone_id,
master_db_instance_id=example_instance.id,
engine_version=example_instance.engine_version,
instance_storage=example_instance.instance_storage,
instance_type=example_instance.instance_type,
instance_name=f"{name}readonly",
vswitch_id=example_switch.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var example = AliCloud.Rds.GetZones.Invoke(new()
{
Engine = "MySQL",
EngineVersion = "5.6",
});
var exampleNetwork = new AliCloud.Vpc.Network("example", new()
{
VpcName = name,
CidrBlock = "172.16.0.0/16",
});
var exampleSwitch = new AliCloud.Vpc.Switch("example", new()
{
VpcId = exampleNetwork.Id,
CidrBlock = "172.16.0.0/24",
ZoneId = example.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
VswitchName = name,
});
var exampleSecurityGroup = new AliCloud.Ecs.SecurityGroup("example", new()
{
Name = name,
VpcId = exampleNetwork.Id,
});
var exampleInstance = new AliCloud.Rds.Instance("example", new()
{
Engine = "MySQL",
EngineVersion = "5.6",
InstanceType = "rds.mysql.t1.small",
InstanceStorage = 20,
InstanceChargeType = "Postpaid",
InstanceName = name,
VswitchId = exampleSwitch.Id,
SecurityIps = new[]
{
"10.168.1.12",
"100.69.7.112",
},
});
var exampleReadOnlyInstance = new AliCloud.Rds.ReadOnlyInstance("example", new()
{
ZoneId = exampleInstance.ZoneId,
MasterDbInstanceId = exampleInstance.Id,
EngineVersion = exampleInstance.EngineVersion,
InstanceStorage = exampleInstance.InstanceStorage,
InstanceType = exampleInstance.InstanceType,
InstanceName = $"{name}readonly",
VswitchId = exampleSwitch.Id,
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rds"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
example, err := rds.GetZones(ctx, &rds.GetZonesArgs{
Engine: pulumi.StringRef("MySQL"),
EngineVersion: pulumi.StringRef("5.6"),
}, nil)
if err != nil {
return err
}
exampleNetwork, err := vpc.NewNetwork(ctx, "example", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.16.0.0/16"),
})
if err != nil {
return err
}
exampleSwitch, err := vpc.NewSwitch(ctx, "example", &vpc.SwitchArgs{
VpcId: exampleNetwork.ID(),
CidrBlock: pulumi.String("172.16.0.0/24"),
ZoneId: pulumi.String(example.Zones[0].Id),
VswitchName: pulumi.String(name),
})
if err != nil {
return err
}
_, err = ecs.NewSecurityGroup(ctx, "example", &ecs.SecurityGroupArgs{
Name: pulumi.String(name),
VpcId: exampleNetwork.ID(),
})
if err != nil {
return err
}
exampleInstance, err := rds.NewInstance(ctx, "example", &rds.InstanceArgs{
Engine: pulumi.String("MySQL"),
EngineVersion: pulumi.String("5.6"),
InstanceType: pulumi.String("rds.mysql.t1.small"),
InstanceStorage: pulumi.Int(20),
InstanceChargeType: pulumi.String("Postpaid"),
InstanceName: pulumi.String(name),
VswitchId: exampleSwitch.ID(),
SecurityIps: pulumi.StringArray{
pulumi.String("10.168.1.12"),
pulumi.String("100.69.7.112"),
},
})
if err != nil {
return err
}
_, err = rds.NewReadOnlyInstance(ctx, "example", &rds.ReadOnlyInstanceArgs{
ZoneId: exampleInstance.ZoneId,
MasterDbInstanceId: exampleInstance.ID(),
EngineVersion: exampleInstance.EngineVersion,
InstanceStorage: exampleInstance.InstanceStorage,
InstanceType: exampleInstance.InstanceType,
InstanceName: pulumi.Sprintf("%vreadonly", name),
VswitchId: exampleSwitch.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.rds.RdsFunctions;
import com.pulumi.alicloud.rds.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.rds.Instance;
import com.pulumi.alicloud.rds.InstanceArgs;
import com.pulumi.alicloud.rds.ReadOnlyInstance;
import com.pulumi.alicloud.rds.ReadOnlyInstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf-example");
final var example = RdsFunctions.getZones(GetZonesArgs.builder()
.engine("MySQL")
.engineVersion("5.6")
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/16")
.build());
var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
.vpcId(exampleNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(name)
.build());
var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
.name(name)
.vpcId(exampleNetwork.id())
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.engine("MySQL")
.engineVersion("5.6")
.instanceType("rds.mysql.t1.small")
.instanceStorage("20")
.instanceChargeType("Postpaid")
.instanceName(name)
.vswitchId(exampleSwitch.id())
.securityIps(
"10.168.1.12",
"100.69.7.112")
.build());
var exampleReadOnlyInstance = new ReadOnlyInstance("exampleReadOnlyInstance", ReadOnlyInstanceArgs.builder()
.zoneId(exampleInstance.zoneId())
.masterDbInstanceId(exampleInstance.id())
.engineVersion(exampleInstance.engineVersion())
.instanceStorage(exampleInstance.instanceStorage())
.instanceType(exampleInstance.instanceType())
.instanceName(String.format("%sreadonly", name))
.vswitchId(exampleSwitch.id())
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
exampleNetwork:
type: alicloud:vpc:Network
name: example
properties:
vpcName: ${name}
cidrBlock: 172.16.0.0/16
exampleSwitch:
type: alicloud:vpc:Switch
name: example
properties:
vpcId: ${exampleNetwork.id}
cidrBlock: 172.16.0.0/24
zoneId: ${example.zones[0].id}
vswitchName: ${name}
exampleSecurityGroup:
type: alicloud:ecs:SecurityGroup
name: example
properties:
name: ${name}
vpcId: ${exampleNetwork.id}
exampleInstance:
type: alicloud:rds:Instance
name: example
properties:
engine: MySQL
engineVersion: '5.6'
instanceType: rds.mysql.t1.small
instanceStorage: '20'
instanceChargeType: Postpaid
instanceName: ${name}
vswitchId: ${exampleSwitch.id}
securityIps:
- 10.168.1.12
- 100.69.7.112
exampleReadOnlyInstance:
type: alicloud:rds:ReadOnlyInstance
name: example
properties:
zoneId: ${exampleInstance.zoneId}
masterDbInstanceId: ${exampleInstance.id}
engineVersion: ${exampleInstance.engineVersion}
instanceStorage: ${exampleInstance.instanceStorage}
instanceType: ${exampleInstance.instanceType}
instanceName: ${name}readonly
vswitchId: ${exampleSwitch.id}
variables:
example:
fn::invoke:
function: alicloud:rds:getZones
arguments:
engine: MySQL
engineVersion: '5.6'

Import

RDS readonly instance can be imported using the id, e.g.

$ pulumi import alicloud:rds/readOnlyInstance:ReadOnlyInstance example rm-abc12345678

Constructors

Link copied to clipboard
constructor(acl: Output<String>? = null, autoRenew: Output<Boolean>? = null, autoRenewPeriod: Output<Int>? = null, caType: Output<String>? = null, clientCaCert: Output<String>? = null, clientCaEnabled: Output<Int>? = null, clientCertRevocationList: Output<String>? = null, clientCrlEnabled: Output<Int>? = null, dbInstanceIpArrayAttribute: Output<String>? = null, dbInstanceIpArrayName: Output<String>? = null, dbInstanceStorageType: Output<String>? = null, deletionProtection: Output<Boolean>? = null, direction: Output<String>? = null, effectiveTime: Output<String>? = null, engineVersion: Output<String>? = null, forceRestart: Output<Boolean>? = null, instanceChargeType: Output<String>? = null, instanceName: Output<String>? = null, instanceStorage: Output<Int>? = null, instanceType: Output<String>? = null, masterDbInstanceId: Output<String>? = null, modifyMode: Output<String>? = null, parameters: Output<List<ReadOnlyInstanceParameterArgs>>? = null, period: Output<Int>? = null, replicationAcl: Output<String>? = null, resourceGroupId: Output<String>? = null, securityIpType: Output<String>? = null, securityIps: Output<List<String>>? = null, serverCert: Output<String>? = null, serverKey: Output<String>? = null, sslEnabled: Output<Int>? = null, switchTime: Output<String>? = null, tags: Output<Map<String, String>>? = null, targetMinorVersion: Output<String>? = null, upgradeDbInstanceKernelVersion: Output<Boolean>? = null, upgradeTime: Output<String>? = null, vswitchId: Output<String>? = null, whitelistNetworkType: Output<String>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard
val acl: Output<String>? = null

The method that is used to verify the identities of clients. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. In addition, this parameter is available only when the public key of the CA that issues client certificates is enabled. It is valid only when ssl_enabled = 1. Valid values:

Link copied to clipboard
val autoRenew: Output<Boolean>? = null

Whether to renewal a DB instance automatically or not. It is valid when instance_charge_type is PrePaid. Default to false.

Link copied to clipboard
val autoRenewPeriod: Output<Int>? = null

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.

Link copied to clipboard
val caType: Output<String>? = null

The type of the server certificate. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. If you set the SSLEnabled parameter to 1, the default value of this parameter is aliyun. It is valid only when ssl_enabled = 1. Value range:

Link copied to clipboard
val clientCaCert: Output<String>? = null

The public key of the CA that issues client certificates. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. If you set the ClientCAEbabled parameter to 1, you must also specify this parameter. It is valid only when ssl_enabled = 1.

Link copied to clipboard
val clientCaEnabled: Output<Int>? = null

Specifies whether to enable the public key of the CA that issues client certificates. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. It is valid only when ssl_enabled = 1. Valid values:

Link copied to clipboard
val clientCertRevocationList: Output<String>? = null

The CRL that contains revoked client certificates. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. If you set the ClientCrlEnabled parameter to 1, you must also specify this parameter. It is valid only when ssl_enabled = 1.

Link copied to clipboard
val clientCrlEnabled: Output<Int>? = null

Specifies whether to enable a certificate revocation list (CRL) that contains revoked client certificates. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. In addition, this parameter is available only when the public key of the CA that issues client certificates is enabled. It is valid only when ssl_enabled = 1. Valid values:

Link copied to clipboard
val dbInstanceIpArrayAttribute: Output<String>? = null

The attribute of the IP address whitelist. By default, this parameter is empty.

Link copied to clipboard
val dbInstanceIpArrayName: Output<String>? = null

The name of the IP address whitelist. Default value: Default.

Link copied to clipboard
val dbInstanceStorageType: Output<String>? = null

The storage type of the instance. Valid values:

Link copied to clipboard
val deletionProtection: Output<Boolean>? = null

The switch of delete protection. Valid values:

Link copied to clipboard
val direction: Output<String>? = null

The instance configuration type. Valid values:

Link copied to clipboard
val effectiveTime: Output<String>? = null

The method to change. Default value: Immediate. Valid values:

Link copied to clipboard
val engineVersion: Output<String>? = null

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

Link copied to clipboard
val forceRestart: Output<Boolean>? = null

Set it to true to make some parameter efficient when modifying them. Default to false.

Link copied to clipboard
val instanceChargeType: Output<String>? = null

Valid values are Prepaid, Postpaid, Default to Postpaid. The interval between the two conversion operations must be greater than 15 minutes. Only when this parameter is Postpaid, the instance can be released.

Link copied to clipboard
val instanceName: Output<String>? = null

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

Link copied to clipboard
val instanceStorage: Output<Int>? = null

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.

Link copied to clipboard
val instanceType: Output<String>? = null

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

Link copied to clipboard
val masterDbInstanceId: Output<String>? = null

ID of the master instance.

Link copied to clipboard
val modifyMode: Output<String>? = null

The method that is used to modify the IP address whitelist. Default value: Cover. Valid values:

Link copied to clipboard

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

Link copied to clipboard
val period: Output<Int>? = null

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.

Link copied to clipboard
val replicationAcl: Output<String>? = null

The method that is used to verify the replication permission. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. In addition, this parameter is available only when the public key of the CA that issues client certificates is enabled. It is valid only when ssl_enabled = 1. Valid values:

Link copied to clipboard
val resourceGroupId: Output<String>? = null

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

Link copied to clipboard
val securityIps: Output<List<String>>? = null

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).

Link copied to clipboard
val securityIpType: Output<String>? = null

The type of IP address in the IP address whitelist.

Link copied to clipboard
val serverCert: Output<String>? = null

The content of the server certificate. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. If you set the CAType parameter to custom, you must also specify this parameter. It is valid only when ssl_enabled = 1.

Link copied to clipboard
val serverKey: Output<String>? = null

The private key of the server certificate. This parameter is supported only when the instance runs PostgreSQL with standard or enhanced SSDs. If you set the CAType parameter to custom, you must also specify this parameter. It is valid only when ssl_enabled = 1.

Link copied to clipboard
val sslEnabled: Output<Int>? = null

Specifies whether to enable or disable SSL encryption. Valid values:

Link copied to clipboard
val switchTime: Output<String>? = null

The specific point in time when you want to perform the update. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. It is valid only when upgrade_db_instance_kernel_version = true. The time must be in UTC.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard
val targetMinorVersion: Output<String>? = null

The minor engine version to which you want to update the instance. If you do not specify this parameter, the instance is updated to the latest minor engine version. It is valid only when upgrade_db_instance_kernel_version = true. You must specify the minor engine version in one of the following formats:

Link copied to clipboard

Whether to upgrade a minor version of the kernel. Valid values:

Link copied to clipboard
val upgradeTime: Output<String>? = null

The method to update the minor engine version. Default value: Immediate. It is valid only when upgrade_db_instance_kernel_version = true. Valid values:

Link copied to clipboard
val vswitchId: Output<String>? = null

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

Link copied to clipboard
val whitelistNetworkType: Output<String>? = null

The network type of the IP address whitelist. Default value: MIX. Valid values:

Link copied to clipboard
val zoneId: Output<String>? = null

The Zone to launch the DB instance.

Functions

Link copied to clipboard
open override fun toJava(): ReadOnlyInstanceArgs