Todos los productos
Search
Centro de documentos

CloudOps Orchestration Service:ACS-ECS-CreateImage

Última actualización: Sep 05, 2026

Nombre de la plantilla

ACS-ECS-CreateImage

Ejecutar ahora

Descripción de la plantilla

Crea una imagen personalizada a partir de una instancia existente de Elastic Compute Service (ECS) para crear una copia de seguridad de la instancia o migrar el sistema. Debe especificar el ID de región, el ID de instancia y el nombre de la imagen. Opcionalmente, establezca whetherOnlySystemDisk para crear una imagen solo del disco del sistema. Después de crear la imagen, la plantilla devuelve el ID de la nueva imagen.

Tipo de plantilla

Automatizada

Propietario

Alibaba Cloud

Parámetros de entrada

Parámetro

Descripción

Tipo

Obligatorio

Valor predeterminado

Límite

instanceId

El ID de la instancia ECS.

String

Sí

imageName

El nombre de la nueva imagen.

String

Sí

regionId

El ID de región.

String

No

{{ ACS::RegionId }}

tags

Las etiquetas de la imagen.

Json

No

[]

imageFamily

La familia de imágenes.

String

No

False

imageDescription

La descripción de la imagen.

String

No

""

resourceGroupId

El ID del resource group.

String

No

""

detectionStrategy

La estrategia de detección de imágenes.

String

No

""

whetherOnlySystemDisk

Especifica si se debe crear una imagen únicamente del disco del sistema.

Boolean

No

False

OOSAssumeRole

El rol RAM que asume OOS.

String

No

""

Parámetros de salida

Parámetro

Descripción

Tipo

imageId

String

Directiva de permisos necesaria para ejecutar la plantilla

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateImage",
                "ecs:CreateSnapshot",
                "ecs:DescribeDisks",
                "ecs:DescribeImages",
                "ecs:DescribeInstances",
                "ecs:DescribeSnapshots"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Detalles

Para obtener más información, consulte ACS-ECS-CreateImage.yml en GitHub.

Contenido de la plantilla

Note:
Description:
  en: 'Creates an ECS image from an existing ECS instance. Use this for tasks such as system backup and migration. You must provide the region ID, instance ID, and image name. You can also choose to create an image from only the system disk. The template returns the new image ID after creation.'
  zh-cn: 'Creates an ECS image from an existing ECS instance. Use this for tasks such as system backup and migration. You must provide the region ID, instance ID, and image name. You can also choose to create an image from only the system disk. The template returns the new image ID after creation.'
  name-en: Create Image
  name-zh-cn: Create Image
  categories:
    - image_manage
    - application_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: Instance ID
      zh-cn: ECS Instance ID
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  imageName:
    Label:
      en: Image Name
      zh-cn: New Image Name
    Type: String
    Description:
      en: <p>Note:</p> <ul> <li>The name must be 2 to 128 characters in length.</li> <li><font>It must start with a letter or a Chinese character. It cannot start with http:// or https://.</font></li> <li>It can contain numbers, colons (:), underscores (_), and hyphens (-).</li> </ul>
      zh-cn: <p>Note:</p> <ul> <li>The name must be 2 to 128 characters in length.</li> <li><font>It must start with a letter or a Chinese character. It cannot start with http:// or https://.</font></li> <li>It can contain numbers, colons (:), underscores (_), and hyphens (-).</li> </ul>
  tags:
    Label:
      en: Tags
      zh-cn: Image Tags
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  imageFamily:
    Label:
      en: Image Family
      zh-cn: Image Family
    Type: String
    AssociationProperty: ALIYUN::ECS::Image::ImageFamily
    Default: ''
  imageDescription:
    Label:
      en: Image Description
      zh-cn: Image Description
    Type: String
    Default: ''
  resourceGroupId:
    Label:
      en: Resource Group ID
      zh-cn: Resource Group ID
    Type: String
    AssociationProperty: ALIYUN::ECS::ResourceGroup::ResourceGroupId
    Default: ''
  detectionStrategy:
    Label:
      en: Detection Strategy
      zh-cn: Image Detection Strategy
    Type: String
    AllowedValues:
      - Standard
      - ''
    Default: ''
  whetherOnlySystemDisk:
    Label:
      en: Create from System Disk Only
      zh-cn: Create from System Disk Only
    Type: Boolean
    Default: false
  OOSAssumeRole:
    Label:
      en: OOS Assume Role
      zh-cn: The RAM role for OOS to assume
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Conditions:
  NotOnlySystemDisk:
    Fn::Equals:
      - '{{ whetherOnlySystemDisk }}'
      - false
  OnlySystemDisk:
    Fn::Equals:
      - '{{ whetherOnlySystemDisk }}'
      - true
Tasks:
- Name: createImage
  Action: ACS::ECS::CreateImage
  Description:
    en: Creates a new image with the specified instance ID and image name.
    zh-cn: Creates a new image with the specified instance ID and image name.
  When: NotOnlySystemDisk
  Properties:
    regionId: '{{ regionId }}'
    imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
    instanceId: '{{ instanceId }}'
    tags: '{{tags}}'
    imageFamily: '{{ imageFamily }}'
    imageDescription: '{{ imageDescription }}'
    resourceGroupId: '{{ resourceGroupId }}'
    detectionStrategy: '{{ detectionStrategy }}'
  Outputs:
    imageId:
      ValueSelector: imageId
      Type: String
- Name: createImageOnlySystemDisk
  Action: ACS::ECS::CreateImageForSystemDisk
  Description:
    en: Creates a new system disk image with the specified instance ID and image name.
    zh-cn: Creates a new system disk image with the specified instance ID and image name.
  When: OnlySystemDisk
  Properties:
    regionId: '{{ regionId }}'
    imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
    instanceId: '{{ instanceId }}'
    tags: '{{tags}}'
    imageFamily: '{{ imageFamily }}'
    imageDescription: '{{ imageDescription }}'
    resourceGroupId: '{{ resourceGroupId }}'
    detectionStrategy: '{{ detectionStrategy }}'
  Outputs:
    imageId:
      ValueSelector: imageId
      Type: String
Outputs:
  imageId:
    Type: String
    Value:
      Fn::If:
        - Fn::Equals:
            - '{{ whetherOnlySystemDisk }}'
            - false
        - '{{ createImage.imageId }}'
        - '{{ createImageOnlySystemDisk.imageId }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - instanceId
        Label:
          default:
            zh-cn: Select ECS Instance
            en: Select ECS Instance
      - Parameters:
          - imageName
          - tags
          - whetherOnlySystemDisk
          - imageFamily
          - imageDescription
          - resourceGroupId
          - detectionStrategy
        Label:
          default:
            zh-cn: Image Settings
            en: Image Settings
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options