-
Notifications
You must be signed in to change notification settings - Fork 35
/
deploy-high-availability-architecture-to-the-cloud.yml
1131 lines (1129 loc) · 32.8 KB
/
deploy-high-availability-architecture-to-the-cloud.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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 在两个可用区自动创建VPC、ECS、RDS、Redis与SLB,配置高可用架构,支持自定义资源规格与计费方式,适用于通用产品云端部署。
en: Automatically create VPC, ECS, RDS, Redis and SLB in two availability zones, configure a high-availability architecture, support customized resource specifications and billing methods, and are suitable for cloud deployment of general products.
Parameters:
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
zh-cn: 专有网络网段
AssociationProperty: ALIYUN::VPC::VPC::CidrBlock
Default: 192.168.0.0/16
AllowedValues:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
VSwitchCidrBlock1:
Type: String
Label:
en: VSwitch 1 CIDR Block
zh-cn: 交换机1网段
AssociationProperty: ALIYUN::VPC::VSwitch::CidrBlock
AssociationPropertyMetadata:
VpcCidrBlock: ${VpcCidrBlock}
Default: 192.168.0.0/24
VSwitchZoneId1:
Type: String
Label:
en: VSwitch 1 Available Zone
zh-cn: 交换机1可用区
AssociationProperty: ALIYUN::ECS::ZoneId
VSwitchCidrBlock2:
Type: String
Label:
en: VSwitch 2 CIDR Block
zh-cn: 交换机2网段
AssociationProperty: ALIYUN::VPC::VSwitch::CidrBlock
AssociationPropertyMetadata:
VpcCidrBlock: ${VpcCidrBlock}
Default: 192.168.1.0/24
VSwitchZoneId2:
Type: String
Label:
en: VSwitch 2 Available Zone
zh-cn: 交换机2可用区
AssociationProperty: ALIYUN::ECS::ZoneId
EcsInstanceChargeType:
Type: String
Label:
en: Payment Type
zh-cn: 付费类型
AssociationProperty: ChargeType
Default: PostPaid
ECSPeriodUnit:
Type: String
Label:
en: ECS Purchase duration of prepaid resources.
zh-cn: 云服务器预付费资源的购买周期
Description:
en: 'ECS Purchase time and period of prepaid resource, value: [Week, Month].'
zh-cn: 云服务器预付费资源的购买时长周期,取值:[Week(周), Month(月)]
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${EcsInstanceChargeType}
- PostPaid
Default: Week
AllowedValues:
- Week
- Month
ECSPeriod:
Type: Number
Label:
en: ECS Purchase time of prepaid resources.
zh-cn: 云服务器预付费资源的购买时长
Description:
en: 'When the purchase cycle of prepaid resource is week, the value range is:
[1,2,3,4]; when the purchase cycle of prepaid resource is month, the value
is: [1,2,3,4,5,6,7,8,9,12,24,36,48,60].'
zh-cn: 云服务器预付费资源的购买时长,当预付费资源的购买周期为Week时,取值范围:[1,2,3,4]; 当预付费资源的购买周期为Month时,取值:[1,2,3,4,5,6,7,8,9,12,24,36,48,60]。
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${EcsInstanceChargeType}
- PostPaid
Default: 1
MinValue: 1
MaxValue: 60
InstanceGroupInstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
InstanceChargeType: ${EcsInstanceChargeType}
EcsSystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: 系统盘类型
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceGroupInstanceType}
InstanceGroupSystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘空间
Description:
en: 'System disk size, range of values: 40-500, units: GB.'
zh-cn: 系统盘大小, 取值范围:[40, 500], 单位:GB。
Default: 40
MinValue: 40
MaxValue: 500
EcsImageId:
Type: String
Label:
en: Image
zh-cn: 镜像
AssociationProperty: ALIYUN::ECS::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${InstanceGroupInstanceType}
EcsPassword:
Type: String
Label:
en: Login Password
zh-cn: 登录密码
Description:
en: Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=| {}[]:;' <>,.? / Special symbol
in).
zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
AssociationProperty: ALIYUN::ECS::Instance::Password
NoEcho: true
InstanceGroup1MaxAmount:
Type: Number
Label:
en: The number of ECS instances created under VSwitch1
zh-cn: 交换机1下创建的ECS实例数量
Description:
en: 'Number of the servers, value range: [1, 100].'
zh-cn: '创建服务器的数量,取值范围: [1, 100]。'
Default: 1
MinValue: 1
MaxValue: 100
InstanceGroup2MaxAmount:
Type: Number
Label:
en: The number of ECS instances created under VSwitch2
zh-cn: 交换机2下创建的ECS实例数量
Description:
en: 'Number of the servers, value range: [1, 100].'
zh-cn: '创建服务器的数量,取值范围: [1, 100]。'
Default: 1
MinValue: 1
MaxValue: 100
LoadbalancerPayType:
Type: String
Label:
en: Payment Type
zh-cn: 付费类型
Description:
en: '<font color=''blue''><b>Optional values: </b></font><br>[PayOnDemand:<font
color=''green''>pay-as-you-go</font>]<br>[PrePay:<font color=''green''>prepayment,monthly
or annual</font>]<br><font color=''blue''></a>'
zh-cn: '<font color=''blue''><b>可选值: </b></font><br>[PayOnDemand:<font color=''green''>按量付费</font>]<br>[PrePay:<font
color=''green''>预付费,包月</font>]<br><font color=''blue''></a>'
Default: PayOnDemand
AllowedValues:
- PayOnDemand
- PrePay
SLBPeriodUnit:
Type: String
Label:
en: SLB Purchase duration of prepaid resources.
zh-cn: 负载均衡实例预付费资源的购买周期
Description:
en: 'SLB Purchase time and period of prepaid resource, value: [month,year].'
zh-cn: 负载均衡实例预付费资源的购买时长周期,取值:[month(月),year(年)]
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${LoadbalancerPayType}
- PayOnDemand
Default: month
AllowedValues:
- month
- year
SLBPeriod:
Type: Number
Label:
en: SLB Purchase time of prepaid resources.
zh-cn: 负载均衡实例预付费资源的购买时长
Description:
en: 'When the purchase cycle of prepaid resource is Year, the value range is:
[1,2,3]; when the purchase cycle of prepaid resource is month, the value is:
[1,2,3,4,5,6,7,8,9].'
zh-cn: 负载均衡实例预付费资源的购买时长,当预付费资源的购买周期为Year时,取值范围:[1,2,3]; 当预付费资源的购买周期为Month时,取值:[1,2,3,4,5,6,7,8,9]。
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${LoadbalancerPayType}
- PayOnDemand
Default: 1
MinValue: 1
MaxValue: 9
LoadBalancerSpec:
Type: String
Label:
en: Specifications
zh-cn: 规格
Description:
en: Instance specifications,see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html'
target='_blank'><b><font color='blue'>Performance support type</b></font></a>
zh-cn: 实例规格,详见:</b><a href='https://help.aliyun.com/document_detail/85939.html'
target='_blank'><b><font color='blue'>性能保障型</b></font></a>
AssociationProperty: ALIYUN::SLB::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId1}
RdsDBInstancePayType:
Type: String
Label:
en: Payment Type
zh-cn: 付费类型
AssociationProperty: ChargeType
Default: PostPaid
RDSPeriodUnit:
Type: String
Label:
en: RDS Purchase duration of prepaid resources.
zh-cn: 云服务器预付费资源的购买周期
Description:
en: 'RDS Purchase time and period of prepaid resource, value: [Month,Year].'
zh-cn: 云数据库预付费资源的购买时长周期,取值:[Month(月),Year(年)]
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${RdsDBInstancePayType}
- PostPaid
Default: Month
AllowedValues:
- Month
- Year
RDSPeriod:
Type: Number
Label:
en: RDS Purchase time of prepaid resources.
zh-cn: 云数据库预付费资源的购买时长
Description:
en: 'When the purchase cycle of prepaid resource is Year, the value range is:
[1,2,3]; when the purchase cycle of prepaid resource is month, the value is:
[1,2,3,4,5,6,7,8,9].'
zh-cn: 云数据库预付费资源的购买时长,当预付费资源的购买周期为Year时,取值范围:[1,2,3]; 当预付费资源的购买周期为Month时,取值:[1,2,3,4,5,6,7,8,9]。
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${RdsDBInstancePayType}
- PostPaid
Default: 1
MinValue: 1
MaxValue: 9
RDSEngine:
Type: String
Label:
en: RDS Engine Type
zh-cn: 数据库类型
AssociationProperty: ALIYUN::RDS::Engine::EngineId
RDSEngineVersion:
Type: String
Label:
en: RDS Engine Version
zh-cn: 数据库版本号
AssociationProperty: ALIYUN::RDS::Engine::EngineVersion
AssociationPropertyMetadata:
Engine: ${RDSEngine}
DBInstanceClass:
Type: String
Label:
en: The instance specification
zh-cn: 实例规格
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
Engine: ${RDSEngine}
ZoneId: ${VSwitchZoneId1}
DBInstanceDbName:
Type: String
Label:
en: Database name
zh-cn: 数据库名称
Description:
en: The database name created by the instance, consisting of lowercase letters,
numbers, underscores, and middle lines, beginning with letters, ending with
letters or numbers, up to 64 characters.
zh-cn: 实例创建的数据库名称,由小写字母、数字、下划线、中划线组成,以字母开头,字母或数字结尾,最多64个字符。
Default: small_frame
DBInstanceStorage:
Type: Number
Label:
en: Storage Space
zh-cn: 存储空间
Description:
en: 'Database storage space, units: GB, per 5GB increment, value range: 5-1000.'
zh-cn: 数据库存储空间, 单位:GB, 每5GB进行递增,取值范围:5-1000。
Default: 50
MinValue: 5
MaxValue: 1000
AccountName:
Type: String
Label:
en: Database Account
zh-cn: 数据库帐号
Description:
en: Maximum 16 characters,Consists of a lowercase letter, a number, an underscore,
a letter beginning, a letter or a number ending.<br><b>note: <font color='blue'>keywords
can not be used, e.g.:admin/root。</font></b>
zh-cn: 最长16个字符, 由小写字母,数字、下划线组成、字母开头,字母或数字结尾。<br><b>注: <font color='blue'>关键字不能用,如:admin/root。</font></b>
Default: small_admin
MaxLength: 16
AccountPassword:
Type: String
Label:
en: Account Password
zh-cn: 数据库帐号密码
Description:
en: Length 8-32 characters, can contain size letters, Numbers and special symbols
(including:!@#$%^&*-+=_).
zh-cn: 长度8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
ConstraintDescription:
en: Length 8-32, can contain size letters, Numbers and special symbols (including:!@#$%^&*-+=_).
zh-cn: 长度8-32,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
MinLength: 8
MaxLength: 32
NoEcho: true
RedisInstanceChargeType:
Type: String
Label:
en: Payment Type
zh-cn: 付费类型
Description:
en: '<font color=''blue''><b>Optional values: </b></font><br>[PayOnDemand:<font
color=''green''>pay-as-you-go</font>]<br>[PrePay:<font color=''green''>prepayment,monthly
or annual</font>]<br><font color=''blue''>The monthly instance can not create
a database (db) and an account.'
zh-cn: '<font color=''blue''><b>付费类型;可选值: </b></font><br>[Postpaid:<font color=''green''>按量付费</font>]<br>[Prepaid:<font
color=''green''>预付费,包月</font>]<br>预付费,包月实例不创建数据库(db)和帐号。'
Default: PostPaid
AllowedValues:
- PostPaid
- PrePaid
RedisPeriodUnit:
Type: String
Label:
en: Redis Purchase duration of prepaid resources.
zh-cn: Redis实例预付费资源的购买周期
Description:
en: 'Redis Purchase time and period of prepaid resource, value: [Month,Year].'
zh-cn: Redis实例预付费资源的购买时长周期,取值:[Month(月),Year(年)]
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${RedisInstanceChargeType}
- PostPaid
Default: Month
AllowedValues:
- Month
- Year
RedisPeriod:
Type: Number
Label:
en: Redis Purchase time of prepaid resources.
zh-cn: Redis实例预付费资源的购买时长
Description:
en: 'When the purchase cycle of prepaid resource is Year, the value range is:
[1,2,3]; when the purchase cycle of prepaid resource is month, the value is:
[1,2,3,4,5,6,7,8,9,12,24,36,48,60].'
zh-cn: Redis实例预付费资源的购买时长,当预付费资源的购买周期为Year时,取值范围:[1,2,3]; 当预付费资源的购买周期为Month时,取值:[1,2,3,4,5,6,7,8,9,12,24,36,48,60]。
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${RedisInstanceChargeType}
- PostPaid
Default: 1
MinValue: 1
MaxValue: 60
RedisInstanceClass:
Type: String
Label:
en: Specifications
zh-cn: 规格
AssociationProperty: ALIYUN::Redis::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId1}
RedisEngineVersion:
Type: String
Label:
en: Database Version
zh-cn: 数据库版本
Description:
en: 'Redis database version.Default: 4.0.'
zh-cn: Redis数据库版本。默认值:4.0。
Default: '4.0'
AllowedValues:
- '2.8'
- '4.0'
- '5.0'
RedisInstancePassword:
Type: String
Label:
en: Database Password
zh-cn: Redis数据库密码
Description:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
MinLength: '8'
MaxLength: '30'
NoEcho: true
Resources:
VPC:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 7744dc6a-5b2a-48ec-a6ae-20a79402aeb3
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: VPC
SecurityGroupIngress:
- IpProtocol: all
NicType: intranet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
SecurityGroupName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: f07b1f2e-6b17-410d-bd44-7a0588008299
VSwitch1:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSwitchZoneId1
VpcId:
Ref: VPC
CidrBlock:
Ref: VSwitchCidrBlock1
VSwitchName:
Fn::Join:
- '-'
- - VSwitch1
- StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: b9ccaabc-2a0f-4be5-b423-dd23258aeaae
EcsInstanceGroup1:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch1
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: EcsImageId
AllocatePublicIP: false
InstanceChargeType:
Ref: EcsInstanceChargeType
InstanceType:
Ref: InstanceGroupInstanceType
IoOptimized: optimized
MaxAmount:
Ref: InstanceGroup1MaxAmount
Password:
Ref: EcsPassword
Period:
Ref: ECSPeriod
PeriodUnit:
Ref: ECSPeriodUnit
SystemDiskCategory:
Ref: EcsSystemDiskCategory
SystemDiskSize:
Ref: InstanceGroupSystemDiskSize
UserData:
Fn::Join:
- '
'
- - '#!/bin/bash'
- yum install -y nginx
- mkdir -p /data/nginx
- echo "This is service client from ecs." > /data/nginx/index.html
- cat > /etc/nginx/conf.d/server.conf <<EOF
- server {
- ' listen 80;'
- ' server_name _;'
- ' index index.html;'
- ' root /data/nginx;'
- '}'
- EOF
- systemctl stop nginx
- systemctl start nginx
- systemctl enable nginx
- Fn::Sub: '${InstanceGroup1ConditionHandle.CurlCli} -d ''{"data" : "InstanceGroup1
install nginx web success."}'''
Metadata:
ALIYUN::ROS::Designer:
id: 694e279c-cc9a-4ee8-8d0a-fa54c0d61fef
VSwitch2:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSwitchZoneId2
VpcId:
Ref: VPC
CidrBlock:
Ref: VSwitchCidrBlock2
VSwitchName:
Fn::Join:
- '-'
- - VSwitch2
- StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 2a9ab31e-b135-401e-b7e2-49fd78272f82
EcsInstanceGroup2:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch2
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: EcsImageId
AllocatePublicIP: false
InstanceChargeType:
Ref: EcsInstanceChargeType
InstanceType:
Ref: InstanceGroupInstanceType
IoOptimized: optimized
MaxAmount:
Ref: InstanceGroup2MaxAmount
Password:
Ref: EcsPassword
Period:
Ref: ECSPeriod
PeriodUnit:
Ref: ECSPeriodUnit
SystemDiskCategory:
Ref: EcsSystemDiskCategory
SystemDiskSize:
Ref: InstanceGroupSystemDiskSize
UserData:
Fn::Join:
- '
'
- - '#!/bin/bash'
- yum install -y nginx
- mkdir -p /data/nginx
- echo "This is service client from ecs." > /data/nginx/index.html
- cat > /etc/nginx/conf.d/server.conf <<EOF
- server {
- ' listen 80;'
- ' server_name _;'
- ' index index.html;'
- ' root /data/nginx;'
- '}'
- EOF
- systemctl stop nginx
- systemctl start nginx
- systemctl enable nginx
- Fn::Sub: '${InstanceGroup2ConditionHandle.CurlCli} -d ''{"data" : "InstanceGroup2
install nginx web success."}'''
Metadata:
ALIYUN::ROS::Designer:
id: fbec0150-9bfb-48bb-9b94-37dbd4d0908a
InstanceGroup1ConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: db0a74c9-67bb-49e1-9aa5-bc8b2c308d3d
InstanceGroup1WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count:
Ref: InstanceGroup1MaxAmount
Handle:
Ref: InstanceGroup1ConditionHandle
Timeout: 1800
DependsOn: EcsInstanceGroup1
Metadata:
ALIYUN::ROS::Designer:
id: 086e4b90-075d-4f47-b994-5996edaf05fa
InstanceGroup2ConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 492443ed-87d9-46f2-a992-c2aadcc78b58
InstanceGroup2WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count:
Ref: InstanceGroup2MaxAmount
Handle:
Ref: InstanceGroup2ConditionHandle
Timeout: 1800
DependsOn: EcsInstanceGroup2
Metadata:
ALIYUN::ROS::Designer:
id: 3c3a27ea-d564-44da-a601-cb8637ff60a9
RdsDBInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch1
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceStorage:
Ref: DBInstanceStorage
DBMappings:
- CharacterSetName: utf8
DBName:
Ref: DBInstanceDbName
Engine:
Ref: RDSEngine
EngineVersion:
Ref: RDSEngineVersion
MasterUserPassword:
Ref: AccountPassword
MasterUserType: Normal
MasterUsername:
Ref: AccountName
PayType:
Ref: RdsDBInstancePayType
Period:
Ref: RDSPeriod
PeriodType:
Ref: RDSPeriodUnit
SecurityIPList:
Ref: VpcCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: fac19315-c387-48a6-b36f-c72318e8dde8
RdsAccountPrivilege:
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountName:
Ref: AccountName
AccountPrivilege: ReadWrite
DBInstanceId:
Fn::GetAtt:
- RdsDBInstance
- DBInstanceId
DBName:
Ref: DBInstanceDbName
DependsOn:
- RdsDBInstance
Metadata:
ALIYUN::ROS::Designer:
id: f5757b30-d0c1-40ac-8b37-7f69cb70ba8a
RedisInstance:
Type: ALIYUN::REDIS::Instance
Properties:
ZoneId:
Ref: VSwitchZoneId1
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch1
ChargeType:
Ref: RedisInstanceChargeType
EngineVersion:
Ref: RedisEngineVersion
InstanceClass:
Ref: RedisInstanceClass
InstanceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Password:
Ref: RedisInstancePassword
Period:
Ref: RedisPeriod
PeriodUnit:
Ref: RedisPeriodUnit
Metadata:
ALIYUN::ROS::Designer:
id: 2e0f3501-d9fb-4989-bebd-a19fdafdccf7
SlbLoadBalancer:
Type: ALIYUN::SLB::LoadBalancer
Properties:
AddressType: internet
Bandwidth: 5
Duration:
Ref: SLBPeriod
InternetChargeType: paybybandwidth
LoadBalancerName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
LoadBalancerSpec:
Ref: LoadBalancerSpec
MasterZoneId:
Ref: VSwitchZoneId1
PayType:
Ref: LoadbalancerPayType
PricingCycle:
Ref: SLBPeriodUnit
Metadata:
ALIYUN::ROS::Designer:
id: bb743e5e-8271-4e68-90fc-31c028226c76
SlbBackendServerAttachment:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
BackendServerList:
Fn::ListMerge:
- Fn::GetAtt:
- EcsInstanceGroup1
- InstanceIds
- Fn::GetAtt:
- EcsInstanceGroup2
- InstanceIds
BackendServerWeightList:
- 100
LoadBalancerId:
Ref: SlbLoadBalancer
Metadata:
ALIYUN::ROS::Designer:
id: 62342323-7c86-4614-83b3-c9cf269a54db
SlbListener:
Type: ALIYUN::SLB::Listener
Properties:
BackendServerPort: 80
Bandwidth: 5
HealthCheck:
HealthyThreshold: 3
HttpCode: http_2xx,http_3xx,http_4xx,http_5xx
Interval: 2
Timeout: 5
UnhealthyThreshold: 3
ListenerPort: 80
LoadBalancerId:
Ref: SlbLoadBalancer
Protocol: tcp
Scheduler: wrr
Metadata:
ALIYUN::ROS::Designer:
id: f256a7cd-0a42-4f54-9fb1-99a6e0890bfd
Outputs:
EcsGroup1InstanceIds:
Description:
en: The first set of server instance IDs
zh-cn: 一组服务器实例ID列表
Value:
Fn::GetAtt:
- EcsInstanceGroup1
- InstanceIds
EcsGroup1PrivateIps:
Description:
en: Private network IP list for the first set of server instances
zh-cn: 一组服务器实例的私网IP列表
Value:
Fn::GetAtt:
- EcsInstanceGroup1
- PrivateIps
EcsGroup2InstanceIds:
Description:
en: The second set of server instance IDs
zh-cn: 二组服务器实例ID列表
Value:
Fn::GetAtt:
- EcsInstanceGroup2
- InstanceIds
EcsGroup2PrivateIps:
Description:
en: Private network IP list for the second set of server instances
zh-cn: 二组服务器实例的私网IP列表
Value:
Fn::GetAtt:
- EcsInstanceGroup2
- PrivateIps
RdsInnerConnectionString:
Description:
en: Relational database Intranet connection strings
zh-cn: 关系型数据库内网连接串
Value:
Fn::GetAtt:
- RdsDBInstance
- InnerConnectionString
RedisInstanceConnectionDomain:
Description:
en: The Intranet connection address of the Redis instance
zh-cn: Redis实例的内网连接地址
Value:
Fn::GetAtt:
- RedisInstance
- ConnectionDomain
SLBServerAddress:
Description:
en: SLB instance server address
zh-cn: 负载均衡实例的服务地址
Value:
Fn::Sub:
- http://${SLBIpAddress}
- SLBIpAddress:
Fn::GetAtt:
- SlbLoadBalancer
- IpAddress
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwitchCidrBlock1
- VSwitchZoneId1
- VSwitchCidrBlock2
- VSwitchZoneId2
Label:
en: Infrastructure Configuration
zh-cn: 基础资源配置
- Parameters:
- EcsInstanceChargeType
- ECSPeriodUnit
- ECSPeriod
- InstanceGroupInstanceType
- EcsSystemDiskCategory
- InstanceGroupSystemDiskSize
- EcsImageId
- EcsPassword
- InstanceGroup1MaxAmount
- InstanceGroup2MaxAmount
Label:
en: ECS Configuration
zh-cn: ECS配置
- Parameters:
- LoadbalancerPayType
- SLBPeriodUnit
- SLBPeriod
- LoadBalancerSpec
Label:
en: SLB Configuration
zh-cn: SLB配置
- Parameters:
- RdsDBInstancePayType
- RDSPeriodUnit
- RDSPeriod
- RDSEngine
- RDSEngineVersion
- DBInstanceClass
- DBInstanceDbName
- DBInstanceStorage
- AccountName
- AccountPassword
Label:
en: RDS Configuration
zh-cn: RDS配置
- Parameters:
- RedisInstanceChargeType
- RedisPeriodUnit
- RedisPeriod
- RedisInstanceClass
- RedisEngineVersion
- RedisInstancePassword
Label:
en: Redis Configuration
zh-cn: Redis配置
TemplateTags:
- acs:solution:云市场:通用产品上云部署架构(高可用)
ALIYUN::ROS::Designer:
086e4b90-075d-4f47-b994-5996edaf05fa:
position:
x: 87
y: 366
size:
height: 60
width: 60
z: 2
2a9ab31e-b135-401e-b7e2-49fd78272f82:
embeds:
- fbec0150-9bfb-48bb-9b94-37dbd4d0908a
- 3c3a27ea-d564-44da-a601-cb8637ff60a9
- 492443ed-87d9-46f2-a992-c2aadcc78b58
position:
x: 674
y: 59
size:
height: 629
width: 549
z: 1
2e0f3501-d9fb-4989-bebd-a19fdafdccf7:
position:
x: 573
y: 253
size:
height: 60
width: 60
z: 1
2e7b5fac-7900-4b7a-90e9-90af79fe4ea5:
source:
id: bb743e5e-8271-4e68-90fc-31c028226c76
target:
id: f256a7cd-0a42-4f54-9fb1-99a6e0890bfd
z: 1
3bdda3ab-f3d4-4972-8a91-1e85c4de2e21:
source:
id: 62342323-7c86-4614-83b3-c9cf269a54db
target:
id: fbec0150-9bfb-48bb-9b94-37dbd4d0908a
z: 1
3c3a27ea-d564-44da-a601-cb8637ff60a9:
position:
x: 1088
y: 359
size:
height: 60
width: 60
z: 2
43c602ee-7b62-4350-8989-8e9b12eb68c5:
source:
id: 62342323-7c86-4614-83b3-c9cf269a54db
target:
id: bb743e5e-8271-4e68-90fc-31c028226c76
z: 1
457fc7e8-5117-427b-ba89-32f337da9b3b:
source:
id: 62342323-7c86-4614-83b3-c9cf269a54db
target:
id: 694e279c-cc9a-4ee8-8d0a-fa54c0d61fef
z: 1
492443ed-87d9-46f2-a992-c2aadcc78b58:
position:
x: 1088
y: 108
size:
height: 60
width: 60
z: 2
62342323-7c86-4614-83b3-c9cf269a54db:
position:
x: 578
y: 89
size:
height: 60
width: 60
z: 1
694e279c-cc9a-4ee8-8d0a-fa54c0d61fef:
position:
x: 228
y: 193
size: