テンプレート名
ECS イメージの作成とスケーリング設定の更新
テンプレートの説明
Elastic Compute Service (ECS) イメージを作成し、スケーリング設定の Image ID を更新します。
テンプレートの種類
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | 種類 | 必須 | デフォルト値 | 制限 |
instanceId | ECS インスタンス ID。 | String | はい | ||
scalingConfigurationIds | 変更するスケーリング設定の ID。 | List | はい | ||
targetImageName | イメージ名。 | String | いいえ | CreateImage_from_{{instanceId}} | |
tags | イメージタグ。 | Json | いいえ | [] | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。 | String | いいえ | "" |
出力パラメーター
パラメーター | 説明 | 種類 |
imageId | String |
テンプレートを実行するために必要なポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateImage",
"ecs:DescribeImages",
"ecs:DescribeInstances"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ess:ModifyScalingConfiguration"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
ACS-ESS-CreateImageAndUpdateScalingConfiguration
テンプレートコンテンツ
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 }}'