1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kvstore
  5. BackupPolicy
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

alicloud.kvstore.BackupPolicy

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

    DEPRECATED: This resource has been deprecated from version 1.104.0. Please use resource alicloud_kvstore_instance.

    Provides a backup policy for ApsaraDB Redis / Memcache instance resource.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "kvstorebackuppolicyvpc";
    const defaultZones = alicloud.kvstore.getZones({});
    const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {
        vpcName: name,
        cidrBlock: "172.16.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
        vpcId: defaultNetwork.id,
        cidrBlock: "172.16.0.0/24",
        zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.id),
        vswitchName: name,
    });
    const defaultInstance = new alicloud.kvstore.Instance("defaultInstance", {
        dbInstanceName: name,
        vswitchId: defaultSwitch.id,
        zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.id),
        instanceClass: "redis.master.large.default",
        instanceType: "Redis",
        engineVersion: "5.0",
        securityIps: ["10.23.12.24"],
        config: {
            appendonly: "yes",
            "lazyfree-lazy-eviction": "yes",
        },
        tags: {
            Created: "TF",
            For: "example",
        },
    });
    const defaultBackupPolicy = new alicloud.kvstore.BackupPolicy("defaultBackupPolicy", {
        instanceId: defaultInstance.id,
        backupPeriods: [
            "Tuesday",
            "Wednesday",
        ],
        backupTime: "10:00Z-11:00Z",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "kvstorebackuppolicyvpc"
    default_zones = alicloud.kvstore.get_zones()
    default_network = alicloud.vpc.Network("defaultNetwork",
        vpc_name=name,
        cidr_block="172.16.0.0/16")
    default_switch = alicloud.vpc.Switch("defaultSwitch",
        vpc_id=default_network.id,
        cidr_block="172.16.0.0/24",
        zone_id=default_zones.zones[0].id,
        vswitch_name=name)
    default_instance = alicloud.kvstore.Instance("defaultInstance",
        db_instance_name=name,
        vswitch_id=default_switch.id,
        zone_id=default_zones.zones[0].id,
        instance_class="redis.master.large.default",
        instance_type="Redis",
        engine_version="5.0",
        security_ips=["10.23.12.24"],
        config={
            "appendonly": "yes",
            "lazyfree-lazy-eviction": "yes",
        },
        tags={
            "Created": "TF",
            "For": "example",
        })
    default_backup_policy = alicloud.kvstore.BackupPolicy("defaultBackupPolicy",
        instance_id=default_instance.id,
        backup_periods=[
            "Tuesday",
            "Wednesday",
        ],
        backup_time="10:00Z-11:00Z")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kvstore"
    	"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 := "kvstorebackuppolicyvpc"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultZones, err := kvstore.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
    			VpcId:       defaultNetwork.ID(),
    			CidrBlock:   pulumi.String("172.16.0.0/24"),
    			ZoneId:      pulumi.String(defaultZones.Zones[0].Id),
    			VswitchName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		defaultInstance, err := kvstore.NewInstance(ctx, "defaultInstance", &kvstore.InstanceArgs{
    			DbInstanceName: pulumi.String(name),
    			VswitchId:      defaultSwitch.ID(),
    			ZoneId:         pulumi.String(defaultZones.Zones[0].Id),
    			InstanceClass:  pulumi.String("redis.master.large.default"),
    			InstanceType:   pulumi.String("Redis"),
    			EngineVersion:  pulumi.String("5.0"),
    			SecurityIps: pulumi.StringArray{
    				pulumi.String("10.23.12.24"),
    			},
    			Config: pulumi.Map{
    				"appendonly":             pulumi.Any("yes"),
    				"lazyfree-lazy-eviction": pulumi.Any("yes"),
    			},
    			Tags: pulumi.Map{
    				"Created": pulumi.Any("TF"),
    				"For":     pulumi.Any("example"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kvstore.NewBackupPolicy(ctx, "defaultBackupPolicy", &kvstore.BackupPolicyArgs{
    			InstanceId: defaultInstance.ID(),
    			BackupPeriods: pulumi.StringArray{
    				pulumi.String("Tuesday"),
    				pulumi.String("Wednesday"),
    			},
    			BackupTime: pulumi.String("10:00Z-11:00Z"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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") ?? "kvstorebackuppolicyvpc";
        var defaultZones = AliCloud.KVStore.GetZones.Invoke();
    
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new()
        {
            VpcName = name,
            CidrBlock = "172.16.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new()
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            VswitchName = name,
        });
    
        var defaultInstance = new AliCloud.KVStore.Instance("defaultInstance", new()
        {
            DbInstanceName = name,
            VswitchId = defaultSwitch.Id,
            ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            InstanceClass = "redis.master.large.default",
            InstanceType = "Redis",
            EngineVersion = "5.0",
            SecurityIps = new[]
            {
                "10.23.12.24",
            },
            Config = 
            {
                { "appendonly", "yes" },
                { "lazyfree-lazy-eviction", "yes" },
            },
            Tags = 
            {
                { "Created", "TF" },
                { "For", "example" },
            },
        });
    
        var defaultBackupPolicy = new AliCloud.KVStore.BackupPolicy("defaultBackupPolicy", new()
        {
            InstanceId = defaultInstance.Id,
            BackupPeriods = new[]
            {
                "Tuesday",
                "Wednesday",
            },
            BackupTime = "10:00Z-11:00Z",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.kvstore.KvstoreFunctions;
    import com.pulumi.alicloud.kvstore.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.kvstore.Instance;
    import com.pulumi.alicloud.kvstore.InstanceArgs;
    import com.pulumi.alicloud.kvstore.BackupPolicy;
    import com.pulumi.alicloud.kvstore.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("kvstorebackuppolicyvpc");
            final var defaultZones = KvstoreFunctions.getZones();
    
            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 defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
                .dbInstanceName(name)
                .vswitchId(defaultSwitch.id())
                .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .instanceClass("redis.master.large.default")
                .instanceType("Redis")
                .engineVersion("5.0")
                .securityIps("10.23.12.24")
                .config(Map.ofEntries(
                    Map.entry("appendonly", "yes"),
                    Map.entry("lazyfree-lazy-eviction", "yes")
                ))
                .tags(Map.ofEntries(
                    Map.entry("Created", "TF"),
                    Map.entry("For", "example")
                ))
                .build());
    
            var defaultBackupPolicy = new BackupPolicy("defaultBackupPolicy", BackupPolicyArgs.builder()        
                .instanceId(defaultInstance.id())
                .backupPeriods(            
                    "Tuesday",
                    "Wednesday")
                .backupTime("10:00Z-11:00Z")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: kvstorebackuppolicyvpc
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}
          cidrBlock: 172.16.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        properties:
          vpcId: ${defaultNetwork.id}
          cidrBlock: 172.16.0.0/24
          zoneId: ${defaultZones.zones[0].id}
          vswitchName: ${name}
      defaultInstance:
        type: alicloud:kvstore:Instance
        properties:
          dbInstanceName: ${name}
          vswitchId: ${defaultSwitch.id}
          zoneId: ${defaultZones.zones[0].id}
          instanceClass: redis.master.large.default
          instanceType: Redis
          engineVersion: '5.0'
          securityIps:
            - 10.23.12.24
          config:
            appendonly: yes
            lazyfree-lazy-eviction: yes
          tags:
            Created: TF
            For: example
      defaultBackupPolicy:
        type: alicloud:kvstore:BackupPolicy
        properties:
          instanceId: ${defaultInstance.id}
          backupPeriods:
            - Tuesday
            - Wednesday
          backupTime: 10:00Z-11:00Z
    variables:
      defaultZones:
        fn::invoke:
          Function: alicloud:kvstore:getZones
          Arguments: {}
    

    Create BackupPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BackupPolicy(name: string, args: BackupPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def BackupPolicy(resource_name: str,
                     args: BackupPolicyArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def BackupPolicy(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     instance_id: Optional[str] = None,
                     backup_periods: Optional[Sequence[str]] = None,
                     backup_time: Optional[str] = None)
    func NewBackupPolicy(ctx *Context, name string, args BackupPolicyArgs, opts ...ResourceOption) (*BackupPolicy, error)
    public BackupPolicy(string name, BackupPolicyArgs args, CustomResourceOptions? opts = null)
    public BackupPolicy(String name, BackupPolicyArgs args)
    public BackupPolicy(String name, BackupPolicyArgs args, CustomResourceOptions options)
    
    type: alicloud:kvstore:BackupPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args BackupPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BackupPolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BackupPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BackupPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BackupPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var examplebackupPolicyResourceResourceFromKvstorebackupPolicy = new AliCloud.KVStore.BackupPolicy("examplebackupPolicyResourceResourceFromKvstorebackupPolicy", new()
    {
        InstanceId = "string",
        BackupPeriods = new[]
        {
            "string",
        },
        BackupTime = "string",
    });
    
    example, err := kvstore.NewBackupPolicy(ctx, "examplebackupPolicyResourceResourceFromKvstorebackupPolicy", &kvstore.BackupPolicyArgs{
    	InstanceId: pulumi.String("string"),
    	BackupPeriods: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	BackupTime: pulumi.String("string"),
    })
    
    var examplebackupPolicyResourceResourceFromKvstorebackupPolicy = new BackupPolicy("examplebackupPolicyResourceResourceFromKvstorebackupPolicy", BackupPolicyArgs.builder()        
        .instanceId("string")
        .backupPeriods("string")
        .backupTime("string")
        .build());
    
    examplebackup_policy_resource_resource_from_kvstorebackup_policy = alicloud.kvstore.BackupPolicy("examplebackupPolicyResourceResourceFromKvstorebackupPolicy",
        instance_id="string",
        backup_periods=["string"],
        backup_time="string")
    
    const examplebackupPolicyResourceResourceFromKvstorebackupPolicy = new alicloud.kvstore.BackupPolicy("examplebackupPolicyResourceResourceFromKvstorebackupPolicy", {
        instanceId: "string",
        backupPeriods: ["string"],
        backupTime: "string",
    });
    
    type: alicloud:kvstore:BackupPolicy
    properties:
        backupPeriods:
            - string
        backupTime: string
        instanceId: string
    

    BackupPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The BackupPolicy resource accepts the following input properties:

    InstanceId string
    The id of ApsaraDB for Redis or Memcache intance.
    BackupPeriods List<string>
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    BackupTime string
    Backup time, in the format of HH:mmZ- HH:mm Z
    InstanceId string
    The id of ApsaraDB for Redis or Memcache intance.
    BackupPeriods []string
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    BackupTime string
    Backup time, in the format of HH:mmZ- HH:mm Z
    instanceId String
    The id of ApsaraDB for Redis or Memcache intance.
    backupPeriods List<String>
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backupTime String
    Backup time, in the format of HH:mmZ- HH:mm Z
    instanceId string
    The id of ApsaraDB for Redis or Memcache intance.
    backupPeriods string[]
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backupTime string
    Backup time, in the format of HH:mmZ- HH:mm Z
    instance_id str
    The id of ApsaraDB for Redis or Memcache intance.
    backup_periods Sequence[str]
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backup_time str
    Backup time, in the format of HH:mmZ- HH:mm Z
    instanceId String
    The id of ApsaraDB for Redis or Memcache intance.
    backupPeriods List<String>
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backupTime String
    Backup time, in the format of HH:mmZ- HH:mm Z

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BackupPolicy resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BackupPolicy Resource

    Get an existing BackupPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BackupPolicyState, opts?: CustomResourceOptions): BackupPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backup_periods: Optional[Sequence[str]] = None,
            backup_time: Optional[str] = None,
            instance_id: Optional[str] = None) -> BackupPolicy
    func GetBackupPolicy(ctx *Context, name string, id IDInput, state *BackupPolicyState, opts ...ResourceOption) (*BackupPolicy, error)
    public static BackupPolicy Get(string name, Input<string> id, BackupPolicyState? state, CustomResourceOptions? opts = null)
    public static BackupPolicy get(String name, Output<String> id, BackupPolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BackupPeriods List<string>
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    BackupTime string
    Backup time, in the format of HH:mmZ- HH:mm Z
    InstanceId string
    The id of ApsaraDB for Redis or Memcache intance.
    BackupPeriods []string
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    BackupTime string
    Backup time, in the format of HH:mmZ- HH:mm Z
    InstanceId string
    The id of ApsaraDB for Redis or Memcache intance.
    backupPeriods List<String>
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backupTime String
    Backup time, in the format of HH:mmZ- HH:mm Z
    instanceId String
    The id of ApsaraDB for Redis or Memcache intance.
    backupPeriods string[]
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backupTime string
    Backup time, in the format of HH:mmZ- HH:mm Z
    instanceId string
    The id of ApsaraDB for Redis or Memcache intance.
    backup_periods Sequence[str]
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backup_time str
    Backup time, in the format of HH:mmZ- HH:mm Z
    instance_id str
    The id of ApsaraDB for Redis or Memcache intance.
    backupPeriods List<String>
    Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
    backupTime String
    Backup time, in the format of HH:mmZ- HH:mm Z
    instanceId String
    The id of ApsaraDB for Redis or Memcache intance.

    Import

    KVStore backup policy can be imported using the id, e.g.

    $ pulumi import alicloud:kvstore/backupPolicy:BackupPolicy example r-abc12345678
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi