Alibaba Cloud v3.87.0 published on Saturday, Oct 18, 2025 by Pulumi
alicloud.ecs.getEcsSnapshotGroups
This data source provides the Ecs Snapshot Groups of the current Alibaba Cloud user.
NOTE: Available in v1.160.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.ecs.getEcsSnapshotGroups({
    ids: ["example-id"],
});
export const ecsSnapshotGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
const nameRegex = alicloud.ecs.getEcsSnapshotGroups({
    nameRegex: "^my-SnapshotGroup",
});
export const ecsSnapshotGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
const status = alicloud.ecs.getEcsSnapshotGroups({
    status: "accomplished",
});
export const ecsSnapshotGroupId3 = status.then(status => status.groups?.[0]?.id);
const instanceId = alicloud.ecs.getEcsSnapshotGroups({
    instanceId: "example-instance_id",
});
export const ecsSnapshotGroupId4 = instanceId.then(instanceId => instanceId.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.ecs.get_ecs_snapshot_groups(ids=["example-id"])
pulumi.export("ecsSnapshotGroupId1", ids.groups[0].id)
name_regex = alicloud.ecs.get_ecs_snapshot_groups(name_regex="^my-SnapshotGroup")
pulumi.export("ecsSnapshotGroupId2", name_regex.groups[0].id)
status = alicloud.ecs.get_ecs_snapshot_groups(status="accomplished")
pulumi.export("ecsSnapshotGroupId3", status.groups[0].id)
instance_id = alicloud.ecs.get_ecs_snapshot_groups(instance_id="example-instance_id")
pulumi.export("ecsSnapshotGroupId4", instance_id.groups[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 {
		ids, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
			Ids: []string{
				"example-id",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("ecsSnapshotGroupId1", ids.Groups[0].Id)
		nameRegex, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
			NameRegex: pulumi.StringRef("^my-SnapshotGroup"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("ecsSnapshotGroupId2", nameRegex.Groups[0].Id)
		status, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
			Status: pulumi.StringRef("accomplished"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("ecsSnapshotGroupId3", status.Groups[0].Id)
		instanceId, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
			InstanceId: pulumi.StringRef("example-instance_id"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("ecsSnapshotGroupId4", instanceId.Groups[0].Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
    {
        Ids = new[]
        {
            "example-id",
        },
    });
    var nameRegex = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
    {
        NameRegex = "^my-SnapshotGroup",
    });
    var status = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
    {
        Status = "accomplished",
    });
    var instanceId = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
    {
        InstanceId = "example-instance_id",
    });
    return new Dictionary<string, object?>
    {
        ["ecsSnapshotGroupId1"] = ids.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
        ["ecsSnapshotGroupId2"] = nameRegex.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
        ["ecsSnapshotGroupId3"] = status.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
        ["ecsSnapshotGroupId4"] = instanceId.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[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.GetEcsSnapshotGroupsArgs;
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 ids = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
            .ids("example-id")
            .build());
        ctx.export("ecsSnapshotGroupId1", ids.groups()[0].id());
        final var nameRegex = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
            .nameRegex("^my-SnapshotGroup")
            .build());
        ctx.export("ecsSnapshotGroupId2", nameRegex.groups()[0].id());
        final var status = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
            .status("accomplished")
            .build());
        ctx.export("ecsSnapshotGroupId3", status.groups()[0].id());
        final var instanceId = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
            .instanceId("example-instance_id")
            .build());
        ctx.export("ecsSnapshotGroupId4", instanceId.groups()[0].id());
    }
}
variables:
  ids:
    fn::invoke:
      function: alicloud:ecs:getEcsSnapshotGroups
      arguments:
        ids:
          - example-id
  nameRegex:
    fn::invoke:
      function: alicloud:ecs:getEcsSnapshotGroups
      arguments:
        nameRegex: ^my-SnapshotGroup
  status:
    fn::invoke:
      function: alicloud:ecs:getEcsSnapshotGroups
      arguments:
        status: accomplished
  instanceId:
    fn::invoke:
      function: alicloud:ecs:getEcsSnapshotGroups
      arguments:
        instanceId: example-instance_id
outputs:
  ecsSnapshotGroupId1: ${ids.groups[0].id}
  ecsSnapshotGroupId2: ${nameRegex.groups[0].id}
  ecsSnapshotGroupId3: ${status.groups[0].id}
  ecsSnapshotGroupId4: ${instanceId.groups[0].id}
Using getEcsSnapshotGroups
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 getEcsSnapshotGroups(args: GetEcsSnapshotGroupsArgs, opts?: InvokeOptions): Promise<GetEcsSnapshotGroupsResult>
function getEcsSnapshotGroupsOutput(args: GetEcsSnapshotGroupsOutputArgs, opts?: InvokeOptions): Output<GetEcsSnapshotGroupsResult>def get_ecs_snapshot_groups(ids: Optional[Sequence[str]] = None,
                            instance_id: Optional[str] = None,
                            name_regex: Optional[str] = None,
                            output_file: Optional[str] = None,
                            snapshot_group_name: Optional[str] = None,
                            status: Optional[str] = None,
                            tags: Optional[Mapping[str, str]] = None,
                            opts: Optional[InvokeOptions] = None) -> GetEcsSnapshotGroupsResult
def get_ecs_snapshot_groups_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                            instance_id: Optional[pulumi.Input[str]] = None,
                            name_regex: Optional[pulumi.Input[str]] = None,
                            output_file: Optional[pulumi.Input[str]] = None,
                            snapshot_group_name: Optional[pulumi.Input[str]] = None,
                            status: Optional[pulumi.Input[str]] = None,
                            tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetEcsSnapshotGroupsResult]func GetEcsSnapshotGroups(ctx *Context, args *GetEcsSnapshotGroupsArgs, opts ...InvokeOption) (*GetEcsSnapshotGroupsResult, error)
func GetEcsSnapshotGroupsOutput(ctx *Context, args *GetEcsSnapshotGroupsOutputArgs, opts ...InvokeOption) GetEcsSnapshotGroupsResultOutput> Note: This function is named GetEcsSnapshotGroups in the Go SDK.
public static class GetEcsSnapshotGroups 
{
    public static Task<GetEcsSnapshotGroupsResult> InvokeAsync(GetEcsSnapshotGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetEcsSnapshotGroupsResult> Invoke(GetEcsSnapshotGroupsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetEcsSnapshotGroupsResult> getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs args, InvokeOptions options)
public static Output<GetEcsSnapshotGroupsResult> getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:ecs/getEcsSnapshotGroups:getEcsSnapshotGroups
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Ids List<string>
- A list of Snapshot Group IDs.
- InstanceId string
- The ID of the instance.
- NameRegex string
- A regex string to filter results by Snapshot Group name.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- SnapshotGroup stringName 
- The name of the snapshot-consistent group.
- Status string
- The state of snapshot-consistent group. Valid Values: accomplished,failedandprogressing.
- Dictionary<string, string>
- A mapping of tags to assign to the snapshot group.
- Ids []string
- A list of Snapshot Group IDs.
- InstanceId string
- The ID of the instance.
- NameRegex string
- A regex string to filter results by Snapshot Group name.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- SnapshotGroup stringName 
- The name of the snapshot-consistent group.
- Status string
- The state of snapshot-consistent group. Valid Values: accomplished,failedandprogressing.
- map[string]string
- A mapping of tags to assign to the snapshot group.
- ids List<String>
- A list of Snapshot Group IDs.
- instanceId String
- The ID of the instance.
- nameRegex String
- A regex string to filter results by Snapshot Group name.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- snapshotGroup StringName 
- The name of the snapshot-consistent group.
- status String
- The state of snapshot-consistent group. Valid Values: accomplished,failedandprogressing.
- Map<String,String>
- A mapping of tags to assign to the snapshot group.
- ids string[]
- A list of Snapshot Group IDs.
- instanceId string
- The ID of the instance.
- nameRegex string
- A regex string to filter results by Snapshot Group name.
- outputFile string
- File name where to save data source results (after running pulumi preview).
- snapshotGroup stringName 
- The name of the snapshot-consistent group.
- status string
- The state of snapshot-consistent group. Valid Values: accomplished,failedandprogressing.
- {[key: string]: string}
- A mapping of tags to assign to the snapshot group.
- ids Sequence[str]
- A list of Snapshot Group IDs.
- instance_id str
- The ID of the instance.
- name_regex str
- A regex string to filter results by Snapshot Group name.
- output_file str
- File name where to save data source results (after running pulumi preview).
- snapshot_group_ strname 
- The name of the snapshot-consistent group.
- status str
- The state of snapshot-consistent group. Valid Values: accomplished,failedandprogressing.
- Mapping[str, str]
- A mapping of tags to assign to the snapshot group.
- ids List<String>
- A list of Snapshot Group IDs.
- instanceId String
- The ID of the instance.
- nameRegex String
- A regex string to filter results by Snapshot Group name.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- snapshotGroup StringName 
- The name of the snapshot-consistent group.
- status String
- The state of snapshot-consistent group. Valid Values: accomplished,failedandprogressing.
- Map<String>
- A mapping of tags to assign to the snapshot group.
getEcsSnapshotGroups Result
The following output properties are available:
- Groups
List<Pulumi.Ali Cloud. Ecs. Outputs. Get Ecs Snapshot Groups Group> 
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- InstanceId string
- NameRegex string
- OutputFile string
- SnapshotGroup stringName 
- Status string
- Dictionary<string, string>
- Groups
[]GetEcs Snapshot Groups Group 
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- InstanceId string
- NameRegex string
- OutputFile string
- SnapshotGroup stringName 
- Status string
- map[string]string
- groups
List<GetEcs Snapshot Groups Group> 
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- instanceId String
- nameRegex String
- outputFile String
- snapshotGroup StringName 
- status String
- Map<String,String>
- groups
GetEcs Snapshot Groups Group[] 
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- instanceId string
- nameRegex string
- outputFile string
- snapshotGroup stringName 
- status string
- {[key: string]: string}
- groups
Sequence[GetEcs Snapshot Groups Group] 
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- instance_id str
- name_regex str
- output_file str
- snapshot_group_ strname 
- status str
- Mapping[str, str]
- groups List<Property Map>
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- instanceId String
- nameRegex String
- outputFile String
- snapshotGroup StringName 
- status String
- Map<String>
Supporting Types
GetEcsSnapshotGroupsGroup    
- Description string
- The description of the snapshot-consistent group.
- Id string
- The ID of the Snapshot Group.
- InstanceId string
- The ID of the instance.
- ResourceGroup stringId 
- The ID of the resource group to which the snapshot consistency group belongs.
- SnapshotGroup stringId 
- The first ID of the resource.
- SnapshotGroup stringName 
- The name of the snapshot-consistent group.
- Status string
- The status of the resource.
- Dictionary<string, string>
- List of label key-value pairs.
- Description string
- The description of the snapshot-consistent group.
- Id string
- The ID of the Snapshot Group.
- InstanceId string
- The ID of the instance.
- ResourceGroup stringId 
- The ID of the resource group to which the snapshot consistency group belongs.
- SnapshotGroup stringId 
- The first ID of the resource.
- SnapshotGroup stringName 
- The name of the snapshot-consistent group.
- Status string
- The status of the resource.
- map[string]string
- List of label key-value pairs.
- description String
- The description of the snapshot-consistent group.
- id String
- The ID of the Snapshot Group.
- instanceId String
- The ID of the instance.
- resourceGroup StringId 
- The ID of the resource group to which the snapshot consistency group belongs.
- snapshotGroup StringId 
- The first ID of the resource.
- snapshotGroup StringName 
- The name of the snapshot-consistent group.
- status String
- The status of the resource.
- Map<String,String>
- List of label key-value pairs.
- description string
- The description of the snapshot-consistent group.
- id string
- The ID of the Snapshot Group.
- instanceId string
- The ID of the instance.
- resourceGroup stringId 
- The ID of the resource group to which the snapshot consistency group belongs.
- snapshotGroup stringId 
- The first ID of the resource.
- snapshotGroup stringName 
- The name of the snapshot-consistent group.
- status string
- The status of the resource.
- {[key: string]: string}
- List of label key-value pairs.
- description str
- The description of the snapshot-consistent group.
- id str
- The ID of the Snapshot Group.
- instance_id str
- The ID of the instance.
- resource_group_ strid 
- The ID of the resource group to which the snapshot consistency group belongs.
- snapshot_group_ strid 
- The first ID of the resource.
- snapshot_group_ strname 
- The name of the snapshot-consistent group.
- status str
- The status of the resource.
- Mapping[str, str]
- List of label key-value pairs.
- description String
- The description of the snapshot-consistent group.
- id String
- The ID of the Snapshot Group.
- instanceId String
- The ID of the instance.
- resourceGroup StringId 
- The ID of the resource group to which the snapshot consistency group belongs.
- snapshotGroup StringId 
- The first ID of the resource.
- snapshotGroup StringName 
- The name of the snapshot-consistent group.
- status String
- The status of the resource.
- Map<String>
- List of label key-value pairs.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the alicloudTerraform Provider.
