全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-CreateImage

更新时间:Dec 21, 2025

Nama Template

ACS-ECS-CreateImage

Jalankan Sekarang

Deskripsi Template

Membuat custom image dari instance Elastic Compute Service (ECS) yang sudah ada. Template ini berguna untuk skenario seperti pencadangan instance dan migrasi sistem. Saat konfigurasi, Anda harus menyediakan parameter yang diperlukan berikut: regionId untuk menentukan wilayah instance ECS sumber, instanceId untuk mengidentifikasi instance sumber, dan imageName untuk menetapkan nama image baru. Anda juga dapat menggunakan parameter whetherOnlySystemDisk untuk menentukan apakah image hanya akan dibuat dari disk sistem. Setelah image dibuat, template akan mengembalikan ID image tersebut.

Tipe Template

Otomatis

Pemilik

Alibaba Cloud

Parameter Masukan

Parameter

Deskripsi

Tipe

Diperlukan

Nilai Default

Batasan

instanceId

ID dari Instance ECS.

String

Ya

imageName

Nama dari citra yang akan dibuat.

String

Ya

regionId

ID wilayah.

String

Tidak

{{ ACS::RegionId }}

tags

Tag dari citra.

Json

Tidak

[]

imageFamily

Keluarga gambar.

String

Tidak

False

imageDescription

Deskripsi citra.

String

Tidak

""

resourceGroupId

ID kelompok sumber daya.

String

Tidak

""

detectionStrategy

Strategi deteksi citra.

String

Tidak

""

whetherOnlySystemDisk

Apakah akan membuat citra hanya dari sistem disk.

Boolean

Tidak

False

OOSAssumeRole

Peran RAM yang diasumsikan oleh OOS.

String

Tidak

""

Parameter Keluaran

Parameter

Deskripsi

Tipe

imageId

String

Kebijakan Izin yang Diperlukan untuk Menjalankan Template

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

Detail

Untuk informasi lebih lanjut, lihat ACS-ECS-CreateImage.yml di GitHub.

Konten Template

Catatan:

Harus terdiri dari 2 hingga 128 karakter.

Harus diawali dengan huruf besar atau kecil. Tidak boleh diawali dengan http:// atau https://.

Dapat berisi angka, tanda titik dua (:), garis bawah (_), dan tanda hubung (-).

Catatan:

Harus terdiri dari 2 hingga 128 karakter.

Harus diawali dengan huruf atau karakter Tionghoa. Tidak boleh diawali dengan http:// atau https://.

Dapat berisi angka, tanda titik dua (:), garis bawah (_), dan tanda hubung (-).
<p>Catatan:</p><ul> <li>Harus terdiri dari 2 hingga 128 karakter.</li> <li><font>Harus dimulai dengan huruf besar atau kecil. Tidak boleh dimulai dengan http:// atau https://.</font></li> <li>Dapat berisi angka, titik dua (:), garis bawah (_), dan tanda hubung (-).</li> </ul><p>Catatan:</p><ul> <li>Harus terdiri dari 2 hingga 128 karakter.</li> <li><font>Harus dimulai dengan huruf atau karakter Tionghoa. Tidak boleh dimulai dengan http:// atau https://.</font></li> <li>Dapat berisi angka, titik dua (:), garis bawah (_), dan tanda hubung (-).</li> </ul>FormatVersion: OOS-2019-06-01
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