All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ESS-CreateImageAndUpdateScalingConfiguration

Last Updated:Dec 30, 2024

Template name

ACS-ESS-CreateImageAndUpdateScalingConfiguration

Execute Now

Template description

Creates an Elastic Compute Service (ECS) image and updates the image ID in scaling configurations.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

instanceId

The ECS instance ID.

String

Yes

scalingConfigurationIds

The IDs of the scaling configurations to be modified.

List

Yes

targetImageName

The image name.

String

No

CreateImage_from_{{instanceId}}

tags

The image tags.

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

Policy that is required to execute the template

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

References

ACS-ESS-CreateImageAndUpdateScalingConfiguration

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Creates an ECS image and updates scaling configuration image ID
  name-en: ACS-ESS-CreateImageAndUpdateScalingConfiguration
  categories:
    - elastic_manage
Parameters:
  instanceId:
    Label:
      en: InstanceId
    Type: String
  targetImageName:
    Label:
      en: TargetImageName
    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>
    Type: String
    Default: CreateImage_from_{{instanceId}}
  scalingConfigurationIds:
    Label:
      en: ScalingConfigurationIds
    Type: List
  tags:
    Label:
      en: ImageTag
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
    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
  Properties:
    imageName: '{{ targetImageName }}_on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
    instanceId: '{{ instanceId }}'
    tags: '{{tags}}'
  Outputs:
    imageId:
      ValueSelector: imageId
      Type: String
- Name: modifyScalingConfiguration
  Action: ACS::ExecuteAPI
  Description:
    en: Modify scaling configuration
  Properties:
    Service: ESS
    API: ModifyScalingConfiguration
    Parameters:
      ScalingConfigurationId: '{{ ACS::TaskLoopItem }}'
      ImageId: '{{ createImage.imageId }}'
  Loop:
    Items: '{{ scalingConfigurationIds }}'
Outputs:
  imageId:
    Type: String
    Value: '{{ createImage.imageId }}'