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 backupMethod: Output<String>? = null, val backupPeriods: Output<List<String>>? = null, val backupPriority: Output<Int>? = 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 enableIncrementDataBackup: 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 logBackupLocalRetentionNumber: Output<Int>? = 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

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 _default = alicloud.rds.getZones({
engine: "MySQL",
engineVersion: "5.6",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "172.16.0.0/16",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vpcId: defaultNetwork.id,
cidrBlock: "172.16.0.0/24",
zoneId: _default.then(_default => _default.zones?.[0]?.id),
vswitchName: name,
});
const instance = new alicloud.rds.Instance("instance", {
engine: "MySQL",
engineVersion: "5.6",
instanceType: "rds.mysql.s1.small",
instanceStorage: 10,
vswitchId: defaultSwitch.id,
instanceName: name,
});
const policy = new alicloud.rds.BackupPolicy("policy", {instanceId: instance.id});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default = alicloud.rds.get_zones(engine="MySQL",
engine_version="5.6")
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("default",
vpc_id=default_network.id,
cidr_block="172.16.0.0/24",
zone_id=default.zones[0].id,
vswitch_name=name)
instance = alicloud.rds.Instance("instance",
engine="MySQL",
engine_version="5.6",
instance_type="rds.mysql.s1.small",
instance_storage=10,
vswitch_id=default_switch.id,
instance_name=name)
policy = alicloud.rds.BackupPolicy("policy", instance_id=instance.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 @default = AliCloud.Rds.GetZones.Invoke(new()
{
Engine = "MySQL",
EngineVersion = "5.6",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "172.16.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/24",
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
VswitchName = name,
});
var instance = new AliCloud.Rds.Instance("instance", new()
{
Engine = "MySQL",
EngineVersion = "5.6",
InstanceType = "rds.mysql.s1.small",
InstanceStorage = 10,
VswitchId = defaultSwitch.Id,
InstanceName = name,
});
var policy = new AliCloud.Rds.BackupPolicy("policy", new()
{
InstanceId = instance.Id,
});
});
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"
"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
}
_default, err := rds.GetZones(ctx, &rds.GetZonesArgs{
Engine: pulumi.StringRef("MySQL"),
EngineVersion: pulumi.StringRef("5.6"),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.16.0.0/16"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String("172.16.0.0/24"),
ZoneId: pulumi.String(_default.Zones[0].Id),
VswitchName: pulumi.String(name),
})
if err != nil {
return err
}
instance, err := rds.NewInstance(ctx, "instance", &rds.InstanceArgs{
Engine: pulumi.String("MySQL"),
EngineVersion: pulumi.String("5.6"),
InstanceType: pulumi.String("rds.mysql.s1.small"),
InstanceStorage: pulumi.Int(10),
VswitchId: defaultSwitch.ID(),
InstanceName: pulumi.String(name),
})
if err != nil {
return err
}
_, err = rds.NewBackupPolicy(ctx, "policy", &rds.BackupPolicyArgs{
InstanceId: instance.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.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 default = 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(default_.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());
}
}
configuration:
name:
type: string
default: tf-example
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 172.16.0.0/16
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vpcId: ${defaultNetwork.id}
cidrBlock: 172.16.0.0/24
zoneId: ${default.zones[0].id}
vswitchName: ${name}
instance:
type: alicloud:rds:Instance
properties:
engine: MySQL
engineVersion: '5.6'
instanceType: rds.mysql.s1.small
instanceStorage: '10'
vswitchId: ${defaultSwitch.id}
instanceName: ${name}
policy:
type: alicloud:rds:BackupPolicy
properties:
instanceId: ${instance.id}
variables:
default:
fn::invoke:
function: alicloud:rds:getZones
arguments:
engine: MySQL
engineVersion: '5.6'

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
constructor(archiveBackupKeepCount: Output<Int>? = null, archiveBackupKeepPolicy: Output<String>? = null, archiveBackupRetentionPeriod: Output<Int>? = null, backupInterval: Output<String>? = null, backupMethod: Output<String>? = null, backupPeriods: Output<List<String>>? = null, backupPriority: Output<Int>? = null, backupRetentionPeriod: Output<Int>? = null, backupTime: Output<String>? = null, category: Output<String>? = null, compressType: Output<String>? = null, enableBackupLog: Output<Boolean>? = null, enableIncrementDataBackup: 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, logBackupLocalRetentionNumber: Output<Int>? = 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)

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

The backup method of 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 backupPriority: Output<Int>? = null

Specifies whether the backup settings of a secondary instance are configured. Valid values:

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 enableIncrementDataBackup: Output<Boolean>? = null

Specifies whether to enable incremental backup. Valid values:

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

The number of binary log files that you want to retain on the instance. Default value: 60. Valid values: 6 to 100. ->NOTE: This parameter takes effect only when you set the BackupPolicyMode parameter to LogBackupPolicy. If the instance runs MySQL, you can set this parameter to -1. The value -1 specifies that an unlimited number of binary log files can be retained on the instance.

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.

Functions

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