All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-InheritDiskTagToSnapshot

Last Updated:Dec 23, 2025

Template name

ACS-ECS-InheritDiskTagToSnapshot Inherits tags from all disks to their snapshots in a specific region.

Execute Now

Template description

This template inherits specified tags from disks to their corresponding snapshots in a specified region.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

tagKeys

The tag keys to be inherited.

List

Yes

OOSAssumeRole

The RAM role for Operation Orchestration Service (OOS) to assume.

String

Yes

regionId

Region

String

No

{{ ACS::RegionId }}

isUpdate

Overwriting tag values

Boolean

No

False

rateControl

Concurrent Task Execution Rate

Json

No

{'Mode': 'Concurrency', 'MaxErrors': 100, 'Concurrency': 10}

Output parameters

None

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeDisks",
                "ecs:DescribeSnapshots",
                "ecs:TagResources"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Details

For more information, see ACS-ECS-InheritDiskTagToSnapshot.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  name-en: ACS-ECS-InheritDiskTagToSnapshot 
  name-zh-cn: Inherits all disk tags in a region to snapshots
  en: All snapshots in the specified region inherit the specified tag on the corresponding disk.
  zh-cn: All snapshots in a specified region inherit the specified tags from their corresponding disks.
  categories:
    - tag_manage
Parameters:
  regionId:
    Type: String
    Description:
      en: The id of region
      zh-cn: The ID of the region
    Label:
      en: Region
      zh-cn: Region
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  tagKeys:
    Type: List
    Description:
      en: The list of tag key
      zh-cn: The collection of tag keys
    Label:
      en: TagKeys
      zh-cn: List of tag keys to inherit
  isUpdate:
    Type: Boolean
    Label:
      en: IsUpdate
      zh-cn: Overwrite tag value
    Description:
      en: Whether to overwrite the tag value if the tag key is the same
      zh-cn: If a tag with the same key exists, specifies whether to overwrite the tag value
    Default: false
  rateControl:
    Label:
      en: RateControl
      zh-cn: Concurrency rate for task execution
    Description: 
      en: Concurrency rate of task execution
      zh-cn: Concurrency rate of task execution
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 100
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role for OOS to assume
    Description:
      name-en: The RAM role to be assumed by OOS.
      name-zh-cn: The RAM role for OOS to assume.
    Type: String
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getDisks
    Action: ACS::ExecuteAPI
    Description: 
      en: Query the disk information
      zh-cn: Queries disk information
    Properties:
      Service: ECS
      API: DescribeDisks
      Parameters:
        RegionId: '{{ regionId }}'
    Outputs:
      disks:
        Type: List
        ValueSelector: .Disks.Disk[].DiskId
  - Name: tagSnapshot
    Action: ACS::ECS::InheritDiskTagToSnapshot
    Description: 
      en: Inherit the specified disk tags to snapshots
      zh-cn: Inherits tags from the specified disk to its snapshots
    Properties:
      regionId: '{{ regionId }}'
      diskId: '{{ACS::TaskLoopItem}}'
      tagKeys: '{{tagKeys}}'
      isUpdate: '{{isUpdate}}'
      rateControl: '{{rateControl}}'
    Loop:
      RateControl: '{{rateControl}}'
      Items: '{{getDisks.disks}}'
      Outputs:
        tagResult:
          AggregateType: Fn::ListJoin
          AggregateField: reqResult