-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS-ECS-ModifyInstanceSpec.yml
145 lines (145 loc) · 4.11 KB
/
ACS-ECS-ModifyInstanceSpec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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