All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-CreateImage

Last Updated:Dec 17, 2024

Template name

ACS-ECS-CreateImage

Run Now

Template description

Creates an Elastic Compute Service (ECS) image.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

instanceId

The ID of the ECS instance.

String

Yes

imageName

The name of the image to be created.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

tags

The tags of the image.

Json

No

[]

OOSAssumeRole

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

String

No

""

Output parameters

Parameter

Description

Type

imageId

String

Permission policy that is required to execute the template

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

References

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

Template content

FormatVersion: OOS-2019-06-01
Description:
  en:  Creates an ECS image
  zh-cn: the description in Chinese
  name-en: Create 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 }}'
  instanceId:
    Label:
      en: InstanceId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  imageName:
    Label:
      en: ImageName
      zh-cn: the description in Chinese
    Type: String
    Description:
      en: <p class="p">Note:</p> <ul class="ul"> <li class="li">Length is 2~128 English or Chinese characters</li> <li class="li"><font color='red'>must start with big or small letters or Chinese, not http:// and https://. </font></li> <li class="li">Can contain numbers, colons (:), underscores (_), or dashes (-). </li> </ul>
      zh-cn: the description in Chinese  </li> </ul>
  tags:
    Label:
      en: Tags
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: createImage
  Action: ACS::ECS::CreateImage
  Description:
    en: Create new image with the specified image name and instance ID
    zh-cn: the description in Chinese
  Properties:
    regionId: '{{ regionId }}'
    imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
    instanceId: '{{ instanceId }}'
    tags: '{{tags}}'
  Outputs:
    imageId:
      ValueSelector: imageId
      Type: String
Outputs:
  imageId:
    Type: String
    Value: '{{ createImage.imageId }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - instanceId
        Label:
          default:
            zh-cn: the description in Chinese
            en: Select Ecs Instances
      - Parameters:
          - imageName
          - tags
        Label:
          default:
            zh-cn: the description in Chinese
            en: Image Configure
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options