すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ACS-ECS-CreateImage

最終更新日:Dec 21, 2025

テンプレート名

ACS-ECS-CreateImage

今すぐ実行

テンプレートの説明

既存の Elastic Compute Service (ECS) インスタンスからカスタムイメージを作成します。このテンプレートは、インスタンスのバックアップやシステムの移行などのシナリオで役立ちます。構成中に、ソース ECS インスタンスのリージョンを指定する `regionId`、ソースインスタンスを識別する `instanceId`、新しいイメージの名前を設定する `imageName` という必須パラメーターを指定する必要があります。`whetherOnlySystemDisk` パラメーターを使用して、システムディスクのみからイメージを作成するかどうかを指定することもできます。イメージが作成されると、テンプレートは新しいイメージの ID を返します。

テンプレート タイプ

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

タイプ

必須

デフォルト値

制限

instanceId

ECS インスタンスの ID。

String

はい

imageName

作成するイメージの名前。

String

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

tags

イメージのタグ。

Json

いいえ

[]

imageFamily

イメージファミリー。

String

いいえ

False

imageDescription

イメージの説明。

String

いいえ

""

resourceGroupId

リソースグループ ID。

String

いいえ

""

detectionStrategy

イメージの検出戦略。

String

いいえ

""

whetherOnlySystemDisk

システムディスクのみからイメージを作成するかどうか。

Boolean

いいえ

False

OOSAssumeRole

OOS が引き受ける RAM ロール。

String

いいえ

""

出力パラメーター

パラメーター

説明

タイプ

imageId

String

テンプレートを実行するために必要な権限ポリシー

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

詳細

詳細については、GitHub の ACS-ECS-CreateImage.yml をご参照ください。

テンプレートの内容

注: 
長さは 2~128 文字である必要があります。 
先頭の文字は、大文字または小文字のアルファベットである必要があります。http:// または https:// で始めることはできません。 
数字、コロン (:)、アンダースコア (_)、ハイフン (-) を使用できます。 
注: 
文字数は 2~128 文字である必要があります。 
先頭は英字または漢字である必要があり、http:// または https:// で始めることはできません。 
数字、コロン (:)、アンダースコア (_)、およびハイフン (-) を含めることができます。 <p>注:</p><ul> <li>長さは 2~128 文字である必要があります。</li> <li><font>先頭は英大文字または英小文字である必要があります。http:// または https:// で始めることはできません。</font></li> <li>数字、コロン (:)、アンダースコア (_)、ハイフン (-) を使用できます。</li> </ul><p>注:</p><ul> <li>長さは 2~128 文字である必要があります。</li> <li><font>先頭は英字または漢字である必要があります。http:// または https:// で始めることはできません。</font></li> <li>数字、コロン (:)、アンダースコア (_)、ハイフン (-) を使用できます。</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.'
  ja: '既存の ECS インスタンスから ECS イメージを作成します。システムのバックアップや移行などのタスクに使用します。リージョン ID、インスタンス ID、イメージ名を指定する必要があります。システムディスクのみからイメージを作成することもできます。作成後、テンプレートは新しいイメージ ID を返します。'
  name-en: Create Image
  name-ja: イメージの作成
  categories:
    - image_manage
    - application_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
      ja: リージョン ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: Instance ID
      ja: ECS インスタンス ID
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  imageName:
    Label:
      en: Image Name
      ja: イメージ名
    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>
      ja: <p>注:</p> <ul> <li>名前は 2~128 文字である必要があります。</li> <li><font>先頭は英字または漢字である必要があります。http:// または https:// で始めることはできません。</font></li> <li>数字、コロン (:)、アンダースコア (_)、ハイフン (-) を使用できます。</li> </ul>
  tags:
    Label:
      en: Tags
      ja: イメージタグ
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  imageFamily:
    Label:
      en: Image Family
      ja: イメージファミリー
    Type: String
    AssociationProperty: ALIYUN::ECS::Image::ImageFamily
    Default: ''
  imageDescription:
    Label:
      en: Image Description
      ja: イメージの説明
    Type: String
    Default: ''
  resourceGroupId:
    Label:
      en: Resource Group ID
      ja: リソースグループ ID
    Type: String
    AssociationProperty: ALIYUN::ECS::ResourceGroup::ResourceGroupId
    Default: ''
  detectionStrategy:
    Label:
      en: Detection Strategy
      ja: イメージの検出戦略
    Type: String
    AllowedValues:
      - Standard
      - ''
    Default: ''
  whetherOnlySystemDisk:
    Label:
      en: Create from System Disk Only
      ja: システムディスクからのみ作成
    Type: Boolean
    Default: false
  OOSAssumeRole:
    Label:
      en: OOS Assume Role
      ja: OOS が引き受ける RAM ロール
    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.
    ja: 指定されたインスタンス ID とイメージ名で新しいイメージを作成します。
  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.
    ja: 指定されたインスタンス ID とイメージ名で新しいシステムディスクイメージを作成します。
  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:
            ja: ECS インスタンスの選択
            en: Select ECS Instance
      - Parameters:
          - imageName
          - tags
          - whetherOnlySystemDisk
          - imageFamily
          - imageDescription
          - resourceGroupId
          - detectionStrategy
        Label:
          default:
            ja: イメージ設定
            en: Image Settings
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            ja: 詳細オプション
            en: Advanced Options