Class BackupPolicy
Provides an RDS instance backup policy resource and used to configure instance backup policy.
NOTE: Each DB instance has a backup policy and it will be set default values when destroying the resource.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var creation = config.Get("creation") ?? "Rds";
var name = config.Get("name") ?? "dbbackuppolicybasic";
var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
{
AvailableResourceCreation = creation,
}));
var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
{
CidrBlock = "172.16.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
CidrBlock = "172.16.0.0/24",
VpcId = defaultNetwork.Id,
});
var instance = new AliCloud.Rds.Instance("instance", new AliCloud.Rds.InstanceArgs
{
Engine = "MySQL",
EngineVersion = "5.6",
InstanceName = name,
InstanceStorage = "10",
InstanceType = "rds.mysql.s1.small",
VswitchId = defaultSwitch.Id,
});
var policy = new AliCloud.Rds.BackupPolicy("policy", new AliCloud.Rds.BackupPolicyArgs
{
InstanceId = instance.Id,
});
}
}
Inherited Members
Namespace: Pulumi.AliCloud.Rds
Assembly: Pulumi.AliCloud.dll
Syntax
public class BackupPolicy : CustomResource
Constructors
View SourceBackupPolicy(String, BackupPolicyArgs, CustomResourceOptions)
Create a BackupPolicy resource with the given unique name, arguments, and options.
Declaration
public BackupPolicy(string name, BackupPolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| BackupPolicyArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArchiveBackupKeepCount
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].
Declaration
public Output<int> ArchiveBackupKeepCount { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
ArchiveBackupKeepPolicy
Instance archive backup keep policy. Valid when the enable_backup_log is true and instance is mysql local disk. Valid values are ByMonth, Disable, KeepAll.
Declaration
public Output<string> ArchiveBackupKeepPolicy { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ArchiveBackupRetentionPeriod
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.
Declaration
public Output<int> ArchiveBackupRetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
BackupPeriods
It has been deprecated from version 1.69.0, and use field 'preferred_backup_period' instead.
Declaration
public Output<ImmutableArray<string>> BackupPeriods { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
BackupRetentionPeriod
Instance backup retention days. Valid values: [7-730]. Default to 7. But mysql local disk is unlimited.
Declaration
public Output<int?> BackupRetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
BackupTime
It has been deprecated from version 1.69.0, and use field 'preferred_backup_time' instead.
Declaration
public Output<string> BackupTime { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CompressType
The compress type of instance policy. Valid values are 1, 4, 8.
Declaration
public Output<string> CompressType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EnableBackupLog
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.
Declaration
public Output<bool> EnableBackupLog { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Boolean> |
HighSpaceUsageProtection
Instance high space usage protection policy. Valid when the enable_backup_log is true. Valid values are Enable, Disable.
Declaration
public Output<string> HighSpaceUsageProtection { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
InstanceId
The Id of instance that can run database.
Declaration
public Output<string> InstanceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LocalLogRetentionHours
Instance log backup local retention hours. Valid when the enable_backup_log is true. Valid values: [0-7*24].
Declaration
public Output<int> LocalLogRetentionHours { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
LocalLogRetentionSpace
Instance log backup local retention space. Valid when the enable_backup_log is true. Valid values: [5-50].
Declaration
public Output<int> LocalLogRetentionSpace { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
LogBackup
It has been deprecated from version 1.68.0, and use field 'enable_backup_log' instead.
Declaration
public Output<bool> LogBackup { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Boolean> |
LogBackupFrequency
Instance log backup frequency. Valid when the instance engine is SQLServer. Valid values are LogInterval.
Declaration
public Output<string> LogBackupFrequency { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LogBackupRetentionPeriod
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.
Declaration
public Output<int> LogBackupRetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
LogRetentionPeriod
It has been deprecated from version 1.69.0, and use field 'log_backup_retention_period' instead.
Declaration
public Output<int> LogRetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
PreferredBackupPeriods
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]. Default to ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
Declaration
public Output<ImmutableArray<string>> PreferredBackupPeriods { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
PreferredBackupTime
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.
Declaration
public Output<string> PreferredBackupTime { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RetentionPeriod
It has been deprecated from version 1.69.0, and use field 'backup_retention_period' instead.
Declaration
public Output<int> RetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Methods
View SourceGet(String, Input<String>, BackupPolicyState, CustomResourceOptions)
Get an existing BackupPolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static BackupPolicy Get(string name, Input<string> id, BackupPolicyState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| BackupPolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| BackupPolicy |