Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.ecs.getEcsSnapshots
Explore with Pulumi AI
This data source provides the Ecs Snapshots of the current Alibaba Cloud user.
NOTE: Available in v1.120.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.ecs.getEcsSnapshots({
    ids: ["s-bp1fvuxxxxxxxx"],
    nameRegex: "tf-test",
});
export const firstEcsSnapshotId = example.then(example => example.snapshots?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.ecs.get_ecs_snapshots(ids=["s-bp1fvuxxxxxxxx"],
    name_regex="tf-test")
pulumi.export("firstEcsSnapshotId", example.snapshots[0].id)
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 {
		example, err := ecs.GetEcsSnapshots(ctx, &ecs.GetEcsSnapshotsArgs{
			Ids: []string{
				"s-bp1fvuxxxxxxxx",
			},
			NameRegex: pulumi.StringRef("tf-test"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstEcsSnapshotId", example.Snapshots[0].Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var example = AliCloud.Ecs.GetEcsSnapshots.Invoke(new()
    {
        Ids = new[]
        {
            "s-bp1fvuxxxxxxxx",
        },
        NameRegex = "tf-test",
    });
    return new Dictionary<string, object?>
    {
        ["firstEcsSnapshotId"] = example.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.ecs.EcsFunctions;
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 example = EcsFunctions.getEcsSnapshots(GetEcsSnapshotsArgs.builder()
            .ids("s-bp1fvuxxxxxxxx")
            .nameRegex("tf-test")
            .build());
        ctx.export("firstEcsSnapshotId", example.applyValue(getEcsSnapshotsResult -> getEcsSnapshotsResult.snapshots()[0].id()));
    }
}
variables:
  example:
    fn::invoke:
      Function: alicloud:ecs:getEcsSnapshots
      Arguments:
        ids:
          - s-bp1fvuxxxxxxxx
        nameRegex: tf-test
outputs:
  firstEcsSnapshotId: ${example.snapshots[0].id}
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, Any]] = 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, Any]]] = 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:ecs/getEcsSnapshots:getEcsSnapshots
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Category string
 - The category of the snapshot. Valid Values: 
flashandstandard. - 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 List<string>
 - A list of Snapshot IDs.
 - Kms
Key stringId  - The kms key id.
 - Name
Regex string - A regex string to filter results by Snapshot name.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Resource
Group stringId  - The resource group id.
 - Snapshot
Link stringId  - The snapshot link id.
 - Snapshot
Name string - The name of the snapshot.
 - Snapshot
Type string - The type of the snapshot. Valid Values: 
auto,userandall. Default to:all. - Source
Disk stringType  - 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,progressingandall. - Dictionary<string, object>
 - A mapping of tags to assign to the snapshot.
 - Type string
 - Usage string
 - A resource type that has a reference relationship. Valid Values: 
image,disk,image_diskandnone. 
- Category string
 - The category of the snapshot. Valid Values: 
flashandstandard. - 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 []string
 - A list of Snapshot IDs.
 - Kms
Key stringId  - The kms key id.
 - Name
Regex string - A regex string to filter results by Snapshot name.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Resource
Group stringId  - The resource group id.
 - Snapshot
Link stringId  - The snapshot link id.
 - Snapshot
Name string - The name of the snapshot.
 - Snapshot
Type string - The type of the snapshot. Valid Values: 
auto,userandall. Default to:all. - Source
Disk stringType  - 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,progressingandall. - map[string]interface{}
 - A mapping of tags to assign to the snapshot.
 - Type string
 - Usage string
 - A resource type that has a reference relationship. Valid Values: 
image,disk,image_diskandnone. 
- category String
 - The category of the snapshot. Valid Values: 
flashandstandard. - dry
Run 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.
 - kms
Key StringId  - The kms key id.
 - name
Regex String - A regex string to filter results by Snapshot name.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - resource
Group StringId  - The resource group id.
 - snapshot
Link StringId  - The snapshot link id.
 - snapshot
Name String - The name of the snapshot.
 - snapshot
Type String - The type of the snapshot. Valid Values: 
auto,userandall. Default to:all. - source
Disk StringType  - 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,progressingandall. - Map<String,Object>
 - A mapping of tags to assign to the snapshot.
 - type String
 - usage String
 - A resource type that has a reference relationship. Valid Values: 
