1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. ecs
  6. getAutoSnapshotPolicies
Viewing docs for Alibaba Cloud v4.0.1
published on Tuesday, Oct 27, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v4.0.1
published on Tuesday, Oct 27, 2026 by Pulumi

    This data source provides the Ecs Auto Snapshot Policies of the current Alibaba Cloud user.

    NOTE: Available since v1.117.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = alicloud.ecs.getAutoSnapshotPolicies({
        ids: ["sp-bp14e66xxxxxxxx"],
        nameRegex: "tf-testAcc",
    });
    export const firstEcsAutoSnapshotPolicyId = example.then(example => example.policies?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    example = alicloud.ecs.get_auto_snapshot_policies(ids=["sp-bp14e66xxxxxxxx"],
        name_regex="tf-testAcc")
    pulumi.export("firstEcsAutoSnapshotPolicyId", example.policies[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ecs.GetAutoSnapshotPolicies(ctx, &ecs.GetAutoSnapshotPoliciesArgs{
    			Ids: []string{
    				"sp-bp14e66xxxxxxxx",
    			},
    			NameRegex: pulumi.StringRef("tf-testAcc"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstEcsAutoSnapshotPolicyId", example.Policies[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.GetAutoSnapshotPolicies.Invoke(new()
        {
            Ids = new[]
            {
                "sp-bp14e66xxxxxxxx",
            },
            NameRegex = "tf-testAcc",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstEcsAutoSnapshotPolicyId"] = example.Apply(getAutoSnapshotPoliciesResult => getAutoSnapshotPoliciesResult.Policies[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.GetAutoSnapshotPoliciesArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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.getAutoSnapshotPolicies(GetAutoSnapshotPoliciesArgs.builder()
                .ids("sp-bp14e66xxxxxxxx")
                .nameRegex("tf-testAcc")
                .build());
    
            ctx.export("firstEcsAutoSnapshotPolicyId", example.policies()[0].id());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: alicloud:ecs:getAutoSnapshotPolicies
          arguments:
            ids:
              - sp-bp14e66xxxxxxxx
            nameRegex: tf-testAcc
    outputs:
      firstEcsAutoSnapshotPolicyId: ${example.policies[0].id}
    
    terraform {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_ecs_auto_snapshot_policies" "example" {
      ids        = ["sp-bp14e66xxxxxxxx"]
      name_regex = "tf-testAcc"
    }
    
    output "firstEcsAutoSnapshotPolicyId" {
      value = data.alicloud_ecs_auto_snapshot_policies.example.policies[0].id
    }
    

    Using getAutoSnapshotPolicies

    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 getAutoSnapshotPolicies(args: GetAutoSnapshotPoliciesArgs, opts?: InvokeOptions): Promise<GetAutoSnapshotPoliciesResult>
    function getAutoSnapshotPoliciesOutput(args: GetAutoSnapshotPoliciesOutputArgs, opts?: InvokeOutputOptions): Output<GetAutoSnapshotPoliciesResult>
    def get_auto_snapshot_policies(ids: Optional[Sequence[str]] = None,
                                   name_regex: Optional[str] = None,
                                   output_file: Optional[str] = None,
                                   status: Optional[str] = None,
                                   tags: Optional[Mapping[str, str]] = None,
                                   opts: Optional[InvokeOptions] = None) -> GetAutoSnapshotPoliciesResult
    def get_auto_snapshot_policies_output(ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                                   name_regex: pulumi.Input[Optional[str]] = None,
                                   output_file: pulumi.Input[Optional[str]] = None,
                                   status: pulumi.Input[Optional[str]] = None,
                                   tags: pulumi.Input[Optional[Mapping[str, pulumi.Input[str]]]] = None,
                                   opts: Optional[InvokeOutputOptions] = None) -> Output[GetAutoSnapshotPoliciesResult]
    func GetAutoSnapshotPolicies(ctx *Context, args *GetAutoSnapshotPoliciesArgs, opts ...InvokeOption) (*GetAutoSnapshotPoliciesResult, error)
    func GetAutoSnapshotPoliciesOutput(ctx *Context, args *GetAutoSnapshotPoliciesOutputArgs, opts ...InvokeOption) GetAutoSnapshotPoliciesResultOutput

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

    public static class GetAutoSnapshotPolicies 
    {
        public static Task<GetAutoSnapshotPoliciesResult> InvokeAsync(GetAutoSnapshotPoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetAutoSnapshotPoliciesResult> Invoke(GetAutoSnapshotPoliciesInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetAutoSnapshotPoliciesResult> Invoke(GetAutoSnapshotPoliciesInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetAutoSnapshotPoliciesResult> getAutoSnapshotPolicies(GetAutoSnapshotPoliciesArgs args, InvokeOptions options)
    public static Output<GetAutoSnapshotPoliciesResult> getAutoSnapshotPolicies(GetAutoSnapshotPoliciesArgs args, InvokeOptions options)
    public static Output<GetAutoSnapshotPoliciesResult> getAutoSnapshotPolicies(GetAutoSnapshotPoliciesArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: alicloud:ecs/getAutoSnapshotPolicies:getAutoSnapshotPolicies
      arguments:
        # arguments dictionary
    data "alicloud_ecs_get_auto_snapshot_policies" "name" {
        # arguments
    }

    The following arguments are supported:

    Ids List<string>
    A list of Auto Snapshot Policy IDs.
    NameRegex string
    A regex string to filter results by Auto Snapshot Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Ids []string
    A list of Auto Snapshot Policy IDs.
    NameRegex string
    A regex string to filter results by Auto Snapshot Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    ids list(string)
    A list of Auto Snapshot Policy IDs.
    name_regex string
    A regex string to filter results by Auto Snapshot Policy name.
    output_file string
    File name where to save data source results (after running pulumi preview).
    status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags map(string)
    A mapping of tags to assign to the resource.
    ids List<String>
    A list of Auto Snapshot Policy IDs.
    nameRegex String
    A regex string to filter results by Auto Snapshot Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    ids string[]
    A list of Auto Snapshot Policy IDs.
    nameRegex string
    A regex string to filter results by Auto Snapshot Policy name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    ids Sequence[str]
    A list of Auto Snapshot Policy IDs.
    name_regex str
    A regex string to filter results by Auto Snapshot Policy name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    status str
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    ids List<String>
    A list of Auto Snapshot Policy IDs.
    nameRegex String
    A regex string to filter results by Auto Snapshot Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags Map<String>
    A mapping of tags to assign to the resource.

    getAutoSnapshotPolicies 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 Auto Snapshot Policy names.
    Policies List<Pulumi.AliCloud.Ecs.Outputs.GetAutoSnapshotPoliciesPolicy>
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    NameRegex string
    OutputFile string
    Status string
    The status of Auto Snapshot Policy.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    A list of Auto Snapshot Policy names.
    Policies []GetAutoSnapshotPoliciesPolicy
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    NameRegex string
    OutputFile string
    Status string
    The status of Auto Snapshot Policy.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    ids list(string)
    names list(string)
    A list of Auto Snapshot Policy names.
    policies list(object)
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    name_regex string
    output_file string
    status string
    The status of Auto Snapshot Policy.
    tags map(string)
    A mapping of tags to assign to the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Auto Snapshot Policy names.
    policies List<GetAutoSnapshotPoliciesPolicy>
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    nameRegex String
    outputFile String
    status String
    The status of Auto Snapshot Policy.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    A list of Auto Snapshot Policy names.
    policies GetAutoSnapshotPoliciesPolicy[]
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    nameRegex string
    outputFile string
    status string
    The status of Auto Snapshot Policy.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    A list of Auto Snapshot Policy names.
    policies Sequence[GetAutoSnapshotPoliciesPolicy]
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    name_regex str
    output_file str
    status str
    The status of Auto Snapshot Policy.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Auto Snapshot Policy names.
    policies List<Property Map>
    A list of Ecs Auto Snapshot Policies. Each element contains the following attributes:
    nameRegex String
    outputFile String
    status String
    The status of Auto Snapshot Policy.
    tags Map<String>
    A mapping of tags to assign to the resource.

    Supporting Types

    GetAutoSnapshotPoliciesPolicy

    AssociationType string
    The association type between the automatic snapshot policy and target resources.
    AutoSnapshotPolicyId string
    The ID of the Auto Snapshot Policy.
    AutoSnapshotPolicyName string
    The name of the automatic snapshot policy.
    CopiedSnapshotsRetentionDays int
    The retention period of the snapshot copied across regions.
    CreateTime string
    The time when the automatic snapshot policy was created.
    DiskNums int
    The number of disks to which the automatic snapshot policy is applied.
    EnableCrossRegionCopy bool
    Specifies whether to enable the system to automatically copy snapshots across regions.
    Id string
    The ID of the Auto Snapshot Policy.
    RecordTotal int
    The total number of records.
    RegionId string
    The region ID of the automatic snapshot policy.
    RepeatWeekdays List<string>
    The automatic snapshot repetition dates.
    RetentionDays int
    The snapshot retention time, and the unit of measurement is day.
    Status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    TargetCopyRegions List<string>
    The destination region to which the snapshot is copied.
    TargetTags List<Pulumi.AliCloud.Ecs.Inputs.GetAutoSnapshotPoliciesPolicyTargetTag>
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    TimePoints List<string>
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    VolumeNums int
    The number of extended volumes on which this policy is enabled.
    AssociationType string
    The association type between the automatic snapshot policy and target resources.
    AutoSnapshotPolicyId string
    The ID of the Auto Snapshot Policy.
    AutoSnapshotPolicyName string
    The name of the automatic snapshot policy.
    CopiedSnapshotsRetentionDays int
    The retention period of the snapshot copied across regions.
    CreateTime string
    The time when the automatic snapshot policy was created.
    DiskNums int
    The number of disks to which the automatic snapshot policy is applied.
    EnableCrossRegionCopy bool
    Specifies whether to enable the system to automatically copy snapshots across regions.
    Id string
    The ID of the Auto Snapshot Policy.
    RecordTotal int
    The total number of records.
    RegionId string
    The region ID of the automatic snapshot policy.
    RepeatWeekdays []string
    The automatic snapshot repetition dates.
    RetentionDays int
    The snapshot retention time, and the unit of measurement is day.
    Status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    TargetCopyRegions []string
    The destination region to which the snapshot is copied.
    TargetTags []GetAutoSnapshotPoliciesPolicyTargetTag
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    TimePoints []string
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    VolumeNums int
    The number of extended volumes on which this policy is enabled.
    association_type string
    The association type between the automatic snapshot policy and target resources.
    auto_snapshot_policy_id string
    The ID of the Auto Snapshot Policy.
    auto_snapshot_policy_name string
    The name of the automatic snapshot policy.
    copied_snapshots_retention_days number
    The retention period of the snapshot copied across regions.
    create_time string
    The time when the automatic snapshot policy was created.
    disk_nums number
    The number of disks to which the automatic snapshot policy is applied.
    enable_cross_region_copy bool
    Specifies whether to enable the system to automatically copy snapshots across regions.
    id string
    The ID of the Auto Snapshot Policy.
    record_total number
    The total number of records.
    region_id string
    The region ID of the automatic snapshot policy.
    repeat_weekdays list(string)
    The automatic snapshot repetition dates.
    retention_days number
    The snapshot retention time, and the unit of measurement is day.
    status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags map(string)
    A mapping of tags to assign to the resource.
    target_copy_regions list(string)
    The destination region to which the snapshot is copied.
    target_tags list(object)
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    time_points list(string)
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    volume_nums number
    The number of extended volumes on which this policy is enabled.
    associationType String
    The association type between the automatic snapshot policy and target resources.
    autoSnapshotPolicyId String
    The ID of the Auto Snapshot Policy.
    autoSnapshotPolicyName String
    The name of the automatic snapshot policy.
    copiedSnapshotsRetentionDays Integer
    The retention period of the snapshot copied across regions.
    createTime String
    The time when the automatic snapshot policy was created.
    diskNums Integer
    The number of disks to which the automatic snapshot policy is applied.
    enableCrossRegionCopy Boolean
    Specifies whether to enable the system to automatically copy snapshots across regions.
    id String
    The ID of the Auto Snapshot Policy.
    recordTotal Integer
    The total number of records.
    regionId String
    The region ID of the automatic snapshot policy.
    repeatWeekdays List<String>
    The automatic snapshot repetition dates.
    retentionDays Integer
    The snapshot retention time, and the unit of measurement is day.
    status String
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    targetCopyRegions List<String>
    The destination region to which the snapshot is copied.
    targetTags List<GetAutoSnapshotPoliciesPolicyTargetTag>
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    timePoints List<String>
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    volumeNums Integer
    The number of extended volumes on which this policy is enabled.
    associationType string
    The association type between the automatic snapshot policy and target resources.
    autoSnapshotPolicyId string
    The ID of the Auto Snapshot Policy.
    autoSnapshotPolicyName string
    The name of the automatic snapshot policy.
    copiedSnapshotsRetentionDays number
    The retention period of the snapshot copied across regions.
    createTime string
    The time when the automatic snapshot policy was created.
    diskNums number
    The number of disks to which the automatic snapshot policy is applied.
    enableCrossRegionCopy boolean
    Specifies whether to enable the system to automatically copy snapshots across regions.
    id string
    The ID of the Auto Snapshot Policy.
    recordTotal number
    The total number of records.
    regionId string
    The region ID of the automatic snapshot policy.
    repeatWeekdays string[]
    The automatic snapshot repetition dates.
    retentionDays number
    The snapshot retention time, and the unit of measurement is day.
    status string
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    targetCopyRegions string[]
    The destination region to which the snapshot is copied.
    targetTags GetAutoSnapshotPoliciesPolicyTargetTag[]
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    timePoints string[]
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    volumeNums number
    The number of extended volumes on which this policy is enabled.
    association_type str
    The association type between the automatic snapshot policy and target resources.
    auto_snapshot_policy_id str
    The ID of the Auto Snapshot Policy.
    auto_snapshot_policy_name str
    The name of the automatic snapshot policy.
    copied_snapshots_retention_days int
    The retention period of the snapshot copied across regions.
    create_time str
    The time when the automatic snapshot policy was created.
    disk_nums int
    The number of disks to which the automatic snapshot policy is applied.
    enable_cross_region_copy bool
    Specifies whether to enable the system to automatically copy snapshots across regions.
    id str
    The ID of the Auto Snapshot Policy.
    record_total int
    The total number of records.
    region_id str
    The region ID of the automatic snapshot policy.
    repeat_weekdays Sequence[str]
    The automatic snapshot repetition dates.
    retention_days int
    The snapshot retention time, and the unit of measurement is day.
    status str
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    target_copy_regions Sequence[str]
    The destination region to which the snapshot is copied.
    target_tags Sequence[GetAutoSnapshotPoliciesPolicyTargetTag]
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    time_points Sequence[str]
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    volume_nums int
    The number of extended volumes on which this policy is enabled.
    associationType String
    The association type between the automatic snapshot policy and target resources.
    autoSnapshotPolicyId String
    The ID of the Auto Snapshot Policy.
    autoSnapshotPolicyName String
    The name of the automatic snapshot policy.
    copiedSnapshotsRetentionDays Number
    The retention period of the snapshot copied across regions.
    createTime String
    The time when the automatic snapshot policy was created.
    diskNums Number
    The number of disks to which the automatic snapshot policy is applied.
    enableCrossRegionCopy Boolean
    Specifies whether to enable the system to automatically copy snapshots across regions.
    id String
    The ID of the Auto Snapshot Policy.
    recordTotal Number
    The total number of records.
    regionId String
    The region ID of the automatic snapshot policy.
    repeatWeekdays List<String>
    The automatic snapshot repetition dates.
    retentionDays Number
    The snapshot retention time, and the unit of measurement is day.
    status String
    The status of Auto Snapshot Policy. Valid Values: Expire, Normal.
    tags Map<String>
    A mapping of tags to assign to the resource.
    targetCopyRegions List<String>
    The destination region to which the snapshot is copied.
    targetTags List<Property Map>
    The tags used to associate the automatic snapshot policy with ECS instances. Each element contains the following attributes:
    timePoints List<String>
    The automatic snapshot creation schedule, and the unit of measurement is hour.
    volumeNums Number
    The number of extended volumes on which this policy is enabled.

    GetAutoSnapshotPoliciesPolicyTargetTag

    TagKey string
    The key of the target tag.
    TagValue string
    The value of the target tag.
    TagKey string
    The key of the target tag.
    TagValue string
    The value of the target tag.
    tag_key string
    The key of the target tag.
    tag_value string
    The value of the target tag.
    tagKey String
    The key of the target tag.
    tagValue String
    The value of the target tag.
    tagKey string
    The key of the target tag.
    tagValue string
    The value of the target tag.
    tag_key str
    The key of the target tag.
    tag_value str
    The value of the target tag.
    tagKey String
    The key of the target tag.
    tagValue String
    The value of the target tag.

    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 alicloud logo
    Viewing docs for Alibaba Cloud v4.0.1
    published on Tuesday, Oct 27, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial