模板名稱
ACS-ECS-ModifyInstanceSpec 修改按量付費實例的規格
模板描述
修改按量付費實例的規格
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 默認值 | 約束 |
instanceId | ECS實例ID | String | 是 | ||
modifyInstanceSpecInfo | 用于實例升降配的規格信息 | Json | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
輸出參數
參數名稱 | 描述 | 類型 |
instanceIdAndInstanceType | List |
執行此模板需要的權限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstanceTypes",
"ecs:DescribeInstances",
"ecs:ModifyInstanceSpec",
"ecs:StartInstance",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: Modify postpaid instance's type
zh-cn: 修改按量付費實例的規格
name-en: ACS-ECS-ModifyInstanceSpec
name-zh-cn: 修改按量付費實例的規格
categories:
- instance_manage
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: InstanceId
zh-cn: ECS實例ID
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
modifyInstanceSpecInfo:
Description:
en: 'upgrade:{"ecs.g6.large":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.2xlarge"} downgrade:{"ecs.g6.2xlarge":"ecs.g6.xlarge","ecs.g6.xlarge":"ecs.g6.large"}'
zh-cn: |
升配格式:{"ecs.g6.large":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.2xlarge"}
降配格式:{"ecs.g6.2xlarge":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.large"}
Label:
en: ModifyInstanceSpecInfo
zh-cn: 用于實例升降配的規格信息
Type: Json
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstanceType
Action: 'ACS::ExecuteAPI'
Description:
en: Query instance type
zh-cn: 獲取實例規格信息
Properties:
Service: ECS
API: DescribeInstances
Parameters:
RegionId: '{{ regionId }}'
InstanceIds:
- '{{ instanceId }}'
Outputs:
instanceType:
Type: String
ValueSelector: Instances.Instance[].InstanceType
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: checkForWhetherResourceExist
Action: ACS::Choice
Description:
en: Check whether the resource exist
zh-cn: 檢查資源是否存在
Properties:
DefaultTask: checkForInstanceTypeAvailable
Choices:
- When:
Fn::Equals:
- []
- '{{ getInstanceType.instanceIds }}'
NextTask: ACS::END
- Name: checkForInstanceTypeAvailable
Action: ACS::CheckFor
Description:
en: Check weather the instance type is available
zh-cn: 檢查實例規格是否可用
Properties:
Service: ECS
API: DescribeInstanceTypes
Parameters:
RegionId: '{{ regionId }}'
InstanceTypes:
- Fn::Select:
- '{{ getInstanceType.instanceType }}'
- '{{ modifyInstanceSpecInfo }}'
NotDesiredValues:
- []
PropertySelector: InstanceTypes.InstanceType
- Name: ModifyInstanceSpec
Action: 'ACS::ECS::ModifyInstanceSpec'
Description:
en: Modify instance type
zh-cn: 修改實例規格
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'
instanceType:
'Fn::Select':
- '{{ getInstanceType.instanceType }}'
- '{{ modifyInstanceSpecInfo }}'
- Name: describeInstances
Action: 'ACS::ExecuteAPI'
Description:
en: Query ECS instances info
zh-cn: 獲取ECS實例信息
Properties:
Service: ECS
API: DescribeInstances
Parameters:
RegionId: '{{ regionId }}'
InstanceIds:
- '{{ instanceId }}'
Outputs:
instanceIdAndInstanceType:
Type: List
ValueSelector: 'Instances.Instance[] | {"InstanceId": .InstanceId, "InstanceType" : .InstanceType}'
Outputs:
instanceIdAndInstanceType:
Type: List
Value: '{{ describeInstances.instanceIdAndInstanceType }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- modifyInstanceSpecInfo
Label:
default:
zh-cn: 設置參數
en: Parameter Configure
- Parameters:
- regionId
- instanceId
Label:
default:
zh-cn: 選擇實例
en: Select Ecs Instances
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: 高級選項
en: Control Options
文檔內容是否對您有幫助?