GetSnapshots

Use this data source to get a list of snapshot according to the specified filters in an Alibaba Cloud account.

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

NOTE: Available in 1.40.0+.

Argument Reference

The following arguments are supported:

  • instance_id - (Optional) The specified instance ID.
  • disk_id - (Optional) The specified disk ID.
  • encrypted - (Optional) Queries the encrypted snapshots. Optional values:
    • true: Encrypted snapshots.
    • false: No encryption attribute limit.

Default value: false. * ids - (Optional) A list of snapshot IDs. * name_regex - (Optional) A regex string to filter results by snapshot name. * status - (Optional) The specified snapshot status. * The snapshot status. Optional values: * progressing: The snapshots are being created. * accomplished: The snapshots are ready to use. * failed: The snapshot creation failed. * all: All status.

Default value: all.

  • type - (Optional) The snapshot category. Optional values:
    • auto: Auto snapshots.
    • user: Manual snapshots.
    • all: Auto and manual snapshots.

Default value: all. * source_disk_type - (Optional) The type of source disk: * System: The snapshots are created for system disks. * Data: The snapshots are created for data disks.

  • usage - (Optional) The usage of the snapshot:
    • image: The snapshots are used to create custom images.
    • disk: The snapshots are used to CreateDisk.
    • mage_disk: The snapshots are used to create custom images and data disks.
    • none: The snapshots are not used yet.
  • tags - (Optional) A map of tags assigned to snapshots.
  • output_file - (Optional) The name of output file that saves the filter results.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var snapshots = Output.Create(AliCloud.Ecs.GetSnapshots.InvokeAsync(new AliCloud.Ecs.GetSnapshotsArgs
        {
            Ids = 
            {
                "s-123456890abcdef",
            },
            NameRegex = "tf-testAcc-snapshot",
        }));
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

snapshots = alicloud.ecs.get_snapshots(ids=["s-123456890abcdef"],
    name_regex="tf-testAcc-snapshot")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const snapshots = pulumi.output(alicloud.ecs.getSnapshots({
    ids: ["s-123456890abcdef"],
    nameRegex: "tf-testAcc-snapshot",
}, { async: true }));

Using GetSnapshots