image,disk,image_diskandnone. 
- category string
 - The category of the snapshot. Valid Values: 
flashandstandard. - dry
Run 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.
 - kms
Key stringId  - The kms key id.
 - name
Regex string - A regex string to filter results by Snapshot name.
 - output
File string - File name where to save data source results (after running 
pulumi preview). - resource
Group stringId  - The resource group id.
 - snapshot
Link stringId  - The snapshot link id.
 - snapshot
Name string - The name of the snapshot.
 - snapshot
Type string - The type of the snapshot. Valid Values: 
auto,userandall. Default to:all. - source
Disk stringType  - 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,progressingandall. - {[key: string]: any}
 - A mapping of tags to assign to the snapshot.
 - type string
 - usage string
 - A resource type that has a reference relationship. Valid Values: 
image,disk,image_diskandnone. 
- category str
 - The category of the snapshot. Valid Values: 
flashandstandard. - 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_ strid  - 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_ strid  - The resource group id.
 - snapshot_
link_ strid  - The snapshot link id.
 - snapshot_
name str - The name of the snapshot.
 - snapshot_
type str - The type of the snapshot. Valid Values: 
auto,userandall. Default to:all. - source_
disk_ strtype  - 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,progressingandall. - Mapping[str, Any]
 - A mapping of tags to assign to the snapshot.
 - type str
 - usage str
 - A resource type that has a reference relationship. Valid Values: 
image,disk,image_diskandnone. 
- category String
 - The category of the snapshot. Valid Values: 
flashandstandard. - dry
Run 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.
 - kms
Key StringId  - The kms key id.
 - name
Regex String - A regex string to filter results by Snapshot name.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - resource
Group StringId  - The resource group id.
 - snapshot
Link StringId  - The snapshot link id.
 - snapshot
Name String - The name of the snapshot.
 - snapshot
Type String - The type of the snapshot. Valid Values: 
auto,userandall. Default to:all. - source
Disk StringType  - 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,progressingandall. - Map<Any>
 - A mapping of tags to assign to the snapshot.
 - type String
 - usage String
 - A resource type that has a reference relationship. Valid Values: 
image,disk,image_diskandnone. 
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>
 - Snapshots
List<Pulumi.
Ali Cloud. Ecs. Outputs. Get Ecs Snapshots Snapshot>  - Category string
 - Dry
Run bool - Encrypted bool
 - Kms
Key stringId  - Name
Regex string - Output
File string - Resource
Group stringId  - Snapshot
Link stringId  - Snapshot
Name string - Snapshot
Type string - Source
Disk stringType  - Status string
 - Dictionary<string, object>
 - Type string
 - Usage string
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - Names []string
 - Snapshots
[]Get
Ecs Snapshots Snapshot  - Category string
 - Dry
Run bool - Encrypted bool
 - Kms
Key stringId  - Name
Regex string - Output
File string - Resource
Group stringId  - Snapshot
Link stringId  - Snapshot
Name string - Snapshot
Type string - Source
Disk stringType  - Status string
 - map[string]interface{}
 - Type string
 - Usage string
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - names List<String>
 - snapshots
List<Get
Ecs Snapshots Snapshot>  - category String
 - dry
Run Boolean - encrypted Boolean
 - kms
Key StringId  - name
Regex String - output
File String - resource
Group StringId  - snapshot
Link StringId  - snapshot
Name String - snapshot
Type String - source
Disk StringType  - status String
 - Map<String,Object>
 - type String
 - usage String
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - names string[]
 - snapshots
Get
Ecs Snapshots Snapshot[]  - category string
 - dry
Run boolean - encrypted boolean
 - kms
Key stringId  - name
Regex string - output
File string - resource
Group stringId  - snapshot
Link stringId  - snapshot
Name string - snapshot
Type string - source
Disk stringType  - status string
 - {[key: string]: any}
 - type string
 - usage string
 
- id str
 - The provider-assigned unique ID for this managed resource.
 - ids Sequence[str]
 - names Sequence[str]
 - snapshots
Sequence[Get
Ecs Snapshots Snapshot]  - category str
 - dry_
