All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::Snapshot

Last Updated:Nov 21, 2024

ALIYUN::ECS::Snapshot is used to create a snapshot for a disk.

Syntax

{
  "Type": "ALIYUN::ECS::Snapshot",
  "Properties": {
    "SnapshotName": String,
    "Timeout": Integer,
    "Description": String,
    "DiskId": String,
    "Tags": List,
    "InstantAccess": Boolean,
    "InstantAccessRetentionDays": Integer,
    "ResourceGroupId": String,
    "RetentionDays": Integer
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

DiskId

String

Yes

No

The ID of the disk for which you want to create the snapshot.

None.

SnapshotName

String

No

No

The snapshot name.

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 (-).

The name cannot start with auto because snapshots whose names start with auto are recognized as automatic snapshots.

Timeout

Integer

No

No

The timeout period for creating the snapshot.

If you specify this property, the timeout period for creating a stack is extended. If the snapshot is not created within the specified timeout period, the stack fails to be created. You can specify this property based on the disk size and the data size.

Valid values: 200 to 1440.

Default value: 200.

Unit: minutes.

Description

String

No

No

The description of the snapshot.

The description must be 2 to 256 characters in length, and cannot start with http:// or https://.

This property is empty by default.

ResourceGroupId

String

No

Yes

The ID of the resource group to which the snapshot belongs.

None.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

For more information, see Tags properties.

InstantAccess

Boolean

No

No

Specifies whether to enable the instant access feature for the snapshot.

Valid values:

  • true: enables the instant access feature for the snapshot. You can enable this feature only for Enterprise SSDs (ESSDs).

  • false (default): disables the instant access feature for the snapshot. The created snapshot is a standard snapshot.

InstantAccessRetentionDays

Integer

No

No

The retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

This property takes effect only when InstantAccess is set to true.

Valid values: 1 to 65535.

Unit: day.

RetentionDays

Integer

No

No

The retention period of the snapshot.

Unit: day. After the retention period ends, the snapshot is automatically released.

Valid values: 1 to 65536.

This property is empty by default, which indicates that the snapshot is not automatically released.

Tags syntax

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Return values

Fn::GetAtt

SnapshotId: the snapshot ID.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      DiskId:
        Type: String
        AssociationProperty: ALIYUN::ECS::Disk::DiskId
    Resources:
      Snapshot:
        Type: ALIYUN::ECS::Snapshot
        Properties:
          Timeout: 300
          DiskId:
            Ref: DiskId
    Outputs:
      SnapshotId:
        Description: The snapshot ID.
        Value:
          Fn::GetAtt:
            - Snapshot
            - SnapshotId
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "DiskId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::Disk::DiskId"
        }
      },
      "Resources": {
        "Snapshot": {
          "Type": "ALIYUN::ECS::Snapshot",
          "Properties": {
            "Timeout": 300,
            "DiskId": {
              "Ref": "DiskId"
            }
          }
        }
      },
      "Outputs": {
        "SnapshotId": {
          "Description": "The snapshot ID.",
          "Value": {
            "Fn::GetAtt": [
              "Snapshot",
              "SnapshotId"
            ]
          }
        }
      }
    }

For more examples, visit auto-snapshot-policy.yml. In the examples, the ALIYUN::ECS::DiskAttachment and ALIYUN::ECS::Snapshot resource types are used.