-
Notifications
You must be signed in to change notification settings - Fork 35
/
ecs-group-join-cms.yml
705 lines (679 loc) · 26.7 KB
/
ecs-group-join-cms.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 在CentOS 7 ECS实例上一键部署LNMP环境,配置网络与安全组,设置MySQL密码,实现PHP、Nginx、MySQL安装配置,并集成CMS报警系统与联系人管理。
en: Deploy the LNMP environment on a CentOS 7 ECS instance with one click, configure the network and security group, set the MySQL password, implement PHP, Nginx, and MySQL installation and configuration, and integrate the CMS alarm system and contact management.
Parameters:
SystemDiskCategory:
Default: Null
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- false
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: 系统盘类型
en: System Disk Category
SelectInstance:
Default: false
Type: Boolean
Label:
zh-cn: 是否选择已有实例
en: Whether to select an existing instance
InstanceId:
Default: Null
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- true
Type: String
Label:
zh-cn: ECS实例ID
en: ECS Instance ID
ZoneId:
Type: String
Label:
zh-cn: 可用区ID
en: Zone ID
Description:
zh-cn: 可用区ID,需确认所选可用区下是否支持ECS、VPC、VSwitch等资源。
en: The available zone ID, you should confirm the zone support ECS、VPC、VSwitch or not.
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- false
Default: Null
DbPassword:
Type: String
Label:
zh-cn: MySQL数据库密码
en: MySQL Database Password
Description:
zh-cn: |-
长度为8~32位,需包含大写字母、小写字母、特殊字符和数字,允许的特殊字符包括<span style="background:#E7E9EB;"><b>!@#$%^&*()_+-=</b></span>。<br/>
<b>如果您在同一台ECS实例上重复执行本教程的一键配置模板,请确保MySQL数据库密码和第一次执行模板时设置的密码完全一致。否则一键配置结果不可用。</b>
en: 'The password must be 8 to 32 characters in length. <br/>It must contain the following character types: uppercase letters, lowercase letters, digits, and special characters. <br/> Special characters include <span style="background:#E7E9EB;"><b>!@#$%^&*()_+-=</b></span>.<br/><b>If you repeatedly provision in this tutorial on the same ECS instance, make sure that the MySQL database password is exactly the same as the password set when the template was executed for the first time. Otherwise, the result of provisioning is unavailable.</b>'
AllowedPattern: ^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])((?=.*[!@#\$%\^&\*\(\)\-\+])|(?=.*[_\.,:;\-\?]))[a-zA-Z0-9!@#\$%\^&\*\(\)\-\+_\.,:;\-\?]{8,32}$
NoEcho: true
Password:
Type: String
Label:
zh-cn: 实例密码
en: Login Password
Description:
zh-cn: 长度为8-30位,需包含大写字母、小写字母、特殊符号和数字中的三个,允许的特殊字符包括<span style="background:#E7E9EB;"><b>()`~!@#$%^&*_-+=|{}[]:;'<>,.?/</b></span>。
en: 'The password must be 8 to 32 characters in length. <br/>It must consist three of the the following character types: uppercase letters, lowercase letters, digits, and special characters. <br/>Special characters include <span style="background:#E7E9EB;"><b>()`~!@#$%^&*_-+=|{}[]:;''<>,.?/</b></span>.<br/>'
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- false
AllowedPattern: '[0-9A-Za-z\_\-&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
NoEcho: true
MaxLength: 30
MinLength: 8
Default: Null
InstanceType:
Type: String
Label:
zh-cn: 实例类型
en: Instance Type
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- false
ZoneId: ZoneId
Default: Null
Channels:
AssociationPropertyMetadata:
Parameters:
Mail:
Required: false
Type: String
Label:
zh-cn: Email地址
en: Mail
Description:
zh-cn: 添加或者修改的Email会收到一个激活链接,激活之后对应Email才会被加到联系人中。
en: 'An added or modified Email will receive an activation link, and the corresponding Email will be added to the contact after activation. '
Default: Null
DingWebHook:
Default: Null
Required: false
Type: String
Label:
zh-cn: 钉钉机器人Webhook
en: DingWebHook
Description:
zh-cn: 钉钉机器人Webhook。
en: The DingTalk Chatbot address.
SMS:
Default: Null
Required: false
Type: String
Label:
zh-cn: 手机号码、短信或者电话联系方式
en: SMS
Description:
zh-cn: 添加或者修改的手机号码会收到一个激活链接, 激活之后才会被加到联系人中。
en: 'The added or modified phone number will receive an activation link before it is added to the contacts. '
AliIM:
Default: Null
Required: false
Type: String
Label:
zh-cn: 旺旺联系方式
en: AliIM
Description:
zh-cn: 旺旺联系方式。
en: The TradeManager ID.
Required: true
Type: Json
Label:
zh-cn: 联系方式
en: Channels
Description:
zh-cn: 至少添加手机号码、邮箱、钉钉机器人、旺旺中的一种联系方式。
en: 'Add at least one of your phone number, email address, nail bot, or Want Want. '
ContactName:
Type: String
Label:
zh-cn: 联系人姓名
en: Contact Name
Description: 报警联系人姓名。
Default: custom_contact_name
ContactGroupName:
Type: String
Label:
zh-cn: 报警联系组名称
en: Contact Group Name
Description: 报警联系组名称。
Default: custom_contact_group_name
MetricName:
Type: String
Label:
zh-cn: 目标云产品指标名称
en: Metric Name
Description:
zh-cn: 目标云产品指标列表页面中的Metric ID列,请参见<a href="https://help.aliyun.com/zh/cms/user-guide/operating-system-monitoring" target="_blank">操作系统监控</a>。
en: The Metric ID column in the target cloud product Metrics list page, please refer to <a href="https://help.aliyun.com/zh/cms/user-guide/operating-system-monitoring" target="_blank">Operating system management</a>.
Default: cpu_cores
Escalations:
AssociationPropertyMetadata:
Parameters:
Critical:
AssociationPropertyMetadata:
Parameters:
Threshold:
Required: true
Type: String
Label:
zh-cn: 阈值
en: Threshold
Description:
zh-cn: 紧急级别警报的阈值。
en: The threshold for Critical-level alerts.
ComparisonOperator:
Required: true
Type: String
Label:
zh-cn: 较度量值与阈值的运算符
en: Comparison Operator
Description:
zh-cn: 用于比较度量值与阈值的运算符。 有效值:<br/>- GreaterThanOrEqualToThreshold:大于等于阈值 <br/>- GreaterThanThreshold:大于阈值 <br/>- LessThanOrEqualToThreshold:小于或等于阈值 <br/>- LessThanThreshold:小于阈值 <br/>- NotEqualToThreshold:不等于阈值 <br/>- GreaterThanYesterday:大于昨天同一时间的度量值 <br/>- LessThanYesterday:小于昨天同一时间的度量值 <br/>- GreaterThanLastWeek:大于上周同一时间的度量值 <br/>- LessThanLastWeek:小于上周同一时间的度量值 <br/>- GreaterThanLastPeriod:大于上一个监控周期的度量值 <br/>- LessThanLastPeriod:小于上一个监控周期的度量值
en: 'The operator that is used to compare the metric value with the threshold. Valid values:<br/>- GreaterThanOrEqualToThreshold: greater than or equal to the threshold<br/>- GreaterThanThreshold: greater than the threshold<br/>- LessThanOrEqualToThreshold: less than or equal to the threshold<br/>- LessThanThreshold: less than the threshold<br/>- NotEqualToThreshold: not equal to the threshold<br/>- GreaterThanYesterday: greater than the metric value at the same time yesterday<br/>- LessThanYesterday: less than the metric value at the same time yesterday<br/>- GreaterThanLastWeek: greater than the metric value at the same time last week<br/>- LessThanLastWeek: less than the metric value at the same time last week<br/>- GreaterThanLastPeriod: greater than the metric value in the last monitoring cycle<br/>- LessThanLastPeriod: less than the metric value in the last monitoring cycle'
AllowedValues:
- GreaterThanLastPeriod
- GreaterThanLastWeek
- GreaterThanOrEqualToThreshold
- GreaterThanThreshold
- GreaterThanYesterday
- LessThanLastPeriod
- LessThanLastWeek
- LessThanOrEqualToThreshold
- LessThanThreshold
- LessThanYesterday
- NotEqualToThreshold
Statistics:
Required: true
Type: String
Label:
zh-cn: 警报的统计方法
en: Statistics
Description:
zh-cn: '关键级别警报的统计方法。 有效值: <br/>- Maximum:最大值 <br/>- Minimum:最小值 <br/>- Average:平均值 <br/>- Availability:可用性 '
en: 'The statistical methods for Critical-level alerts. Valid values:<br/>- Maximum: the maximum value <br/>- Minimum: the minimum value <br/>- Average: the average value <br/>- Availability: the availability rate'
AllowedValues:
- Availability
- Average
- Maximum
- Minimum
Times:
Required: true
Type: Number
Label:
zh-cn: 触发条件的连续次数
en: Times
Description:
zh-cn: 在触发临界级别警报之前,度量值满足触发条件的连续次数。
en: The consecutive number of times for which the metric value meets the trigger condition before a Critical-level alert is triggered.
Description:
zh-cn: '您必须为所选的警报级别指定Statistics、ComparisonOperator、Threshold和Times参数。 '
en: You must specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
Default:
Statistics: Average
ComparisonOperator: GreaterThanOrEqualToThreshold
Threshold: '20'
Times: 5
Required: false
Label:
zh-cn: 严重级别报警详情
en: Critical
Type: Json
Required: true
Type: Json
Label:
zh-cn: 报警详情
en: Escalations
Description:
en: You must select at least one of the Critical, Warn, and Info alert levels.
zh-cn: '必须选择“紧急”、“警告”和“提示”三个级别中的至少一个。'
Default:
Critical:
Statistics: Average
ComparisonOperator: GreaterThanOrEqualToThreshold
Threshold: '20'
Times: 5
Conditions:
CreateInstance:
Fn::Equals:
- Ref: SelectInstance
- false
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
Condition: CreateInstance
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: ZoneId
Condition: CreateInstance
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
Condition: CreateInstance
SecurityGroupIngress_443:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
IpProtocol: tcp
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DS_Instances
- Instances
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: 443/443
SecurityGroupIngress_22:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
IpProtocol: tcp
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DS_Instances
- Instances
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: 22/22
SecurityGroupIngress_80:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
IpProtocol: tcp
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DS_Instances
- Instances
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: 80/80
WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WaitConditionHandle
Timeout: 3720
WaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
DS_Instances:
Type: DATASOURCE::ECS::Instances
Properties:
InstanceIds:
Fn::If:
- CreateInstance
- Fn::GetAtt:
- InstanceGroup
- InstanceIds
- - Ref: InstanceId
InstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: Vpc
SecurityGroupId:
Ref: SecurityGroup
ImageId: centos_7_8
IoOptimized: optimized
VSwitchId:
Ref: VSwitch
Password:
Ref: Password
InstanceType:
Ref: InstanceType
MaxAmount: 1
Condition: CreateInstance
InstallLnmp:
Type: ALIYUN::ECS::RunCommand
Properties:
CommandContent:
Fn::Sub: |-
#!/bin/bash
if [ ! -f .ros.provision ]; then
echo "Name: 手动部署LNMP环境(CentOS 7)" > .ros.provision
fi
name=$(grep "^Name:" .ros.provision | awk -F':' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [[ "$name" != "手动部署LNMP环境(CentOS 7)" ]]; then
echo "当前实例已使用过\"$name\"教程的一键配置,不能再使用本教程的一键配置"
${WaitConditionHandle.CurlCli} --data-binary "{\"status\": \"FAILURE\", \"reason\": \"The current instance has already applied the configuration of the \\\"$name\\\" tutorial, and the configuration of this tutorial can no longer be applied.\"}"
exit 0
fi
echo "#########################"
echo "# Check Network"
echo "#########################"
ping -c 2 -W 2 aliyun.com > /dev/null
if [[ $? -ne 0 ]]; then
echo "当前实例无法访问公网"
${WaitConditionHandle.CurlCli} --data-binary "{\"status\": \"FAILURE\", \"reason\": \"The current instance cannot access the public network.\"}"
exit 0
fi
if ! grep -q "^Step1: Prepare Environment$" .ros.provision; then
echo "#########################"
echo "# Prepare Environment"
echo "#########################"
systemctl status firewalld
systemctl stop firewalld
echo "Step1: Prepare Environment" >> .ros.provision
else
echo "#########################"
echo "# Environment has been ready"
echo "#########################"
fi
if ! grep -q "^Step2: Install Nginx$" .ros.provision; then
echo "#########################"
echo "# Install Nginx"
echo "#########################"
yum -y install nginx
nginx -v
echo "Step2: Install Nginx" >> .ros.provision
else
echo "#########################"
echo "# Nginx has been installed"
echo "#########################"
fi
if ! grep -q "^Step3: Install MySQL$" .ros.provision; then
echo "#########################"
echo "# Install MySQL"
echo "#########################"
rpm -Uvh https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum -y install mysql-community-server --nogpgcheck
mysql -V
systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload
echo "Step3: Install MySQL" >> .ros.provision
else
echo "#########################"
echo "# MySQL has been installed"
echo "#########################"
fi
if ! grep -q "^Step4: Install PHP$" .ros.provision; then
echo "#########################"
echo "# Install PHP"
echo "#########################"
yum install -y \
https://mirrors.aliyun.com/ius/ius-release-el7.rpm \
https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w-devel php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-mysqlnd php70w-fpm php70w-opcache php70w-pecl-redis php70w-pecl-mongodb
php -v
echo "Step4: Install PHP" >> .ros.provision
else
echo "#########################"
echo "# PHP has been installed"
echo "#########################"
fi
if ! grep -q "^Step4: Config Nginx$" .ros.provision; then
echo "#########################"
echo "# Config Nginx"
echo "#########################"
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
cat > /etc/nginx/nginx.conf << \EOF
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
index index.php index.html index.htm;
}
location ~ .php$ {
root /usr/share/nginx/html; # 将/usr/share/nginx/html替换为您的网站根目录,本文使用/usr/share/nginx/html作为网站根目录。
fastcgi_pass 127.0.0.1:9000; # Nginx通过本机的9000端口将PHP请求转发给PHP-FPM进行处理。
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; # Nginx调用fastcgi接口处理PHP请求。
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
EOF
systemctl start nginx
systemctl enable nginx
echo "Step4: Config Nginx" >> .ros.provision
else
echo "#########################"
echo "# Nginx has been configured"
echo "#########################"
fi
if ! grep -q "^Step6: Config MySQL$" .ros.provision; then
echo "#########################"
echo "# Config MySQL"
echo "#########################"
export MYSQL_PWD=`grep "temporary password" /var/log/mysqld.log | awk '{print $NF}'`
mysqladmin -uroot password '${DbPassword}'
export MYSQL_PWD='${DbPassword}'
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DbPassword}'"
echo "Step6: Config MySQL" >> .ros.provision
else
echo "#########################"
echo "# MySQL has been configured"
echo "#########################"
fi
if ! grep -q "^Step7: Config PHP$" .ros.provision; then
echo "#########################"
echo "# Config PHP"
echo "#########################"
echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/phpinfo.php
systemctl start php-fpm
systemctl enable php-fpm
echo "Step7: Config MySQL" >> .ros.provision
else
echo "#########################"
echo "# PHP has been configured"
echo "#########################"
fi
${WaitConditionHandle.CurlCli} --data-binary '{"status": "SUCCESS"}'
Type: RunShellScript
Sync: true
InstanceIds:
Fn::If:
- CreateInstance
- Fn::GetAtt:
- InstanceGroup
- InstanceIds
- - Ref: InstanceId
Timeout: 3600
DependsOn:
- SecurityGroupIngress_22
- SecurityGroupIngress_443
- SecurityGroupIngress_80
Contact:
Type: ALIYUN::CMS::Contact
Properties:
Describe: Test Contact
ContactName:
Ref: ContactName
Channels:
Ref: Channels
ContactGroup:
Type: ALIYUN::CMS::ContactGroup
Properties:
Describe: Test ContactGroup
ContactGroupName:
Ref: ContactGroupName
ContactNames:
- Fn::GetAtt:
- Contact
- ContactName
ResourceMetricRule:
Type: ALIYUN::CMS::ResourceMetricRule
Properties:
ContactGroups:
- Fn::GetAtt:
- ContactGroup
- ContactGroupName
Namespace: acs_ecs_dashboard
MetricName:
Ref: MetricName
Resources:
- instanceId:
Fn::Select:
- 0
- Fn::If:
- CreateInstance
- Fn::GetAtt:
- InstanceGroup
- InstanceIds
- - Ref: InstanceId
Escalations:
Ref: Escalations
DependsOn: ContactGroup
Outputs:
PhpUrl:
Description:
zh-cn: PHP信息页面。
en: PHP Info Page.
Value:
Fn::Sub:
- http://${IP}/phpinfo.php
- IP:
Fn::Jq:
- First
- if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress end
- Fn::GetAtt:
- DS_Instances
- Instances
NginxUrl:
Description:
zh-cn: Nginx信息页面。
en: Nginx Info Page.
Value:
Fn::Sub:
- http://${IP}
- IP:
Fn::Jq:
- First
- if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress end
- Fn::GetAtt:
- DS_Instances
- Instances
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- SelectInstance
- InstanceId
- ZoneId
- InstanceType
- SystemDiskCategory
- Password
Label:
default: ECS
- Parameters:
- DbPassword
Label:
default: MySQL
- Parameters:
- Channels
- ContactName
- ContactGroupName
- MetricName
- Escalations
Label:
default: CMS
TemplateTags:
- acs:example:弹性计算:手动部署LNMP环境(CentOS 7)及配置CMS报警项和报警联系人