function getSnapshots(args: GetSnapshotsArgs, opts?: InvokeOptions): Promise<GetSnapshotsResult>
function  get_snapshots(disk_id=None, encrypted=None, ids=None, instance_id=None, name_regex=None, output_file=None, source_disk_type=None, status=None, tags=None, type=None, usage=None, opts=None)
func GetSnapshots(ctx *Context, args *GetSnapshotsArgs, opts ...InvokeOption) (*GetSnapshotsResult, error)
public static class GetSnapshots {
    public static Task<GetSnapshotsResult> InvokeAsync(GetSnapshotsArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

DiskId string
Encrypted bool

Whether the snapshot is encrypted or not.

Ids List<string>

A list of snapshot IDs.

InstanceId string
NameRegex string
OutputFile string
SourceDiskType string

Source disk attribute. Value range: * System * Data

Status string

The snapshot status. Value range: * progressing * accomplished * failed

Tags Dictionary<string, object>

A map of tags assigned to the snapshot.

Type string
Usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

DiskId string
Encrypted bool

Whether the snapshot is encrypted or not.

Ids []string

A list of snapshot IDs.

InstanceId string
NameRegex string
OutputFile string
SourceDiskType string

Source disk attribute. Value range: * System * Data

Status string

The snapshot status. Value range: * progressing * accomplished * failed

Tags map[string]interface{}

A map of tags assigned to the snapshot.

Type string
Usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

diskId string
encrypted boolean

Whether the snapshot is encrypted or not.

ids string[]

A list of snapshot IDs.

instanceId string
nameRegex string
outputFile string
sourceDiskType string

Source disk attribute. Value range: * System * Data

status string

The snapshot status. Value range: * progressing * accomplished * failed

tags {[key: string]: any}

A map of tags assigned to the snapshot.

type string
usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

disk_id str
encrypted bool

Whether the snapshot is encrypted or not.

ids List[str]

A list of snapshot IDs.

instance_id str
name_regex str
output_file str
source_disk_type str

Source disk attribute. Value range: * System * Data

status str

The snapshot status. Value range: * progressing * accomplished * failed

tags Dict[str, Any]

A map of tags assigned to the snapshot.

type str
usage str

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

GetSnapshots Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of snapshot IDs.

Names List<string>

A list of snapshots names.

Snapshots List<Pulumi.AliCloud.Ecs.Outputs.GetSnapshotsSnapshot>

A list of snapshots. Each element contains the following attributes:

DiskId string
Encrypted bool

Whether the snapshot is encrypted or not.

InstanceId string
NameRegex string
OutputFile string
SourceDiskType string

Source disk attribute. Value range: * System * Data

Status string

The snapshot status. Value range: * progressing * accomplished * failed

Tags Dictionary<string, object>

A map of tags assigned to the snapshot.

Type string
Usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of snapshot IDs.

Names []string

A list of snapshots names.

Snapshots []GetSnapshotsSnapshot

A list of snapshots. Each element contains the following attributes:

DiskId string
Encrypted bool

Whether the snapshot is encrypted or not.

InstanceId string
NameRegex string
OutputFile string
SourceDiskType string

Source disk attribute. Value range: * System * Data

Status string

The snapshot status. Value range: * progressing * accomplished * failed

Tags map[string]interface{}

A map of tags assigned to the snapshot.

Type string
Usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of snapshot IDs.

names string[]

A list of snapshots names.

snapshots GetSnapshotsSnapshot[]

A list of snapshots. Each element contains the following attributes:

diskId string
encrypted boolean

Whether the snapshot is encrypted or not.

instanceId string
nameRegex string
outputFile string
sourceDiskType string

Source disk attribute. Value range: * System * Data

status string

The snapshot status. Value range: * progressing * accomplished * failed

tags {[key: string]: any}

A map of tags assigned to the snapshot.

type string
usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

id str

The provider-assigned unique ID for this managed resource.

ids List[str]

A list of snapshot IDs.

names List[str]

A list of snapshots names.

snapshots List[GetSnapshotsSnapshot]

A list of snapshots. Each element contains the following attributes:

disk_id str
encrypted bool

Whether the snapshot is encrypted or not.

instance_id str
name_regex str
output_file str
source_disk_type str

Source disk attribute. Value range: * System * Data

status str

The snapshot status. Value range: * progressing * accomplished * failed

tags Dict[str, Any]

A map of tags assigned to the snapshot.

type str
usage str

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

Supporting Types

GetSnapshotsSnapshot

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

CreationTime string

Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.

Description string

Description of the snapshot.

Encrypted bool

Whether the snapshot is encrypted or not.

Id string

ID of the snapshot.

Name string

Name of the snapshot.

ProductCode string

Product code on the image market place.

Progress string

Progress of snapshot creation, presented in percentage.

RemainTime int

The remaining time of a snapshot creation task, in seconds.

RetentionDays int

The number of days that an automatic snapshot retains in the console for your instance.

SourceDiskId string

Source disk ID, which is retained after the source disk of the snapshot is deleted.

SourceDiskSize string

Size of the source disk, measured in GB.

SourceDiskType string

Source disk attribute. Value range: * System * Data

Status string

The snapshot status. Value range: * progressing * accomplished * failed

Usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

CreationTime string

Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.

Description string

Description of the snapshot.

Encrypted bool

Whether the snapshot is encrypted or not.

Id string

ID of the snapshot.

Name string

Name of the snapshot.

ProductCode string

Product code on the image market place.

Progress string

Progress of snapshot creation, presented in percentage.

RemainTime int

The remaining time of a snapshot creation task, in seconds.

RetentionDays int

The number of days that an automatic snapshot retains in the console for your instance.

SourceDiskId string

Source disk ID, which is retained after the source disk of the snapshot is deleted.

SourceDiskSize string

Size of the source disk, measured in GB.

SourceDiskType string

Source disk attribute. Value range: * System * Data

Status string

The snapshot status. Value range: * progressing * accomplished * failed

Usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

creationTime string

Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.

description string

Description of the snapshot.

encrypted boolean

Whether the snapshot is encrypted or not.

id string

ID of the snapshot.

name string

Name of the snapshot.

productCode string

Product code on the image market place.

progress string

Progress of snapshot creation, presented in percentage.

remainTime number

The remaining time of a snapshot creation task, in seconds.

retentionDays number

The number of days that an automatic snapshot retains in the console for your instance.

sourceDiskId string

Source disk ID, which is retained after the source disk of the snapshot is deleted.

sourceDiskSize string

Size of the source disk, measured in GB.

sourceDiskType string

Source disk attribute. Value range: * System * Data

status string

The snapshot status. Value range: * progressing * accomplished * failed

usage string

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

creation_time str

Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.

description str

Description of the snapshot.

encrypted bool

Whether the snapshot is encrypted or not.

id str

ID of the snapshot.

name str

Name of the snapshot.

product_code str

Product code on the image market place.

progress str

Progress of snapshot creation, presented in percentage.

remainTime float

The remaining time of a snapshot creation task, in seconds.

retention_days float

The number of days that an automatic snapshot retains in the console for your instance.

sourceDiskId str

Source disk ID, which is retained after the source disk of the snapshot is deleted.

sourceDiskSize str

Size of the source disk, measured in GB.

sourceDiskType str

Source disk attribute. Value range: * System * Data

status str

The snapshot status. Value range: * progressing * accomplished * failed

usage str

Whether the snapshots are used to create resources or not. Value range: * image * disk * image_disk * none

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.