run bool - encrypted bool
 - kms_
key_ strid  - name_
regex str - output_
file str - resource_
group_ strid  - snapshot_
link_ strid  - snapshot_
name str - snapshot_
type str - source_
disk_ strtype  - status str
 - Mapping[str, Any]
 - type str
 - usage str
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - names List<String>
 - snapshots List<Property Map>
 - category String
 - dry
Run Boolean - encrypted Boolean
 - kms
Key StringId  - name
Regex String - output
File String - resource
Group StringId  - snapshot
Link StringId  - snapshot
Name String - snapshot
Type String - source
Disk StringType  - status String
 - Map<Any>
 - type String
 - usage String
 
Supporting Types
GetEcsSnapshotsSnapshot   
- Category string
 - The category of the snapshot.
 - Creation
Time string - Description string
 - The description of the snapshot.
 - Disk
Id string - The source disk id.
 - Encrypted bool
 - Whether the snapshot is encrypted.
 - Id string
 - The ID of the Snapshot.
 - Instant
Access bool - Whether snapshot speed availability is enabled.
 - Instant
Access intRetention Days  - Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
 - Name string
 - Product
Code string - The product number inherited from the mirror market.
 - Progress string
 - Snapshot creation progress, in percentage.
 - Remain
Time int - Remaining completion time for the snapshot being created.
 - Resource
Group stringId  - The resource group id.
 - Retention
Days int - Automatic snapshot retention days.
 - Snapshot
Id string - The snapshot id.
 - Snapshot
Name string - Snapshot Display Name.
 - Snapshot
Sn string - The serial number of the snapshot.
 - Snapshot
Type string - Snapshot creation type.
 - Source
Disk stringId  - Source
Disk stringSize  - Source disk capacity.
 - Source
Disk stringType  - Source disk attributes.
 - Source
Storage stringType  - Original disk type.
 - Status string
 - The status of the snapshot.
 - Dictionary<string, object>
 - The tags.
 - Type string
 - Usage string
 - A resource type that has a reference relationship.
 
- Category string
 - The category of the snapshot.
 - Creation
Time string - Description string
 - The description of the snapshot.
 - Disk
Id string - The source disk id.
 - Encrypted bool
 - Whether the snapshot is encrypted.
 - Id string
 - The ID of the Snapshot.
 - Instant
Access bool - Whether snapshot speed availability is enabled.
 - Instant
Access intRetention Days  - Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
 - Name string
 - Product
Code string - The product number inherited from the mirror market.
 - Progress string
 - Snapshot creation progress, in percentage.
 - Remain
Time int - Remaining completion time for the snapshot being created.
 - Resource
Group stringId  - The resource group id.
 - Retention
Days int - Automatic snapshot retention days.
 - Snapshot
Id string - The snapshot id.
 - Snapshot
Name string - Snapshot Display Name.
 - Snapshot
Sn string - The serial number of the snapshot.
 - Snapshot
Type string - Snapshot creation type.
 - Source
Disk stringId  - Source
Disk stringSize  - Source disk capacity.
 - Source
Disk stringType  - Source disk attributes.
 - Source
Storage stringType  - Original disk type.
 - Status string
 - The status of the snapshot.
 - map[string]interface{}
 - The tags.
 - Type string
 - Usage string
 - A resource type that has a reference relationship.
 
- category String
 - The category of the snapshot.
 - creation
Time String - description String
 - The description of the snapshot.
 - disk
Id String - The source disk id.
 - encrypted Boolean
 - Whether the snapshot is encrypted.
 - id String
 - The ID of the Snapshot.
 - instant
Access Boolean - Whether snapshot speed availability is enabled.
 - instant
Access IntegerRetention Days  - Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
 - name String
 - product
Code String - The product number inherited from the mirror market.
 - progress String
 - Snapshot creation progress, in percentage.
 - remain
Time Integer - Remaining completion time for the snapshot being created.
 - resource
Group StringId  - The resource group id.
 - retention
Days Integer - Automatic snapshot retention days.
 - snapshot
Id String - The snapshot id.
 - snapshot
Name String - Snapshot Display Name.
 - snapshot
Sn String - The serial number of the snapshot.
 - snapshot
