All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-DeleteImage

Last Updated:Jan 06, 2025

Template name

ACS-ECS-DeleteImage

Execute Now

Template description

Deletes an Elastic Compute Service (ECS) image. This applies to scenarios in which you want to delete custom images to free up disk space. When you configure this template, you must specify the following parameters: regionId: the region of the image to be deleted, imageId: the ID of the image, and force: specifies whether to perform forceful deletion. After the template is executed, the image will be deleted.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

imageId

The image ID.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

force

Specifies whether to forcefully delete the ECS image.

Boolean

No

False

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

""

Output parameters

None

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DeleteImage",
                "ecs:DescribeImageSharePermission",
                "ecs:ModifyImageSharePermission"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

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

Template content

FormatVersion: OOS-2019-06-01
Description:
  en:  'Deletes an ECS image, applicable to freeing up storage space by removing custom images that are no longer needed. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS image to be deleted, and Image ID (imageId), which identifies the image to be deleted. Additionally, users can choose whether to enforce the deletion (force). Upon execution, the template will confirm the deletion of the specified ECS image.'
  zh-cn: the description in Chinese
  name-en: Delete Image
  name-zh-cn: the description in Chinese
  categories:
    - image_manage
    - application_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  imageId:
    Label:
      en: ImageId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
    AssociationPropertyMetadata:
      RegionId: regionId
      SupportedImageOwnerAlias:
        - self
  force:
    Label:
      en: Force
      zh-cn: the description in Chinese
    Type: Boolean
    Default: false
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: deleteImage
  Action: ACS::ECS::DeleteImage
  Description:
    en: Deletes the specified ECS image
    zh-cn: the description in Chinese
  Properties:
    regionId: '{{ regionId }}'
    imageId: '{{ imageId }}'
    force: '{{ force }}'
  Outputs:
    imageId:
      ValueSelector: imageId
      Type: String
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - imageId
          - force
        Label:
          default:
            zh-cn: the description in Chinese
            en: Select Image
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options