BackupPolicyArgs

data class BackupPolicyArgs(val archiveBackupKeepCount: Output<Int>? = null, val archiveBackupKeepPolicy: Output<String>? = null, val archiveBackupRetentionPeriod: Output<Int>? = null, val backupInterval: Output<String>? = null, val backupPeriods: Output<List<String>>? = null, val backupRetentionPeriod: Output<Int>? = null, val backupTime: Output<String>? = null, val category: Output<String>? = null, val compressType: Output<String>? = null, val enableBackupLog: Output<Boolean>? = null, val highSpaceUsageProtection: Output<String>? = null, val instanceId: Output<String>? = null, val localLogRetentionHours: Output<Int>? = null, val localLogRetentionSpace: Output<Int>? = null, val logBackup: Output<Boolean>? = null, val logBackupFrequency: Output<String>? = null, val logBackupRetentionPeriod: Output<Int>? = null, val logRetentionPeriod: Output<Int>? = null, val preferredBackupPeriods: Output<List<String>>? = null, val preferredBackupTime: Output<String>? = null, val releasedKeepPolicy: Output<String>? = null, val retentionPeriod: Output<Int>? = null) : ConvertibleToJava<BackupPolicyArgs>

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"

Constructors

Link copied to clipboard
fun BackupPolicyArgs(archiveBackupKeepCount: Output<Int>? = null, archiveBackupKeepPolicy: Output<String>? = null, archiveBackupRetentionPeriod: Output<Int>? = null, backupInterval: Output<String>? = null, backupPeriods: Output<List<String>>? = null, backupRetentionPeriod: Output<Int>? = null, backupTime: Output<String>? = null, category: Output<String>? = null, compressType: Output<String>? = null, enableBackupLog: Output<Boolean>? = null, highSpaceUsageProtection: Output<String>? = null, instanceId: Output<String>? = null, localLogRetentionHours: Output<Int>? = null, localLogRetentionSpace: Output<Int>? = null, logBackup: Output<Boolean>? = null, logBackupFrequency: Output<String>? = null, logBackupRetentionPeriod: Output<Int>? = null, logRetentionPeriod: Output<Int>? = null, preferredBackupPeriods: Output<List<String>>? = null, preferredBackupTime: Output<String>? = null, releasedKeepPolicy: Output<String>? = null, retentionPeriod: Output<Int>? = null)

Functions

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

Properties

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

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
val archiveBackupKeepPolicy: Output<String>? = null

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
val archiveBackupRetentionPeriod: Output<Int>? = null

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>? = null

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>>? = null

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

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

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>? = null

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

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

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>? = null

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

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

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
val highSpaceUsageProtection: Output<String>? = null

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

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

The Id of instance that can run database.

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

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

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

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>? = null

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

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

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

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

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>? = null

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

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

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
val preferredBackupTime: Output<String>? = null

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 releasedKeepPolicy: Output<String>? = null

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>? = null

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