BackupPolicy

class BackupPolicy : KotlinCustomResource

Provides an RDS instance backup policy resource and used to configure instance backup policy, see What is DB Backup Policy.

NOTE: Each DB instance has a backup policy and it will be set default values when destroying the resource. NOTE: Available since v1.5.0.

Example Usage

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.rds.Instance;
import com.pulumi.alicloud.rds.InstanceArgs;
import com.pulumi.alicloud.rds.BackupPolicy;
import com.pulumi.alicloud.rds.BackupPolicyArgs;
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 defaultZones = RdsFunctions.getZones(GetZonesArgs.builder()
.engine("MySQL")
.engineVersion("5.6")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(name)
.build());
var instance = new Instance("instance", InstanceArgs.builder()
.engine("MySQL")
.engineVersion("5.6")
.instanceType("rds.mysql.s1.small")
.instanceStorage("10")
.vswitchId(defaultSwitch.id())
.instanceName(name)
.build());
var policy = new BackupPolicy("policy", BackupPolicyArgs.builder()
.instanceId(instance.id())
.build());
}
}

Import

RDS backup policy can be imported using the id or instance id, e.g.

$ pulumi import alicloud:rds/backupPolicy:BackupPolicy example "rm-12345678"

Properties

Link copied to clipboard

Instance archive backup keep count. Valid when the enable_backup_log is true and instance is mysql local disk. When archive_backup_keep_policy is ByMonth Valid values: 1-31. When archive_backup_keep_policy is ByWeek Valid values: 1-7.

Link copied to clipboard

Instance archive backup keep policy. Valid when the enable_backup_log is true and instance is mysql local disk. Valid values are ByMonth, ByWeek, KeepAll.

Link copied to clipboard

Instance archive backup retention days. Valid when the enable_backup_log is true and instance is mysql local disk. Valid values: 30-1095, and archive_backup_retention_period must larger than backup_retention_period 730.

Link copied to clipboard
val backupInterval: Output<String>

The frequency at which you want to perform a snapshot backup on the instance. Valid values:

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

It has been deprecated from version 1.69.0, and use field 'preferred_backup_period' instead.

Link copied to clipboard

Instance backup retention days. Valid values: 7-730. Default to 7. But mysql local disk is unlimited.

Link copied to clipboard
val backupTime: Output<String>

It has been deprecated from version 1.69.0, and use field 'preferred_backup_time' instead.

Link copied to clipboard
val category: Output<String>

Whether to enable second level backup.Valid values are Flash, Standard, Note:It only takes effect when the BackupPolicyMode parameter is DataBackupPolicy.

Link copied to clipboard
val compressType: Output<String>

The compress type of instance policy. Valid values are 1, 4, 8.

Link copied to clipboard

Whether to backup instance log. Valid values are true, false, Default to true. Note: The 'Basic Edition' category Rds instance does not support setting log backup. What is Basic Edition.

Link copied to clipboard

Instance high space usage protection policy. Valid when the enable_backup_log is true. Valid values are Enable, Disable.

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

The Id of instance that can run database.

Link copied to clipboard

Instance log backup local retention hours. Valid when the enable_backup_log is true. Valid values: 0-7*24.

Link copied to clipboard

Instance log backup local retention space. Valid when the enable_backup_log is true. Valid values: 0-50.

Link copied to clipboard
val logBackup: Output<Boolean>

It has been deprecated from version 1.68.0, and use field 'enable_backup_log' instead.

Link copied to clipboard

Instance log backup frequency. Valid when the instance engine is SQLServer. Valid values are LogInterval.

Link copied to clipboard

Instance log backup retention days. Valid when the enable_backup_log is 1. Valid values: 7-730. Default to 7. It cannot be larger than backup_retention_period.

Link copied to clipboard
val logRetentionPeriod: Output<Int>

It has been deprecated from version 1.69.0, and use field 'log_backup_retention_period' instead.

Link copied to clipboard

DB Instance backup period. Please set at least two days to ensure backing up at least twice a week. Valid values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.

Link copied to clipboard

DB instance backup time, in the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. Default to "02:00Z-03:00Z". China time is 8 hours behind it.

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

The policy based on which ApsaraDB RDS retains archived backup files if the instance is released. Default value: None. Valid values:

Link copied to clipboard
val retentionPeriod: Output<Int>

It has been deprecated from version 1.69.0, and use field 'backup_retention_period' instead.

Link copied to clipboard
val urn: Output<String>