Type String - Snapshot creation type.
 - source
Disk StringId  - source
Disk StringSize  - Source disk capacity.
 - source
Disk StringType  - Source disk attributes.
 - source
Storage StringType  - Original disk type.
 - status String
 - The status of the snapshot.
 - Map<String,Object>
 - The tags.
 - type String
 - usage String
 - A resource type that has a reference relationship.
 
- category string
 - The category of the snapshot.
 - creation
Time string - description string
 - The description of the snapshot.
 - disk
Id string - The source disk id.
 - encrypted boolean
 - Whether the snapshot is encrypted.
 - id string
 - The ID of the Snapshot.
 - instant
Access boolean - Whether snapshot speed availability is enabled.
 - instant
Access numberRetention Days  - Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
 - name string
 - product
Code string - The product number inherited from the mirror market.
 - progress string
 - Snapshot creation progress, in percentage.
 - remain
Time number - Remaining completion time for the snapshot being created.
 - resource
Group stringId  - The resource group id.
 - retention
Days number - Automatic snapshot retention days.
 - snapshot
Id string - The snapshot id.
 - snapshot
Name string - Snapshot Display Name.
 - snapshot
Sn string - The serial number of the snapshot.
 - snapshot
Type string - Snapshot creation type.
 - source
Disk stringId  - source
Disk stringSize  - Source disk capacity.
 - source
Disk stringType  - Source disk attributes.
 - source
Storage stringType  - Original disk type.
 - status string
 - The status of the snapshot.
 - {[key: string]: any}
 - The tags.
 - type string
 - usage string
 - A resource type that has a reference relationship.
 
- category str
 - The category of the snapshot.
 - creation_
time str - description str
 - The description of the snapshot.
 - disk_
id str - The source disk id.
 - encrypted bool
 - Whether the snapshot is encrypted.
 - id str
 - The ID of the Snapshot.
 - instant_
access bool - Whether snapshot speed availability is enabled.
 - instant_
access_ intretention_ days  - Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
 - name str
 - product_
code str - The product number inherited from the mirror market.
 - progress str
 - Snapshot creation progress, in percentage.
 - remain_
time int - Remaining completion time for the snapshot being created.
 - resource_
group_ strid  - The resource group id.
 - retention_
days int - Automatic snapshot retention days.
 - snapshot_
id str - The snapshot id.
 - snapshot_
name str - Snapshot Display Name.
 - snapshot_
sn str - The serial number of the snapshot.
 - snapshot_
type str - Snapshot creation type.
 - source_
disk_ strid  - source_
disk_ strsize  - Source disk capacity.
 - source_
disk_ strtype  - Source disk attributes.
 - source_
storage_ strtype  - Original disk type.
 - status str
 - The status of the snapshot.
 - Mapping[str, Any]
 - The tags.
 - type str
 - usage str
 - A resource type that has a reference relationship.
 
- category String
 - The category of the snapshot.
 - creation
Time String - description String
 - The description of the snapshot.
 - disk
Id String - The source disk id.
 - encrypted Boolean
 - Whether the snapshot is encrypted.
 - id String
 - The ID of the Snapshot.
 - instant
Access Boolean - Whether snapshot speed availability is enabled.
 - instant
Access NumberRetention Days  - Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
 - name String
 - product
Code String - The product number inherited from the mirror market.
 - progress String
 - Snapshot creation progress, in percentage.
 - remain
Time Number - Remaining completion time for the snapshot being created.
 - resource
Group StringId  - The resource group id.
 - retention
Days Number - Automatic snapshot retention days.
 - snapshot
Id String - The snapshot id.
 - snapshot
Name String - Snapshot Display Name.
 - snapshot
Sn String - The serial number of the snapshot.
 - snapshot
Type String - Snapshot creation type.
 - source
Disk StringId  - source
Disk StringSize  - Source disk capacity.
 - source
Disk StringType  - Source disk attributes.
 - source
Storage StringType  - Original disk type.
 - status String
 - The status of the snapshot.
 - Map<Any>
 - The tags.
 - type String
 - usage String
 - A resource type that has a reference relationship.
 
Package Details
- Repository
 - Alibaba Cloud pulumi/pulumi-alicloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
alicloudTerraform Provider.