1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ecs
  5. getEcsSnapshots
Alibaba Cloud v3.83.0 published on Monday, Jul 21, 2025 by Pulumi

alicloud.ecs.getEcsSnapshots

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.83.0 published on Monday, Jul 21, 2025 by Pulumi

    This data source provides the Ecs Snapshots of the current Alibaba Cloud user.

    NOTE: Available since v1.120.0.

    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") || "terraform-example";
    const _default = alicloud.resourcemanager.getResourceGroups({
        status: "OK",
    });
    const defaultGetZones = alicloud.getZones({
        availableDiskCategory: "cloud_essd",
        availableResourceCreation: "VSwitch",
    });
    const defaultGetImages = alicloud.ecs.getImages({
        mostRecent: true,
        owners: "system",
    });
    const defaultGetInstanceTypes = Promise.all([defaultGetZones, defaultGetImages]).then(([defaultGetZones, defaultGetImages]) => alicloud.ecs.getInstanceTypes({
        availabilityZone: defaultGetZones.zones?.[0]?.id,
        imageId: defaultGetImages.images?.[0]?.id,
        systemDiskCategory: "cloud_essd",
    }));
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "192.168.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: name,
        vpcId: defaultNetwork.id,
        cidrBlock: "192.168.192.0/24",
        zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id),
    });
    const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {
        name: name,
        vpcId: defaultNetwork.id,
    });
    const defaultInstance = new alicloud.ecs.Instance("default", {
        imageId: defaultGetImages.then(defaultGetImages => defaultGetImages.images?.[0]?.id),
        instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.instanceTypes?.[0]?.id),
        securityGroups: [defaultSecurityGroup].map(__item => __item.id),
        internetChargeType: "PayByTraffic",
        internetMaxBandwidthOut: 10,
        availabilityZone: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.instanceTypes?.[0]?.availabilityZones?.[0]),
        instanceChargeType: "PostPaid",
        systemDiskCategory: "cloud_essd",
        vswitchId: defaultSwitch.id,
        instanceName: name,
        dataDisks: [{
            category: "cloud_essd",
            size: 20,
        }],
    });
    const defaultEcsDisk = new alicloud.ecs.EcsDisk("default", {
        diskName: name,
        zoneId: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.instanceTypes?.[0]?.availabilityZones?.[0]),
        category: "cloud_essd",
        size: 500,
    });
    const defaultEcsDiskAttachment = new alicloud.ecs.EcsDiskAttachment("default", {
        diskId: defaultEcsDisk.id,
        instanceId: defaultInstance.id,
    });
    const defaultEcsSnapshot = new alicloud.ecs.EcsSnapshot("default", {
        diskId: defaultEcsDiskAttachment.diskId,
        category: "standard",
        retentionDays: 20,
        snapshotName: name,
        description: name,
        tags: {
            Created: "TF",
            For: "Snapshot",
        },
    });
    const ids = alicloud.ecs.getEcsSnapshotsOutput({
        ids: [defaultEcsSnapshot.id],
    });
    export const ecsSnapshotsId0 = ids.apply(ids => ids.snapshots?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.resourcemanager.get_resource_groups(status="OK")
    default_get_zones = alicloud.get_zones(available_disk_category="cloud_essd",
        available_resource_creation="VSwitch")
    default_get_images = alicloud.ecs.get_images(most_recent=True,
        owners="system")
    default_get_instance_types = alicloud.ecs.get_instance_types(availability_zone=default_get_zones.zones[0].id,
        image_id=default_get_images.images[0].id,
        system_disk_category="cloud_essd")
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="192.168.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=name,
        vpc_id=default_network.id,
        cidr_block="192.168.192.0/24",
        zone_id=default_get_zones.zones[0].id)
    default_security_group = alicloud.ecs.SecurityGroup("default",
        name=name,
        vpc_id=default_network.id)
    default_instance = alicloud.ecs.Instance("default",
        image_id=default_get_images.images[0].id,
        instance_type=default_get_instance_types.instance_types[0].id,
        security_groups=[__item.id for __item in [default_security_group]],
        internet_charge_type="PayByTraffic",
        internet_max_bandwidth_out=10,
        availability_zone=default_get_instance_types.instance_types[0].availability_zones[0],
        instance_charge_type="PostPaid",
        system_disk_category="cloud_essd",
        vswitch_id=default_switch.id,
        instance_name=name,
        data_disks=[{
            "category": "cloud_essd",
            "size": 20,
        }])
    default_ecs_disk = alicloud.ecs.EcsDisk("default",
        disk_name=name,
        zone_id=default_get_instance_types.instance_types[0].availability_zones[0],
        category="cloud_essd",
        size=500)
    default_ecs_disk_attachment = alicloud.ecs.EcsDiskAttachment("default",
        disk_id=default_ecs_disk.id,
        instance_id=default_instance.id)
    default_ecs_snapshot = alicloud.ecs.EcsSnapshot("default",
        disk_id=default_ecs_disk_attachment.disk_id,
        category="standard",
        retention_days=20,
        snapshot_name=name,
        description=name,
        tags={
            "Created": "TF",
            "For": "Snapshot",
        })
    ids = alicloud.ecs.get_ecs_snapshots_output(ids=[default_ecs_snapshot.id])
    pulumi.export("ecsSnapshotsId0", ids.snapshots[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"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 := "terraform-example";
    if param := cfg.Get("name"); param != ""{
    name = param
    }
    _, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{
    Status: pulumi.StringRef("OK"),
    }, nil);
    if err != nil {
    return err
    }
    defaultGetZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    AvailableDiskCategory: pulumi.StringRef("cloud_essd"),
    AvailableResourceCreation: pulumi.StringRef("VSwitch"),
    }, nil);
    if err != nil {
    return err
    }
    defaultGetImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
    MostRecent: pulumi.BoolRef(true),
    Owners: pulumi.StringRef("system"),
    }, nil);
    if err != nil {
    return err
    }
    defaultGetInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
    AvailabilityZone: pulumi.StringRef(defaultGetZones.Zones[0].Id),
    ImageId: pulumi.StringRef(defaultGetImages.Images[0].Id),
    SystemDiskCategory: pulumi.StringRef("cloud_essd"),
    }, nil);
    if err != nil {
    return err
    }
    defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    VpcName: pulumi.String(name),
    CidrBlock: pulumi.String("192.168.0.0/16"),
    })
    if err != nil {
    return err
    }
    defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    VswitchName: pulumi.String(name),
    VpcId: defaultNetwork.ID(),
    CidrBlock: pulumi.String("192.168.192.0/24"),
    ZoneId: pulumi.String(defaultGetZones.Zones[0].Id),
    })
    if err != nil {
    return err
    }
    defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
    Name: pulumi.String(name),
    VpcId: defaultNetwork.ID(),
    })
    if err != nil {
    return err
    }
    var splat0 pulumi.StringArray
    for _, val0 := range %!v(PANIC=Format method: fatal: An assertion has failed: tok: ) {
    splat0 = append(splat0, val0.ID())
    }
    defaultInstance, err := ecs.NewInstance(ctx, "default", &ecs.InstanceArgs{
    ImageId: pulumi.String(defaultGetImages.Images[0].Id),
    InstanceType: pulumi.String(defaultGetInstanceTypes.InstanceTypes[0].Id),
    SecurityGroups: splat0,
    InternetChargeType: pulumi.String("PayByTraffic"),
    InternetMaxBandwidthOut: pulumi.Int(10),
    AvailabilityZone: pulumi.String(defaultGetInstanceTypes.InstanceTypes[0].AvailabilityZones[0]),
    InstanceChargeType: pulumi.String("PostPaid"),
    SystemDiskCategory: pulumi.String("cloud_essd"),
    VswitchId: defaultSwitch.ID(),
    InstanceName: pulumi.String(name),
    DataDisks: ecs.InstanceDataDiskArray{
    &ecs.InstanceDataDiskArgs{
    Category: pulumi.String("cloud_essd"),
    Size: pulumi.Int(20),
    },
    },
    })
    if err != nil {
    return err
    }
    defaultEcsDisk, err := ecs.NewEcsDisk(ctx, "default", &ecs.EcsDiskArgs{
    DiskName: pulumi.String(name),
    ZoneId: pulumi.String(defaultGetInstanceTypes.InstanceTypes[0].AvailabilityZones[0]),
    Category: pulumi.String("cloud_essd"),
    Size: pulumi.Int(500),
    })
    if err != nil {
    return err
    }
    defaultEcsDiskAttachment, err := ecs.NewEcsDiskAttachment(ctx, "default", &ecs.EcsDiskAttachmentArgs{
    DiskId: defaultEcsDisk.ID(),
    InstanceId: defaultInstance.ID(),
    })
    if err != nil {
    return err
    }
    defaultEcsSnapshot, err := ecs.NewEcsSnapshot(ctx, "default", &ecs.EcsSnapshotArgs{
    DiskId: defaultEcsDiskAttachment.DiskId,
    Category: pulumi.String("standard"),
    RetentionDays: pulumi.Int(20),
    SnapshotName: pulumi.String(name),
    Description: pulumi.String(name),
    Tags: pulumi.StringMap{
    "Created": pulumi.String("TF"),
    "For": pulumi.String("Snapshot"),
    },
    })
    if err != nil {
    return err
    }
    ids := ecs.GetEcsSnapshotsOutput(ctx, ecs.GetEcsSnapshotsOutputArgs{
    Ids: pulumi.StringArray{
    defaultEcsSnapshot.ID(),
    },
    }, nil);
    ctx.Export("ecsSnapshotsId0", ids.ApplyT(func(ids ecs.GetEcsSnapshotsResult) (*string, error) {
    return &ids.Snapshots[0].Id, nil
    }).(pulumi.StringPtrOutput))
    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") ?? "terraform-example";
        var @default = AliCloud.ResourceManager.GetResourceGroups.Invoke(new()
        {
            Status = "OK",
        });
    
        var defaultGetZones = AliCloud.GetZones.Invoke(new()
        {
            AvailableDiskCategory = "cloud_essd",
            AvailableResourceCreation = "VSwitch",
        });
    
        var defaultGetImages = AliCloud.Ecs.GetImages.Invoke(new()
        {
            MostRecent = true,
            Owners = "system",
        });
    
        var defaultGetInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
        {
            AvailabilityZone = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            ImageId = defaultGetImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
            SystemDiskCategory = "cloud_essd",
        });
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "192.168.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = name,
            VpcId = defaultNetwork.Id,
            CidrBlock = "192.168.192.0/24",
            ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        });
    
        var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
        {
            Name = name,
            VpcId = defaultNetwork.Id,
        });
    
        var defaultInstance = new AliCloud.Ecs.Instance("default", new()
        {
            ImageId = defaultGetImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
            SecurityGroups = new[]
            {
                defaultSecurityGroup,
            }.Select(__item => __item.Id).ToList(),
            InternetChargeType = "PayByTraffic",
            InternetMaxBandwidthOut = 10,
            AvailabilityZone = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.AvailabilityZones[0]),
            InstanceChargeType = "PostPaid",
            SystemDiskCategory = "cloud_essd",
            VswitchId = defaultSwitch.Id,
            InstanceName = name,
            DataDisks = new[]
            {
                new AliCloud.Ecs.Inputs.InstanceDataDiskArgs
                {
                    Category = "cloud_essd",
                    Size = 20,
                },
            },
        });
    
        var defaultEcsDisk = new AliCloud.Ecs.EcsDisk("default", new()
        {
            DiskName = name,
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.AvailabilityZones[0]),
            Category = "cloud_essd",
            Size = 500,
        });
    
        var defaultEcsDiskAttachment = new AliCloud.Ecs.EcsDiskAttachment("default", new()
        {
            DiskId = defaultEcsDisk.Id,
            InstanceId = defaultInstance.Id,
        });
    
        var defaultEcsSnapshot = new AliCloud.Ecs.EcsSnapshot("default", new()
        {
            DiskId = defaultEcsDiskAttachment.DiskId,
            Category = "standard",
            RetentionDays = 20,
            SnapshotName = name,
            Description = name,
            Tags = 
            {
                { "Created", "TF" },
                { "For", "Snapshot" },
            },
        });
    
        var ids = AliCloud.Ecs.GetEcsSnapshots.Invoke(new()
        {
            Ids = new[]
            {
                defaultEcsSnapshot.Id,
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["ecsSnapshotsId0"] = ids.Apply(getEcsSnapshotsResult => getEcsSnapshotsResult.Snapshots[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
    import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
    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.ecs.SecurityGroup;
    import com.pulumi.alicloud.ecs.SecurityGroupArgs;
    import com.pulumi.alicloud.ecs.Instance;
    import com.pulumi.alicloud.ecs.InstanceArgs;
    import com.pulumi.alicloud.ecs.inputs.InstanceDataDiskArgs;
    import com.pulumi.alicloud.ecs.EcsDisk;
    import com.pulumi.alicloud.ecs.EcsDiskArgs;
    import com.pulumi.alicloud.ecs.EcsDiskAttachment;
    import com.pulumi.alicloud.ecs.EcsDiskAttachmentArgs;
    import com.pulumi.alicloud.ecs.EcsSnapshot;
    import com.pulumi.alicloud.ecs.EcsSnapshotArgs;
    import com.pulumi.alicloud.ecs.inputs.GetEcsSnapshotsArgs;
    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("terraform-example");
            final var default = ResourcemanagerFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
                .status("OK")
                .build());
    
            final var defaultGetZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableDiskCategory("cloud_essd")
                .availableResourceCreation("VSwitch")
                .build());
    
            final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
                .mostRecent(true)
                .owners("system")
                .build());
    
            final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .availabilityZone(defaultGetZones.zones()[0].id())
                .imageId(defaultGetImages.images()[0].id())
                .systemDiskCategory("cloud_essd")
                .build());
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .vpcName(name)
                .cidrBlock("192.168.0.0/16")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vswitchName(name)
                .vpcId(defaultNetwork.id())
                .cidrBlock("192.168.192.0/24")
                .zoneId(defaultGetZones.zones()[0].id())
                .build());
    
            var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
                .name(name)
                .vpcId(defaultNetwork.id())
                .build());
    
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
                .imageId(defaultGetImages.images()[0].id())
                .instanceType(defaultGetInstanceTypes.instanceTypes()[0].id())
                .securityGroups(defaultSecurityGroup.stream().map(element -> element.id()).collect(toList()))
                .internetChargeType("PayByTraffic")
                .internetMaxBandwidthOut(10)
                .availabilityZone(defaultGetInstanceTypes.instanceTypes()[0].availabilityZones()[0])
                .instanceChargeType("PostPaid")
                .systemDiskCategory("cloud_essd")
                .vswitchId(defaultSwitch.id())
                .instanceName(name)
                .dataDisks(InstanceDataDiskArgs.builder()
                    .category("cloud_essd")
                    .size(20)
                    .build())
                .build());
    
            var defaultEcsDisk = new EcsDisk("defaultEcsDisk", EcsDiskArgs.builder()
                .diskName(name)
                .zoneId(defaultGetInstanceTypes.instanceTypes()[0].availabilityZones()[0])
                .category("cloud_essd")
                .size(500)
                .build());
    
            var defaultEcsDiskAttachment = new EcsDiskAttachment("defaultEcsDiskAttachment", EcsDiskAttachmentArgs.builder()
                .diskId(defaultEcsDisk.id())
                .instanceId(defaultInstance.id())
                .build());
    
            var defaultEcsSnapshot = new EcsSnapshot("defaultEcsSnapshot", EcsSnapshotArgs.builder()
                .diskId(defaultEcsDiskAttachment.diskId())
                .category("standard")
                .retentionDays(20)
                .snapshotName(name)
                .description(name)
                .tags(Map.ofEntries(
                    Map.entry("Created", "TF"),
                    Map.entry("For", "Snapshot")
                ))
                .build());
    
            final var ids = EcsFunctions.getEcsSnapshots(GetEcsSnapshotsArgs.builder()
                .ids(defaultEcsSnapshot.id())
                .build());
    
            ctx.export("ecsSnapshotsId0", ids.applyValue(_ids -> _ids.snapshots()[0].id()));
        }
    }
    
    Example coming soon!
    

    Using getEcsSnapshots

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getEcsSnapshots(args: GetEcsSnapshotsArgs, opts?: InvokeOptions): Promise<GetEcsSnapshotsResult>
    function getEcsSnapshotsOutput(args: GetEcsSnapshotsOutputArgs, opts?: InvokeOptions): Output<GetEcsSnapshotsResult>
    def get_ecs_snapshots(category: Optional[str] = None,
                          dry_run: Optional[bool] = None,
                          encrypted: Optional[bool] = None,
                          ids: Optional[Sequence[str]] = None,
                          kms_key_id: Optional[str] = None,
                          name_regex: Optional[str] = None,
                          output_file: Optional[str] = None,
                          resource_group_id: Optional[str] = None,
                          snapshot_link_id: Optional[str] = None,
                          snapshot_name: Optional[str] = None,
                          snapshot_type: Optional[str] = None,
                          source_disk_type: Optional[str] = None,
                          status: Optional[str] = None,
                          tags: Optional[Mapping[str, str]] = None,
                          type: Optional[str] = None,
                          usage: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetEcsSnapshotsResult
    def get_ecs_snapshots_output(category: Optional[pulumi.Input[str]] = None,
                          dry_run: Optional[pulumi.Input[bool]] = None,
                          encrypted: Optional[pulumi.Input[bool]] = None,
                          ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                          kms_key_id: Optional[pulumi.Input[str]] = None,
                          name_regex: Optional[pulumi.Input[str]] = None,
                          output_file: Optional[pulumi.Input[str]] = None,
                          resource_group_id: Optional[pulumi.Input[str]] = None,
                          snapshot_link_id: Optional[pulumi.Input[str]] = None,
                          snapshot_name: Optional[pulumi.Input[str]] = None,
                          snapshot_type: Optional[pulumi.Input[str]] = None,
                          source_disk_type: Optional[pulumi.Input[str]] = None,
                          status: Optional[pulumi.Input[str]] = None,
                          tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                          type: Optional[pulumi.Input[str]] = None,
                          usage: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetEcsSnapshotsResult]
    func GetEcsSnapshots(ctx *Context, args *GetEcsSnapshotsArgs, opts ...InvokeOption) (*GetEcsSnapshotsResult, error)
    func GetEcsSnapshotsOutput(ctx *Context, args *GetEcsSnapshotsOutputArgs, opts ...InvokeOption) GetEcsSnapshotsResultOutput

    > Note: This function is named GetEcsSnapshots in the Go SDK.

    public static class GetEcsSnapshots 
    {
        public static Task<GetEcsSnapshotsResult> InvokeAsync(GetEcsSnapshotsArgs args, InvokeOptions? opts = null)
        public static Output<GetEcsSnapshotsResult> Invoke(GetEcsSnapshotsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetEcsSnapshotsResult> getEcsSnapshots(GetEcsSnapshotsArgs args, InvokeOptions options)
    public static Output<GetEcsSnapshotsResult> getEcsSnapshots(GetEcsSnapshotsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: alicloud:ecs/getEcsSnapshots:getEcsSnapshots
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Category string
    The category of the snapshot. Valid Values: flash and standard.
    DryRun bool
    Specifies whether to check the validity of the request without actually making the request.
    Encrypted bool
    Specifies whether the snapshot is encrypted.
    Ids List<string>
    A list of Snapshot IDs.
    KmsKeyId string
    The kms key id.
    NameRegex string
    A regex string to filter results by Snapshot name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ResourceGroupId string
    The resource group id.
    SnapshotLinkId string
    The snapshot link id.
    SnapshotName string
    The name of the snapshot.
    SnapshotType string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    SourceDiskType string
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    Status string
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the snapshot.
    Type string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    Usage string
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    Category string
    The category of the snapshot. Valid Values: flash and standard.
    DryRun bool
    Specifies whether to check the validity of the request without actually making the request.
    Encrypted bool
    Specifies whether the snapshot is encrypted.
    Ids []string
    A list of Snapshot IDs.
    KmsKeyId string
    The kms key id.
    NameRegex string
    A regex string to filter results by Snapshot name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ResourceGroupId string
    The resource group id.
    SnapshotLinkId string
    The snapshot link id.
    SnapshotName string
    The name of the snapshot.
    SnapshotType string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    SourceDiskType string
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    Status string
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    Tags map[string]string
    A mapping of tags to assign to the snapshot.
    Type string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    Usage string
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category String
    The category of the snapshot. Valid Values: flash and standard.
    dryRun Boolean
    Specifies whether to check the validity of the request without actually making the request.
    encrypted Boolean
    Specifies whether the snapshot is encrypted.
    ids List<String>
    A list of Snapshot IDs.
    kmsKeyId String
    The kms key id.
    nameRegex String
    A regex string to filter results by Snapshot name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    resourceGroupId String
    The resource group id.
    snapshotLinkId String
    The snapshot link id.
    snapshotName String
    The name of the snapshot.
    snapshotType String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    sourceDiskType String
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    status String
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags Map<String,String>
    A mapping of tags to assign to the snapshot.
    type String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage String
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category string
    The category of the snapshot. Valid Values: flash and standard.
    dryRun boolean
    Specifies whether to check the validity of the request without actually making the request.
    encrypted boolean
    Specifies whether the snapshot is encrypted.
    ids string[]
    A list of Snapshot IDs.
    kmsKeyId string
    The kms key id.
    nameRegex string
    A regex string to filter results by Snapshot name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    resourceGroupId string
    The resource group id.
    snapshotLinkId string
    The snapshot link id.
    snapshotName string
    The name of the snapshot.
    snapshotType string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    sourceDiskType string
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    status string
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags {[key: string]: string}
    A mapping of tags to assign to the snapshot.
    type string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage string
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category str
    The category of the snapshot. Valid Values: flash and standard.
    dry_run bool
    Specifies whether to check the validity of the request without actually making the request.
    encrypted bool
    Specifies whether the snapshot is encrypted.
    ids Sequence[str]
    A list of Snapshot IDs.
    kms_key_id str
    The kms key id.
    name_regex str
    A regex string to filter results by Snapshot name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    resource_group_id str
    The resource group id.
    snapshot_link_id str
    The snapshot link id.
    snapshot_name str
    The name of the snapshot.
    snapshot_type str
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    source_disk_type str
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    status str
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags Mapping[str, str]
    A mapping of tags to assign to the snapshot.
    type str
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage str
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category String
    The category of the snapshot. Valid Values: flash and standard.
    dryRun Boolean
    Specifies whether to check the validity of the request without actually making the request.
    encrypted Boolean
    Specifies whether the snapshot is encrypted.
    ids List<String>
    A list of Snapshot IDs.
    kmsKeyId String
    The kms key id.
    nameRegex String
    A regex string to filter results by Snapshot name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    resourceGroupId String
    The resource group id.
    snapshotLinkId String
    The snapshot link id.
    snapshotName String
    The name of the snapshot.
    snapshotType String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    sourceDiskType String
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    status String
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags Map<String>
    A mapping of tags to assign to the snapshot.
    type String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage String
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.

    getEcsSnapshots Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    A list of Snapshot names.
    Snapshots List<Pulumi.AliCloud.Ecs.Outputs.GetEcsSnapshotsSnapshot>
    A list of Ecs Snapshots. Each element contains the following attributes:
    Category string
    The category of the snapshot.
    DryRun bool
    Encrypted bool
    Indicates whether the snapshot was encrypted.
    KmsKeyId string
    NameRegex string
    OutputFile string
    ResourceGroupId string
    The ID of the resource group to which the snapshot belongs.
    SnapshotLinkId string
    SnapshotName string
    The name of the snapshot.
    SnapshotType string
    The type of the snapshot.
    SourceDiskType string
    The type of the source disk.
    Status string
    The status of the snapshot.
    Tags Dictionary<string, string>
    The tags of the snapshot.
    Type string
    The type of the snapshot.
    Usage string
    Indicates whether the snapshot was used to create images or cloud disks.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    A list of Snapshot names.
    Snapshots []GetEcsSnapshotsSnapshot
    A list of Ecs Snapshots. Each element contains the following attributes:
    Category string
    The category of the snapshot.
    DryRun bool
    Encrypted bool
    Indicates whether the snapshot was encrypted.
    KmsKeyId string
    NameRegex string
    OutputFile string
    ResourceGroupId string
    The ID of the resource group to which the snapshot belongs.
    SnapshotLinkId string
    SnapshotName string
    The name of the snapshot.
    SnapshotType string
    The type of the snapshot.
    SourceDiskType string
    The type of the source disk.
    Status string
    The status of the snapshot.
    Tags map[string]string
    The tags of the snapshot.
    Type string
    The type of the snapshot.
    Usage string
    Indicates whether the snapshot was used to create images or cloud disks.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Snapshot names.
    snapshots List<GetEcsSnapshotsSnapshot>
    A list of Ecs Snapshots. Each element contains the following attributes:
    category String
    The category of the snapshot.
    dryRun Boolean
    encrypted Boolean
    Indicates whether the snapshot was encrypted.
    kmsKeyId String
    nameRegex String
    outputFile String
    resourceGroupId String
    The ID of the resource group to which the snapshot belongs.
    snapshotLinkId String
    snapshotName String
    The name of the snapshot.
    snapshotType String
    The type of the snapshot.
    sourceDiskType String
    The type of the source disk.
    status String
    The status of the snapshot.
    tags Map<String,String>
    The tags of the snapshot.
    type String
    The type of the snapshot.
    usage String
    Indicates whether the snapshot was used to create images or cloud disks.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    A list of Snapshot names.
    snapshots GetEcsSnapshotsSnapshot[]
    A list of Ecs Snapshots. Each element contains the following attributes:
    category string
    The category of the snapshot.
    dryRun boolean
    encrypted boolean
    Indicates whether the snapshot was encrypted.
    kmsKeyId string
    nameRegex string
    outputFile string
    resourceGroupId string
    The ID of the resource group to which the snapshot belongs.
    snapshotLinkId string
    snapshotName string
    The name of the snapshot.
    snapshotType string
    The type of the snapshot.
    sourceDiskType string
    The type of the source disk.
    status string
    The status of the snapshot.
    tags {[key: string]: string}
    The tags of the snapshot.
    type string
    The type of the snapshot.
    usage string
    Indicates whether the snapshot was used to create images or cloud disks.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    A list of Snapshot names.
    snapshots Sequence[GetEcsSnapshotsSnapshot]
    A list of Ecs Snapshots. Each element contains the following attributes:
    category str
    The category of the snapshot.
    dry_run bool
    encrypted bool
    Indicates whether the snapshot was encrypted.
    kms_key_id str
    name_regex str
    output_file str
    resource_group_id str
    The ID of the resource group to which the snapshot belongs.
    snapshot_link_id str
    snapshot_name str
    The name of the snapshot.
    snapshot_type str
    The type of the snapshot.
    source_disk_type str
    The type of the source disk.
    status str
    The status of the snapshot.
    tags Mapping[str, str]
    The tags of the snapshot.
    type str
    The type of the snapshot.
    usage str
    Indicates whether the snapshot was used to create images or cloud disks.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Snapshot names.
    snapshots List<Property Map>
    A list of Ecs Snapshots. Each element contains the following attributes:
    category String
    The category of the snapshot.
    dryRun Boolean
    encrypted Boolean
    Indicates whether the snapshot was encrypted.
    kmsKeyId String
    nameRegex String
    outputFile String
    resourceGroupId String
    The ID of the resource group to which the snapshot belongs.
    snapshotLinkId String
    snapshotName String
    The name of the snapshot.
    snapshotType String
    The type of the snapshot.
    sourceDiskType String
    The type of the source disk.
    status String
    The status of the snapshot.
    tags Map<String>
    The tags of the snapshot.
    type String
    The type of the snapshot.
    usage String
    Indicates whether the snapshot was used to create images or cloud disks.

    Supporting Types

    GetEcsSnapshotsSnapshot

    Category string
    The category of the snapshot. Valid Values: flash and standard.
    CreationTime string
    The time when the snapshot was created.
    Description string
    The description of the snapshot.
    DiskId string
    The ID of the source disk.
    Encrypted bool
    Specifies whether the snapshot is encrypted.
    Id string
    The ID of the Snapshot.
    InstantAccess bool
    Indicates whether the instant access feature is enabled.
    InstantAccessRetentionDays int
    Indicates the validity period of the instant access feature.
    Name string
    The name of the snapshot.
    ProductCode string
    The product code of the Alibaba Cloud Marketplace image.
    Progress string
    The progress of the snapshot creation task.
    RemainTime int
    The amount of remaining time required to create the snapshot.
    ResourceGroupId string
    The resource group id.
    RetentionDays int
    The retention period of the automatic snapshot.
    SnapshotId string
    The ID of the snapshot.
    SnapshotName string
    The name of the snapshot.
    SnapshotSn string
    The serial number of the snapshot.
    SnapshotType string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    SourceDiskId string
    The ID of the source disk.
    SourceDiskSize string
    The capacity of the source disk.
    SourceDiskType string
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    SourceStorageType string
    The category of the source disk.
    Status string
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the snapshot.
    Type string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    Usage string
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    Category string
    The category of the snapshot. Valid Values: flash and standard.
    CreationTime string
    The time when the snapshot was created.
    Description string
    The description of the snapshot.
    DiskId string
    The ID of the source disk.
    Encrypted bool
    Specifies whether the snapshot is encrypted.
    Id string
    The ID of the Snapshot.
    InstantAccess bool
    Indicates whether the instant access feature is enabled.
    InstantAccessRetentionDays int
    Indicates the validity period of the instant access feature.
    Name string
    The name of the snapshot.
    ProductCode string
    The product code of the Alibaba Cloud Marketplace image.
    Progress string
    The progress of the snapshot creation task.
    RemainTime int
    The amount of remaining time required to create the snapshot.
    ResourceGroupId string
    The resource group id.
    RetentionDays int
    The retention period of the automatic snapshot.
    SnapshotId string
    The ID of the snapshot.
    SnapshotName string
    The name of the snapshot.
    SnapshotSn string
    The serial number of the snapshot.
    SnapshotType string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    SourceDiskId string
    The ID of the source disk.
    SourceDiskSize string
    The capacity of the source disk.
    SourceDiskType string
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    SourceStorageType string
    The category of the source disk.
    Status string
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    Tags map[string]string
    A mapping of tags to assign to the snapshot.
    Type string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    Usage string
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category String
    The category of the snapshot. Valid Values: flash and standard.
    creationTime String
    The time when the snapshot was created.
    description String
    The description of the snapshot.
    diskId String
    The ID of the source disk.
    encrypted Boolean
    Specifies whether the snapshot is encrypted.
    id String
    The ID of the Snapshot.
    instantAccess Boolean
    Indicates whether the instant access feature is enabled.
    instantAccessRetentionDays Integer
    Indicates the validity period of the instant access feature.
    name String
    The name of the snapshot.
    productCode String
    The product code of the Alibaba Cloud Marketplace image.
    progress String
    The progress of the snapshot creation task.
    remainTime Integer
    The amount of remaining time required to create the snapshot.
    resourceGroupId String
    The resource group id.
    retentionDays Integer
    The retention period of the automatic snapshot.
    snapshotId String
    The ID of the snapshot.
    snapshotName String
    The name of the snapshot.
    snapshotSn String
    The serial number of the snapshot.
    snapshotType String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    sourceDiskId String
    The ID of the source disk.
    sourceDiskSize String
    The capacity of the source disk.
    sourceDiskType String
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    sourceStorageType String
    The category of the source disk.
    status String
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags Map<String,String>
    A mapping of tags to assign to the snapshot.
    type String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage String
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category string
    The category of the snapshot. Valid Values: flash and standard.
    creationTime string
    The time when the snapshot was created.
    description string
    The description of the snapshot.
    diskId string
    The ID of the source disk.
    encrypted boolean
    Specifies whether the snapshot is encrypted.
    id string
    The ID of the Snapshot.
    instantAccess boolean
    Indicates whether the instant access feature is enabled.
    instantAccessRetentionDays number
    Indicates the validity period of the instant access feature.
    name string
    The name of the snapshot.
    productCode string
    The product code of the Alibaba Cloud Marketplace image.
    progress string
    The progress of the snapshot creation task.
    remainTime number
    The amount of remaining time required to create the snapshot.
    resourceGroupId string
    The resource group id.
    retentionDays number
    The retention period of the automatic snapshot.
    snapshotId string
    The ID of the snapshot.
    snapshotName string
    The name of the snapshot.
    snapshotSn string
    The serial number of the snapshot.
    snapshotType string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    sourceDiskId string
    The ID of the source disk.
    sourceDiskSize string
    The capacity of the source disk.
    sourceDiskType string
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    sourceStorageType string
    The category of the source disk.
    status string
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags {[key: string]: string}
    A mapping of tags to assign to the snapshot.
    type string
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage string
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category str
    The category of the snapshot. Valid Values: flash and standard.
    creation_time str
    The time when the snapshot was created.
    description str
    The description of the snapshot.
    disk_id str
    The ID of the source disk.
    encrypted bool
    Specifies whether the snapshot is encrypted.
    id str
    The ID of the Snapshot.
    instant_access bool
    Indicates whether the instant access feature is enabled.
    instant_access_retention_days int
    Indicates the validity period of the instant access feature.
    name str
    The name of the snapshot.
    product_code str
    The product code of the Alibaba Cloud Marketplace image.
    progress str
    The progress of the snapshot creation task.
    remain_time int
    The amount of remaining time required to create the snapshot.
    resource_group_id str
    The resource group id.
    retention_days int
    The retention period of the automatic snapshot.
    snapshot_id str
    The ID of the snapshot.
    snapshot_name str
    The name of the snapshot.
    snapshot_sn str
    The serial number of the snapshot.
    snapshot_type str
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    source_disk_id str
    The ID of the source disk.
    source_disk_size str
    The capacity of the source disk.
    source_disk_type str
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    source_storage_type str
    The category of the source disk.
    status str
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags Mapping[str, str]
    A mapping of tags to assign to the snapshot.
    type str
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage str
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.
    category String
    The category of the snapshot. Valid Values: flash and standard.
    creationTime String
    The time when the snapshot was created.
    description String
    The description of the snapshot.
    diskId String
    The ID of the source disk.
    encrypted Boolean
    Specifies whether the snapshot is encrypted.
    id String
    The ID of the Snapshot.
    instantAccess Boolean
    Indicates whether the instant access feature is enabled.
    instantAccessRetentionDays Number
    Indicates the validity period of the instant access feature.
    name String
    The name of the snapshot.
    productCode String
    The product code of the Alibaba Cloud Marketplace image.
    progress String
    The progress of the snapshot creation task.
    remainTime Number
    The amount of remaining time required to create the snapshot.
    resourceGroupId String
    The resource group id.
    retentionDays Number
    The retention period of the automatic snapshot.
    snapshotId String
    The ID of the snapshot.
    snapshotName String
    The name of the snapshot.
    snapshotSn String
    The serial number of the snapshot.
    snapshotType String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    sourceDiskId String
    The ID of the source disk.
    sourceDiskSize String
    The capacity of the source disk.
    sourceDiskType String
    The type of the disk for which the snapshot was created. Valid Values: System, Data.
    sourceStorageType String
    The category of the source disk.
    status String
    The status of the snapshot. Valid Values: accomplished, failed, progressing and all.
    tags Map<String>
    A mapping of tags to assign to the snapshot.
    type String
    The type of the snapshot. Valid Values: auto, user and all. Default to: all.
    usage String
    A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.

    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.83.0 published on Monday, Jul 21, 2025 by Pulumi