RdsCloneDbInstance

class RdsCloneDbInstance : KotlinCustomResource

Provides an RDS Clone DB Instance resource. For information about RDS Clone DB Instance and how to use it, see What is ApsaraDB for RDS.

NOTE: Available since v1.149.0+.

Example Usage

Create an RDS MySQL clone instance

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.rds.getZones({
engine: "PostgreSQL",
engineVersion: "13.0",
instanceChargeType: "PostPaid",
category: "HighAvailability",
dbInstanceStorageType: "cloud_essd",
});
const exampleGetInstanceClasses = example.then(example => alicloud.rds.getInstanceClasses({
zoneId: example.zones?.[0]?.id,
engine: "PostgreSQL",
engineVersion: "13.0",
category: "HighAvailability",
dbInstanceStorageType: "cloud_essd",
instanceChargeType: "PostPaid",
}));
const exampleNetwork = new alicloud.vpc.Network("example", {
vpcName: "terraform-example",
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: "terraform-example",
});
const exampleInstance = new alicloud.rds.Instance("example", {
engine: "PostgreSQL",
engineVersion: "13.0",
instanceType: exampleGetInstanceClasses.then(exampleGetInstanceClasses => exampleGetInstanceClasses.instanceClasses?.[0]?.instanceClass),
instanceStorage: exampleGetInstanceClasses.then(exampleGetInstanceClasses => exampleGetInstanceClasses.instanceClasses?.[0]?.storageRange?.min),
instanceChargeType: "Postpaid",
instanceName: "terraform-example",
vswitchId: exampleSwitch.id,
monitoringPeriod: 60,
});
const exampleRdsBackup = new alicloud.rds.RdsBackup("example", {
dbInstanceId: exampleInstance.id,
removeFromState: true,
});
const exampleRdsCloneDbInstance = new alicloud.rds.RdsCloneDbInstance("example", {
sourceDbInstanceId: exampleInstance.id,
dbInstanceStorageType: "cloud_essd",
paymentType: "PayAsYouGo",
backupId: exampleRdsBackup.backupId,
});
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.rds.get_zones(engine="PostgreSQL",
engine_version="13.0",
instance_charge_type="PostPaid",
category="HighAvailability",
db_instance_storage_type="cloud_essd")
example_get_instance_classes = alicloud.rds.get_instance_classes(zone_id=example.zones[0].id,
engine="PostgreSQL",
engine_version="13.0",
category="HighAvailability",
db_instance_storage_type="cloud_essd",
instance_charge_type="PostPaid")
example_network = alicloud.vpc.Network("example",
vpc_name="terraform-example",
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="terraform-example")
example_instance = alicloud.rds.Instance("example",
engine="PostgreSQL",
engine_version="13.0",
instance_type=example_get_instance_classes.instance_classes[0].instance_class,
instance_storage=example_get_instance_classes.instance_classes[0].storage_range.min,
instance_charge_type="Postpaid",
instance_name="terraform-example",
vswitch_id=example_switch.id,
monitoring_period=60)
example_rds_backup = alicloud.rds.RdsBackup("example",
db_instance_id=example_instance.id,
remove_from_state=True)
example_rds_clone_db_instance = alicloud.rds.RdsCloneDbInstance("example",
source_db_instance_id=example_instance.id,
db_instance_storage_type="cloud_essd",
payment_type="PayAsYouGo",
backup_id=example_rds_backup.backup_id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var example = AliCloud.Rds.GetZones.Invoke(new()
{
Engine = "PostgreSQL",
EngineVersion = "13.0",
InstanceChargeType = "PostPaid",
Category = "HighAvailability",
DbInstanceStorageType = "cloud_essd",
});
var exampleGetInstanceClasses = AliCloud.Rds.GetInstanceClasses.Invoke(new()
{
ZoneId = example.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
Engine = "PostgreSQL",
EngineVersion = "13.0",
Category = "HighAvailability",
DbInstanceStorageType = "cloud_essd",
InstanceChargeType = "PostPaid",
});
var exampleNetwork = new AliCloud.Vpc.Network("example", new()
{
VpcName = "terraform-example",
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 = "terraform-example",
});
var exampleInstance = new AliCloud.Rds.Instance("example", new()
{
Engine = "PostgreSQL",
EngineVersion = "13.0",
InstanceType = exampleGetInstanceClasses.Apply(getInstanceClassesResult => getInstanceClassesResult.InstanceClasses[0]?.InstanceClass),
InstanceStorage = exampleGetInstanceClasses.Apply(getInstanceClassesResult => getInstanceClassesResult.InstanceClasses[0]?.StorageRange?.Min),
InstanceChargeType = "Postpaid",
InstanceName = "terraform-example",
VswitchId = exampleSwitch.Id,
MonitoringPeriod = 60,
});
var exampleRdsBackup = new AliCloud.Rds.RdsBackup("example", new()
{
DbInstanceId = exampleInstance.Id,
RemoveFromState = true,
});
var exampleRdsCloneDbInstance = new AliCloud.Rds.RdsCloneDbInstance("example", new()
{
SourceDbInstanceId = exampleInstance.Id,
DbInstanceStorageType = "cloud_essd",
PaymentType = "PayAsYouGo",
BackupId = exampleRdsBackup.BackupId,
});
});
package main
import (
"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"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := rds.GetZones(ctx, &rds.GetZonesArgs{
Engine: pulumi.StringRef("PostgreSQL"),
EngineVersion: pulumi.StringRef("13.0"),
InstanceChargeType: pulumi.StringRef("PostPaid"),
Category: pulumi.StringRef("HighAvailability"),
DbInstanceStorageType: pulumi.StringRef("cloud_essd"),
}, nil)
if err != nil {
return err
}
exampleGetInstanceClasses, err := rds.GetInstanceClasses(ctx, &rds.GetInstanceClassesArgs{
ZoneId: pulumi.StringRef(example.Zones[0].Id),
Engine: pulumi.StringRef("PostgreSQL"),
EngineVersion: pulumi.StringRef("13.0"),
Category: pulumi.StringRef("HighAvailability"),
DbInstanceStorageType: pulumi.StringRef("cloud_essd"),
InstanceChargeType: pulumi.StringRef("PostPaid"),
}, nil)
if err != nil {
return err
}
exampleNetwork, err := vpc.NewNetwork(ctx, "example", &vpc.NetworkArgs{
VpcName: pulumi.String("terraform-example"),
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("terraform-example"),
})
if err != nil {
return err
}
exampleInstance, err := rds.NewInstance(ctx, "example", &rds.InstanceArgs{
Engine: pulumi.String("PostgreSQL"),
EngineVersion: pulumi.String("13.0"),
InstanceType: pulumi.String(exampleGetInstanceClasses.InstanceClasses[0].InstanceClass),
InstanceStorage: pulumi.String(exampleGetInstanceClasses.InstanceClasses[0].StorageRange.Min),
InstanceChargeType: pulumi.String("Postpaid"),
InstanceName: pulumi.String("terraform-example"),
VswitchId: exampleSwitch.ID(),
MonitoringPeriod: pulumi.Int(60),
})
if err != nil {
return err
}
exampleRdsBackup, err := rds.NewRdsBackup(ctx, "example", &rds.RdsBackupArgs{
DbInstanceId: exampleInstance.ID(),
RemoveFromState: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = rds.NewRdsCloneDbInstance(ctx, "example", &rds.RdsCloneDbInstanceArgs{
SourceDbInstanceId: exampleInstance.ID(),
DbInstanceStorageType: pulumi.String("cloud_essd"),
PaymentType: pulumi.String("PayAsYouGo"),
BackupId: exampleRdsBackup.BackupId,
})
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.rds.inputs.GetInstanceClassesArgs;
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.rds.Instance;
import com.pulumi.alicloud.rds.InstanceArgs;
import com.pulumi.alicloud.rds.RdsBackup;
import com.pulumi.alicloud.rds.RdsBackupArgs;
import com.pulumi.alicloud.rds.RdsCloneDbInstance;
import com.pulumi.alicloud.rds.RdsCloneDbInstanceArgs;
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 example = RdsFunctions.getZones(GetZonesArgs.builder()
.engine("PostgreSQL")
.engineVersion("13.0")
.instanceChargeType("PostPaid")
.category("HighAvailability")
.dbInstanceStorageType("cloud_essd")
.build());
final var exampleGetInstanceClasses = RdsFunctions.getInstanceClasses(GetInstanceClassesArgs.builder()
.zoneId(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.engine("PostgreSQL")
.engineVersion("13.0")
.category("HighAvailability")
.dbInstanceStorageType("cloud_essd")
.instanceChargeType("PostPaid")
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName("terraform-example")
.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("terraform-example")
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.engine("PostgreSQL")
.engineVersion("13.0")
.instanceType(exampleGetInstanceClasses.applyValue(getInstanceClassesResult -> getInstanceClassesResult.instanceClasses()[0].instanceClass()))
.instanceStorage(exampleGetInstanceClasses.applyValue(getInstanceClassesResult -> getInstanceClassesResult.instanceClasses()[0].storageRange().min()))
.instanceChargeType("Postpaid")
.instanceName("terraform-example")
.vswitchId(exampleSwitch.id())
.monitoringPeriod("60")
.build());
var exampleRdsBackup = new RdsBackup("exampleRdsBackup", RdsBackupArgs.builder()
.dbInstanceId(exampleInstance.id())
.removeFromState("true")
.build());
var exampleRdsCloneDbInstance = new RdsCloneDbInstance("exampleRdsCloneDbInstance", RdsCloneDbInstanceArgs.builder()
.sourceDbInstanceId(exampleInstance.id())
.dbInstanceStorageType("cloud_essd")
.paymentType("PayAsYouGo")
.backupId(exampleRdsBackup.backupId())
.build());
}
}
resources:
exampleNetwork:
type: alicloud:vpc:Network
name: example
properties:
vpcName: terraform-example
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: terraform-example
exampleInstance:
type: alicloud:rds:Instance
name: example
properties:
engine: PostgreSQL
engineVersion: '13.0'
instanceType: ${exampleGetInstanceClasses.instanceClasses[0].instanceClass}
instanceStorage: ${exampleGetInstanceClasses.instanceClasses[0].storageRange.min}
instanceChargeType: Postpaid
instanceName: terraform-example
vswitchId: ${exampleSwitch.id}
monitoringPeriod: '60'
exampleRdsBackup:
type: alicloud:rds:RdsBackup
name: example
properties:
dbInstanceId: ${exampleInstance.id}
removeFromState: 'true'
exampleRdsCloneDbInstance:
type: alicloud:rds:RdsCloneDbInstance
name: example
properties:
sourceDbInstanceId: ${exampleInstance.id}
dbInstanceStorageType: cloud_essd
paymentType: PayAsYouGo
backupId: ${exampleRdsBackup.backupId}
variables:
example:
fn::invoke:
function: alicloud:rds:getZones
arguments:
engine: PostgreSQL
engineVersion: '13.0'
instanceChargeType: PostPaid
category: HighAvailability
dbInstanceStorageType: cloud_essd
exampleGetInstanceClasses:
fn::invoke:
function: alicloud:rds:getInstanceClasses
arguments:
zoneId: ${example.zones[0].id}
engine: PostgreSQL
engineVersion: '13.0'
category: HighAvailability
dbInstanceStorageType: cloud_essd
instanceChargeType: PostPaid

Import

RDS Clone DB Instance can be imported using the id, e.g.

$ pulumi import alicloud:rds/rdsCloneDbInstance:RdsCloneDbInstance example <id>

Properties

Link copied to clipboard
val acl: Output<String>

This parameter is only supported by the RDS PostgreSQL cloud disk version. This parameter indicates the authentication method. It is allowed only when the public key of the client certificate authority is enabled. Valid values: cert and perfer and verify-ca and verify-full (supported by RDS PostgreSQL above 12).

Link copied to clipboard

How to upgrade the minor version of the instance. Valid values:

Link copied to clipboard
val backupId: Output<String>?

The ID of the data backup file you want to use. You can call the DescribeBackups operation to query the most recent data backup file list.

Link copied to clipboard
val backupType: Output<String>?

The type of backup that is used to restore the data of the original instance. Valid values:

Link copied to clipboard
val category: Output<String>

Instance series. Valid values:

Link copied to clipboard
val caType: Output<String>

This parameter is only supported by the RDS PostgreSQL cloud disk version. It indicates the certificate type. When the value of ssl_action is Open, the default value of this parameter is aliyun. Value range:

Link copied to clipboard
val certificate: Output<String>?

The file that contains the certificate used for TDE.

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

This parameter is only supported by the RDS PostgreSQL cloud disk version. It indicates the public key of the client certification authority. If the value of client_ca_enabled is 1, this parameter must be configured.

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

The client ca enabled.

Link copied to clipboard

This parameter is only supported by the RDS PostgreSQL cloud disk version, which indicates that the client revokes the certificate file. If the value of client_crl_enabled is 1, this parameter must be configured.

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

The client crl enabled.

Link copied to clipboard

The database connection address.

Link copied to clipboard

The connection string prefix.

Link copied to clipboard
val dbInstanceClass: Output<String>

The instance type of the new instance. For information, see Primary ApsaraDB RDS instance types.

Link copied to clipboard

The db instance description.

Link copied to clipboard
val dbInstanceStorage: Output<Int>

The storage capacity of the new instance. Unit: GB. The storage capacity increases in increments of 5 GB. For more information, see Primary ApsaraDB RDS instance types.

Link copied to clipboard

The type of storage media that is used for the new instance. Valid values:

Link copied to clipboard
val dbName: Output<String>?

The name of the database for which you want to enable TDE. Up to 50 names can be entered in a single request. If you specify multiple names, separate these names with commas (,).

Link copied to clipboard
val dbNames: Output<String>?

The names of the databases that you want to create on the new instance.

Link copied to clipboard

The ID of the dedicated cluster to which the new instance belongs. This parameter takes effect only when you create the new instance in a dedicated cluster.

Link copied to clipboard

The switch of delete protection. Valid values:

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

The direction. Valid values: Auto, Down, TempUpgrade, Up.

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

The effective time.

Link copied to clipboard
val encryptionKey: Output<String>?

The ID of the private key.

Link copied to clipboard
val engine: Output<String>

Database type. Value options: MySQL, SQLServer, PostgreSQL, MariaDB.

Link copied to clipboard
val engineVersion: Output<String>

Database version. Value:

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

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

Link copied to clipboard
val haMode: Output<String>

The high availability mode. Valid values:

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

The network type of the instance. Valid values:

Link copied to clipboard
val maintainTime: Output<String>

The maintainable time period of the instance. Format: HH:mm Z- HH:mm Z(UTC time).

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 password: Output<String>?

The password of the certificate.

Link copied to clipboard
val paymentType: Output<String>

The billing method of the new instance. Valid values: PayAsYouGo and Subscription and Serverless.

Link copied to clipboard
val period: Output<String>?

The period. Valid values: Month, Year.

Link copied to clipboard

The details of the AD domain.See pg_hba_conf below.

Link copied to clipboard
val port: Output<String>

The port.

Link copied to clipboard

The intranet IP address of the new instance must be within the specified vSwitch IP address range. By default, the system automatically allocates by using VPCId and VSwitchId.

Link copied to clipboard
val privateKey: Output<String>?

The file that contains the private key used for TDE.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The released keep policy.

Link copied to clipboard
val replicationAcl: Output<String>

This parameter is only supported by the RDS PostgreSQL cloud disk version, indicating the authentication method of the replication permission. It is only allowed when the public key of the client certificate authority is enabled. Valid values: cert and perfer and verify-ca and verify-full (supported by RDS PostgreSQL above 12).

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

The resource group id.

Link copied to clipboard
val restoreTable: Output<String>?

Specifies whether to restore only the databases and tables that you specify. The value 1 specifies to restore only the specified databases and tables. If you do not want to restore only the specified databases or tables, you can choose not to specify this parameter.

Link copied to clipboard
val restoreTime: Output<String>?

The point in time to which you want to restore the data of the original instance. The point in time must fall within the specified log backup retention period. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Link copied to clipboard
val roleArn: Output<String>?

The Alibaba Cloud Resource Name (ARN) of a RAM role. A RAM role is a virtual RAM identity that you can create within your Alibaba Cloud account.

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

The IP address whitelist of the instance. Separate multiple IP addresses with commas (,) and cannot be repeated. The following two formats are supported:

Link copied to clipboard
val serverCert: Output<String>

This parameter is only supported by the RDS PostgreSQL cloud disk version. It indicates the content of the server certificate. If the CAType value is custom, this parameter must be configured.

Link copied to clipboard
val serverKey: Output<String>

This parameter is only supported by the RDS PostgreSQL cloud disk version. It indicates the private key of the server certificate. If the value of CAType is custom, this parameter must be configured.

Link copied to clipboard

The settings of the serverless instance. This parameter is required when you create a serverless instance. This parameter takes effect only when you create an ApsaraDB RDS for MySQL instance.See serverless_config below.

Link copied to clipboard
val sourceBiz: Output<String>?

The source biz.

Link copied to clipboard

The source db instance id.

Link copied to clipboard
val sslEnabled: Output<Int>

Enable or disable SSL. Valid values: 0 and 1.

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

The time at which you want to apply the specification changes. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Link copied to clipboard
val syncMode: Output<String>
Link copied to clipboard
val tableMeta: Output<String>?

The information about the databases and tables that you want to restore. Format: [{"type":"db","name":"The original name of Database 1","newname":"The new name of Database 1","tables":{"type":"table","name":"The original name of Table 1 in Database 1","newname":"The new name of Table 1 in Database 1"},{"type":"table","name":"The original name of Table 2 in Database 1","newname":"The new name of Table 2 in Database 1"}},{"type":"db","name":"The original name of Database 2","newname":"The new name of Database 2","tables":{"type":"table","name":"The original name of Table 1 in Database 2","newname":"The new name of Table 1 in Database 2"},{"type":"table","name":"The original name of Table 2 in Database 2","newname":"The new name of Table 2 in Database 2"}}]

Link copied to clipboard

The availability check method of the instance. Valid values:

Link copied to clipboard
val tdeStatus: Output<String>?

Specifies whether to enable TDE. Valid values:

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val usedTime: Output<Int>?

The subscription period of the new instance. This parameter takes effect only when you select the subscription billing method for the new instance. Valid values:

Link copied to clipboard
val vpcId: Output<String>

The ID of the VPC to which the new instance belongs.

Link copied to clipboard
val vswitchId: Output<String>

The ID of the vSwitch associated with the specified VPC. If there are multiple vswitches, separate them with commas. The first vswitch is a primary zone switch and the query only returns that vswitch. If there are multiple vswitches, do not perform vswitch_id check.

Link copied to clipboard
val zoneId: Output<String>

The ID of the zone to which the new instance belongs. You can call the DescribeRegions operation to query the most recent region list.

Link copied to clipboard
val zoneIdSlaveA: Output<String>

The region ID of the secondary instance if you create a secondary instance. If you set this parameter to the same value as the ZoneId parameter, the instance is deployed in a single zone. Otherwise, the instance is deployed in multiple zones.

Link copied to clipboard
val zoneIdSlaveB: Output<String>

The region ID of the log instance if you create a log instance. If you set this parameter to the same value as the ZoneId parameter, the instance is deployed in a single zone. Otherwise, the instance is deployed in multiple zones.