forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scaling-group.yml
117 lines (117 loc) · 2.64 KB
/
scaling-group.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建弹性伸缩组、规则、告警任务、生命周期挂钩及定时任务,实现CPU利用率监控与自动扩容。
en: Create Elastic Scaling Groups, rules, alarm tasks, lifecycle hooks, and scheduled
tasks to implement CPU utilization monitoring and automatic scaling.
Parameters:
VSwitchId:
Type: String
Description: VSW Id.
ScalingGroupName:
Type: String
Description: ScalingGroup Name
Default: mytest
AdjustmentType:
Type: String
Default: QuantityChangeInCapacity
AdjustmentValue:
Type: Number
Default: 1
Threshold:
Type: Number
Default: 10
MetricName:
Type: String
Default: CpuUtilization
MetricType:
Type: String
Default: system
LifecycleTransition:
Type: String
Default: SCALE_OUT
LaunchTime:
Type: String
Default: 2020-08-10T20:00Z
Resources:
ScalingGroup:
Type: ALIYUN::ESS::ScalingGroup
Properties:
VSwitchId:
Ref: VSwitchId
MaxSize: 10
MinSize: 1
ScalingGroupName:
Ref: ScalingGroupName
ScalingRule:
Type: ALIYUN::ESS::ScalingRule
Properties:
AdjustmentType:
Ref: AdjustmentType
ScalingGroupId:
Fn::GetAtt:
- ScalingGroup
- ScalingGroupId
AdjustmentValue:
Ref: AdjustmentValue
DependsOn: ScalingGroup
AlarmTask:
Type: ALIYUN::ESS::AlarmTask
Properties:
ScalingGroupId:
Ref: ScalingGroup
AlarmAction:
- Fn::GetAtt:
- ScalingRule
- ScalingRuleAri
Threshold:
Ref: Threshold
MetricName:
Ref: MetricName
MetricType:
Ref: MetricType
Statistics: Average
DependsOn: ScalingRule
AlarmTaskEnable:
Type: ALIYUN::ESS::AlarmTaskEnable
Properties:
AlarmTaskId:
Ref: AlarmTask
Enable: true
LifecycleHook:
Type: ALIYUN::ESS::LifecycleHook
Properties:
ScalingGroupId:
Ref: ScalingGroup
LifecycleTransition:
Ref: LifecycleTransition
ScheduledTask:
Type: ALIYUN::ESS::ScheduledTask
Properties:
LaunchTime:
Ref: LaunchTime
ScheduledAction:
Fn::GetAtt:
- ScalingRule
- ScalingRuleAri
Outputs:
ScheduledTaskId:
Value:
Fn::GetAtt:
- ScheduledTask
- ScheduledTaskId
LifecycleHookId:
Value:
Fn::GetAtt:
- LifecycleHook
- LifecycleHookId
AlarmTaskId:
Value:
Fn::GetAtt:
- AlarmTask
- AlarmTaskId
ScalingGroupId:
Description: Scaling group Id
Value:
Fn::GetAtt:
- ScalingGroup
- ScalingGroupId