Read Only Instance Args
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
Properties
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:
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.
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:
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
.
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:
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
.
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:
The attribute of the IP address whitelist. By default, this parameter is empty.
The name of the IP address whitelist. Default value: Default.
The storage type of the instance. Valid values:
The switch of delete protection. Valid values:
The method to change. Default value: Immediate. Valid values:
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion
.
Set it to true to make some parameter efficient when modifying them. Default to false.
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.
The name of DB instance. It a string of 2 to 256 characters.
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.
DB Instance type. For details, see Instance type table.
ID of the master instance.
The method that is used to modify the IP address whitelist. Default value: Cover. Valid values:
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.
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:
The ID of resource group which the DB read-only instance belongs.
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).
The type of IP address in the IP address whitelist.
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
.
Specifies whether to enable or disable SSL encryption. Valid values:
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.
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:
Whether to upgrade a minor version of the kernel. Valid values:
The method to update the minor engine version. Default value: Immediate. It is valid only when upgrade_db_instance_kernel_version = true
. Valid values:
The network type of the IP address whitelist. Default value: MIX. Valid values: