alicloud.ecs.Snapshot
Explore with Pulumi AI
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.StringMap{
"version": pulumi.String("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, str]] = 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,
ResourceGroupId = "string",
RetentionDays = 0,
SnapshotName = "string",
Tags =
{
{ "string", "string" },
},
});
example, err := ecs.NewSnapshot(ctx, "alicloudSnapshotResource", &ecs.SnapshotArgs{
DiskId: pulumi.String("string"),
Category: pulumi.String("string"),
Description: pulumi.String("string"),
Force: pulumi.Bool(false),
ResourceGroupId: pulumi.String("string"),
RetentionDays: pulumi.Int(0),
SnapshotName: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var alicloudSnapshotResource = new Snapshot("alicloudSnapshotResource", SnapshotArgs.builder()
.diskId("string")
.category("string")
.description("string")
.force(false)
.resourceGroupId("string")
.retentionDays(0)
.snapshotName("string")
.tags(Map.of("string", "string"))
.build());
alicloud_snapshot_resource = alicloud.ecs.Snapshot("alicloudSnapshotResource",
disk_id="string",
category="string",
description="string",
force=False,
resource_group_id="string",
retention_days=0,
snapshot_name="string",
tags={
"string": "string",
})
const alicloudSnapshotResource = new alicloud.ecs.Snapshot("alicloudSnapshotResource", {
diskId: "string",
category: "string",
description: "string",
force: false,
resourceGroupId: "string",
retentionDays: 0,
snapshotName: "string",
tags: {
string: "string",
},
});
type: alicloud:ecs:Snapshot
properties:
category: string
description: string
diskId: string
force: false
resourceGroupId: string
retentionDays: 0
snapshotName: string
tags:
string: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Snapshot resource accepts the following input properties:
- Disk
Id 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
- Instant
Access bool - Instant
Access intRetention Days - 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.
- Resource
Group stringId - The ID of the resource group.
- Retention
Days int - Snapshot
Name string - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Disk
Id 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
- Instant
Access bool - Instant
Access intRetention Days - 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.
- Resource
Group stringId - The ID of the resource group.
- Retention
Days int - Snapshot
Name string - map[string]string
- A mapping of tags to assign to the resource.
- disk
Id 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
- instant
Access Boolean - instant
Access IntegerRetention Days - 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.
- resource
Group StringId - The ID of the resource group.
- retention
Days Integer - snapshot
Name String - Map<String,String>
- A mapping of tags to assign to the resource.
- disk
Id 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
- instant
Access boolean - instant
Access numberRetention Days - 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.
- resource
Group stringId - The ID of the resource group.
- retention
Days number - snapshot
Name string - {[key: string]: string}
- 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_ intretention_ days - 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.
- resource_
group_ strid - The ID of the resource group.
- retention_
days int - snapshot_
name str - Mapping[str, str]
- A mapping of tags to assign to the resource.
- disk
Id 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
- instant
Access Boolean - instant
Access NumberRetention Days - 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.
- resource
Group StringId - The ID of the resource group.
- retention
Days Number - snapshot
Name String - Map<String>
- 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:
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, str]] = 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.
- 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.
- Disk
Id string - The source disk ID.
- Force bool
- Instant
Access bool - Instant
Access intRetention Days - 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.
- Resource
Group stringId - The ID of the resource group.
- Retention
Days int - Snapshot
Name string - Status string
- Dictionary<string, string>
- 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.
- Disk
Id string - The source disk ID.
- Force bool
- Instant
Access bool - Instant
Access intRetention Days - 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.
- Resource
Group stringId - The ID of the resource group.
- Retention
Days int - Snapshot
Name string - Status string
- map[string]string
- 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.
- disk
Id String - The source disk ID.
- force Boolean
- instant
Access Boolean - instant
Access IntegerRetention Days - 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.
- resource
Group StringId - The ID of the resource group.
- retention
Days Integer - snapshot
Name String - status String
- Map<String,String>
- 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.
- disk
Id string - The source disk ID.
- force boolean
- instant
Access boolean - instant
Access numberRetention Days - 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.
- resource
Group stringId - The ID of the resource group.
- retention
Days number - snapshot
Name string - status string
- {[key: string]: string}
- 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_ intretention_ days - 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.
- resource_
group_ strid - The ID of the resource group.
- retention_
days int - snapshot_
name str - status str
- Mapping[str, str]
- 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.
- disk
Id String - The source disk ID.
- force Boolean
- instant
Access Boolean - instant
Access NumberRetention Days - 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.
- resource
Group StringId - The ID of the resource group.
- retention
Days Number - snapshot
Name String - status String
- Map<String>
- 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.