1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ecs
  5. Snapshot
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

alicloud.ecs.Snapshot

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

    DEPRECATED: This resource has been renamed to alicloud.ecs.EcsSnapshot from version 1.120.0.

    Provides an ECS snapshot resource.

    For information about snapshot and how to use it, see Snapshot.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const snapshot = new alicloud.ecs.Snapshot("snapshot", {
        diskId: instance_attachment.diskId,
        name: "test-snapshot",
        description: "this snapshot is created for testing",
        tags: {
            version: "1.2",
        },
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    snapshot = alicloud.ecs.Snapshot("snapshot",
        disk_id=instance_attachment["diskId"],
        name="test-snapshot",
        description="this snapshot is created for testing",
        tags={
            "version": "1.2",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.NewSnapshot(ctx, "snapshot", &ecs.SnapshotArgs{
    			DiskId:      pulumi.Any(instance_attachment.DiskId),
    			Name:        pulumi.String("test-snapshot"),
    			Description: pulumi.String("this snapshot is created for testing"),
    			Tags: pulumi.Map{
    				"version": pulumi.Any("1.2"),
    			},
    		})
    		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 snapshot = new AliCloud.Ecs.Snapshot("snapshot", new()
        {
            DiskId = instance_attachment.DiskId,
            Name = "test-snapshot",
            Description = "this snapshot is created for testing",
            Tags = 
            {
                { "version", "1.2" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.Snapshot;
    import com.pulumi.alicloud.ecs.SnapshotArgs;
    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) {
            var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
                .diskId(instance_attachment.diskId())
                .name("test-snapshot")
                .description("this snapshot is created for testing")
                .tags(Map.of("version", "1.2"))
                .build());
    
        }
    }
    
    resources:
      snapshot:
        type: alicloud:ecs:Snapshot
        properties:
          diskId: ${["instance-attachment"].diskId}
          name: test-snapshot
          description: this snapshot is created for testing
          tags:
            version: '1.2'
    

    Create Snapshot Resource

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

    Constructor syntax

    new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
    @overload
    def Snapshot(resource_name: str,
                 args: SnapshotArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Snapshot(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 disk_id: Optional[str] = None,
                 category: Optional[str] = None,
                 description: Optional[str] = None,
                 force: Optional[bool] = None,
                 instant_access: Optional[bool] = None,
                 instant_access_retention_days: Optional[int] = None,
                 name: Optional[str] = None,
                 resource_group_id: Optional[str] = None,
                 retention_days: Optional[int] = None,
                 snapshot_name: Optional[str] = None,
                 tags: Optional[Mapping[str, Any]] = None)
    func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
    public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
    public Snapshot(String name, SnapshotArgs args)
    public Snapshot(String name, SnapshotArgs args, CustomResourceOptions options)
    
    type: alicloud:ecs:Snapshot
    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 SnapshotArgs
    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 SnapshotArgs
    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 SnapshotArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var alicloudSnapshotResource = new AliCloud.Ecs.Snapshot("alicloudSnapshotResource", new()
    {
        DiskId = "string",
        Category = "string",
        Description = "string",
        Force = false,
        InstantAccess = false,
        InstantAccessRetentionDays = 0,
        ResourceGroupId = "string",
        RetentionDays = 0,
        SnapshotName = "string",
        Tags = 
        {
            { "string", "any" },
        },
    });
    
    example, err := ecs.NewSnapshot(ctx, "alicloudSnapshotResource", &ecs.SnapshotArgs{
    	DiskId:                     pulumi.String("string"),
    	Category:                   pulumi.String("string"),
    	Description:                pulumi.String("string"),
    	Force:                      pulumi.Bool(false),
    	InstantAccess:              pulumi.Bool(false),
    	InstantAccessRetentionDays: pulumi.Int(0),
    	ResourceGroupId:            pulumi.String("string"),
    	RetentionDays:              pulumi.Int(0),
    	SnapshotName:               pulumi.String("string"),
    	Tags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    })
    
    var alicloudSnapshotResource = new Snapshot("alicloudSnapshotResource", SnapshotArgs.builder()
        .diskId("string")
        .category("string")
        .description("string")
        .force(false)
        .instantAccess(false)
        .instantAccessRetentionDays(0)
        .resourceGroupId("string")
        .retentionDays(0)
        .snapshotName("string")
        .tags(Map.of("string", "any"))
        .build());
    
    alicloud_snapshot_resource = alicloud.ecs.Snapshot("alicloudSnapshotResource",
        disk_id="string",
        category="string",
        description="string",
        force=False,
        instant_access=False,
        instant_access_retention_days=0,
        resource_group_id="string",
        retention_days=0,
        snapshot_name="string",
        tags={
            "string": "any",
        })
    
    const alicloudSnapshotResource = new alicloud.ecs.Snapshot("alicloudSnapshotResource", {
        diskId: "string",
        category: "string",
        description: "string",
        force: false,
        instantAccess: false,
        instantAccessRetentionDays: 0,
        resourceGroupId: "string",
        retentionDays: 0,
        snapshotName: "string",
        tags: {
            string: "any",
        },
    });
    
    type: alicloud:ecs:Snapshot
    properties:
        category: string
        description: string
        diskId: string
        force: false
        instantAccess: false
        instantAccessRetentionDays: 0
        resourceGroupId: string
        retentionDays: 0
        snapshotName: string
        tags:
            string: any
    

    Snapshot 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 Snapshot resource accepts the following input properties:

    DiskId string
    The source disk ID.
    Category string
    Description string
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    Force bool
    InstantAccess bool
    InstantAccessRetentionDays int
    Name string
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    ResourceGroupId string
    The ID of the resource group.
    RetentionDays int
    SnapshotName string
    Tags Dictionary<string, object>
    A mapping of tags to assign to the resource.
    DiskId string
    The source disk ID.
    Category string
    Description string
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    Force bool
    InstantAccess bool
    InstantAccessRetentionDays int
    Name string
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    ResourceGroupId string
    The ID of the resource group.
    RetentionDays int
    SnapshotName string
    Tags map[string]interface{}
    A mapping of tags to assign to the resource.
    diskId String
    The source disk ID.
    category String
    description String
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    force Boolean
    instantAccess Boolean
    instantAccessRetentionDays Integer
    name String
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resourceGroupId String
    The ID of the resource group.
    retentionDays Integer
    snapshotName String
    tags Map<String,Object>
    A mapping of tags to assign to the resource.
    diskId string
    The source disk ID.
    category string
    description string
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    force boolean
    instantAccess boolean
    instantAccessRetentionDays number
    name string
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resourceGroupId string
    The ID of the resource group.
    retentionDays number
    snapshotName string
    tags {[key: string]: any}
    A mapping of tags to assign to the resource.
    disk_id str
    The source disk ID.
    category str
    description str
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    force bool
    instant_access bool
    instant_access_retention_days int
    name str
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resource_group_id str
    The ID of the resource group.
    retention_days int
    snapshot_name str
    tags Mapping[str, Any]
    A mapping of tags to assign to the resource.
    diskId String
    The source disk ID.
    category String
    description String
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    force Boolean
    instantAccess Boolean
    instantAccessRetentionDays Number
    name String
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resourceGroupId String
    The ID of the resource group.
    retentionDays Number
    snapshotName String
    tags Map<Any>
    A mapping of tags to assign to the resource.

    Outputs

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

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

    Look up Existing Snapshot Resource

    Get an existing Snapshot 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?: SnapshotState, opts?: CustomResourceOptions): Snapshot
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            category: Optional[str] = None,
            description: Optional[str] = None,
            disk_id: Optional[str] = None,
            force: Optional[bool] = None,
            instant_access: Optional[bool] = None,
            instant_access_retention_days: Optional[int] = None,
            name: Optional[str] = None,
            resource_group_id: Optional[str] = None,
            retention_days: Optional[int] = None,
            snapshot_name: Optional[str] = None,
            status: Optional[str] = None,
            tags: Optional[Mapping[str, Any]] = None) -> Snapshot
    func GetSnapshot(ctx *Context, name string, id IDInput, state *SnapshotState, opts ...ResourceOption) (*Snapshot, error)
    public static Snapshot Get(string name, Input<string> id, SnapshotState? state, CustomResourceOptions? opts = null)
    public static Snapshot get(String name, Output<String> id, SnapshotState 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:
    Category string
    Description string
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    DiskId string
    The source disk ID.
    Force bool
    InstantAccess bool
    InstantAccessRetentionDays int
    Name string
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    ResourceGroupId string
    The ID of the resource group.
    RetentionDays int
    SnapshotName string
    Status string
    Tags Dictionary<string, object>
    A mapping of tags to assign to the resource.
    Category string
    Description string
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    DiskId string
    The source disk ID.
    Force bool
    InstantAccess bool
    InstantAccessRetentionDays int
    Name string
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    ResourceGroupId string
    The ID of the resource group.
    RetentionDays int
    SnapshotName string
    Status string
    Tags map[string]interface{}
    A mapping of tags to assign to the resource.
    category String
    description String
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    diskId String
    The source disk ID.
    force Boolean
    instantAccess Boolean
    instantAccessRetentionDays Integer
    name String
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resourceGroupId String
    The ID of the resource group.
    retentionDays Integer
    snapshotName String
    status String
    tags Map<String,Object>
    A mapping of tags to assign to the resource.
    category string
    description string
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    diskId string
    The source disk ID.
    force boolean
    instantAccess boolean
    instantAccessRetentionDays number
    name string
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resourceGroupId string
    The ID of the resource group.
    retentionDays number
    snapshotName string
    status string
    tags {[key: string]: any}
    A mapping of tags to assign to the resource.
    category str
    description str
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    disk_id str
    The source disk ID.
    force bool
    instant_access bool
    instant_access_retention_days int
    name str
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resource_group_id str
    The ID of the resource group.
    retention_days int
    snapshot_name str
    status str
    tags Mapping[str, Any]
    A mapping of tags to assign to the resource.
    category String
    description String
    Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
    diskId String
    The source disk ID.
    force Boolean
    instantAccess Boolean
    instantAccessRetentionDays Number
    name String
    The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.

    Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.

    resourceGroupId String
    The ID of the resource group.
    retentionDays Number
    snapshotName String
    status String
    tags Map<Any>
    A mapping of tags to assign to the resource.

    Import

    Snapshot can be imported using the id, e.g.

    $ pulumi import alicloud:ecs/snapshot:Snapshot snapshot s-abc1234567890000
    

    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.59.0 published on Friday, Jul 12, 2024 by Pulumi