forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fc-mini-program-backend-service.yml
1445 lines (1433 loc) · 39.9 KB
/
fc-mini-program-backend-service.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: 搭建无服务器后端服务,包括OSS静态资源CDN加速、API网关集成函数计算访问RDS,自动扩展资源,支持移动App、小程序和Web应用。
en: Build serverless back-end services, including CDN acceleration of OSS static resources, API gateway integrated function computing to access RDS, automatic expansion of resources, and support for mobile apps, mini programs, and web applications.
Conditions:
IsCreateDomainRecord:
Fn::Not:
Fn::Equals:
- Ref: DnsDomainName
- default
Parameters:
DnsDomainName:
Type: String
Label:
en: Top-level Domain Name
zh-cn: 顶级域名
Description:
en: Top-level domain names,Domain name resolution and acceleration are not performed
when the default value is default。<br><b>note:<font color='blue'>Domain names
need to be registered domain names, Such as“test.com”</b></font>
zh-cn: 顶级域名,默认值default时不做域名解析及加速。<br><b>注:<font color='blue'>域名需要是已经备案的域名, 如“test.com”</b></font>
Default: default
DomainNamePrefix:
Type: String
Label:
en: API Gateway Binding Domain Prefix
zh-cn: API网关绑定的域名前缀
Description:
en: API gateway binding domain prefix;<br><b>note:<font color='blue'>values:“api.test.com”,Fill
in the“api”</b></font>
zh-cn: API网关分组绑定的域名前缀;<br><b>注:<font color='blue'>如取值“api.test.com”,填写“api”</b></font>
Default: api
MinLength: 1
CdnDomainNamePrefix:
Type: String
Label:
en: CDN Accelerated Domain Prefix
zh-cn: CDN加速的域名前缀
Description:
en: CDN speeds up the domain prefix of image small files
zh-cn: CDN加速图片小文件的域名前缀。
Default: img
CdnDomainScope:
Type: String
Label:
en: Accelerating Regional
zh-cn: 加速区域
Description:
en: '<font color=''blue''><b>Optional values: </b></font><br>[domestic:<font
color=''green''>Mainland China alone</font>]<br>[overseas:<font color=''green''>Global
(excluding mainland China)</font>]<br>[global:<font color=''green''>global</font>]<br><font
color=''blue''></a>'
zh-cn: '<font color=''blue''><b>可选值: </b></font><br>[domestic:<font color=''green''>仅中国大陆</font>]<br>[overseas:<font
color=''green''>全球(不包含中国大陆)</font>]<br>[global:<font color=''green''>全球</font>]<br><font
color=''blue''></a>'
Default: domestic
AllowedValues:
- domestic
- overseas
- global
BucketName:
Type: String
Label:
en: Bucket Name
zh-cn: 存储空间名称
Description:
en: The name must be 3 to 63 bytes in length, The name must start and end with
a lowercase letter or digit.The name can contain only lowercase letters, digits,
and hyphens (-);<br><b>note:<font color='blue'>A bucket name must be globally
unique within OSS. Bucket names cannot be changed after the bucket is created.</b></font>
zh-cn: 长度为3~63个字符,必须以小写字母或数字开头和结尾,可以包含小写字母、数字和连字符(-);<br><font color='blue'><b>注:需要全网唯一性,已经存在的不能在创建</b></font>
Default: static-resource-1-test-domain
BucketAccessControl:
Type: String
Label:
en: Access Control List
zh-cn: 读写权限
Description:
en: '<font color=''blue''><b>Optional values: </b></font><br>[private:<font
color=''green''>All access to the file requires authentication。</font>]<br>[public-read:<font
color=''green''>File writes need to be authenticated;Files can be read anonymously。</font>]<br>[public-read-write:<font
color=''green''>Anyone (including anonymous visitors) can perform read and
write operators on the files in the bucket.</font>]'
zh-cn: '<font color=''blue''><b>可选值: </b></font><br>[private:<font color=''green''>对文件的所有访问操作需要进行身份验证。</font>]<br>[public-read:<font
color=''green''>对文件写操作需要进行身份验证;可以对文件进行匿名读。</font>]<br>[public-read-write:<font
color=''green''>所有人都可以对文件进行读写操作。</font>]'
Default: private
AllowedValues:
- private
- public-read
- public-read-write
DeletionForce:
Type: Boolean
Label:
en: Support for Force Deletion
zh-cn: 支持强制删除
Description:
en: Do you want to force the deletion of files in OSS?
zh-cn: 是否强制删除OSS中的文件
Default: false
VSw2Zone:
Type: String
Label:
en: VSwitch 2 Availability Zone
zh-cn: 交换机2可用区
Description:
en: Availability Zone ID,<br><b><font color='red'>note</font>: <font color='blue'>Due
to FC providing fewer availability zones,<br>Before selecting, please confirm
that the Availability Zone supports the specification of creating FC resources.</font></b>
zh-cn: 可用区ID。<br><b><font color='red'>注</font>: <font color='blue'>由于FC提供较少的可用区,<br>选择可用区前请确认该可用区是否支持创建FC资源。</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Function1Name:
Type: String
Label:
en: Function 1 Name
zh-cn: 函数1名称
Description:
en: With the same name as API-1, it has 1 to 128 characters and cannot begin
with a number or middle dash, but contains letters, Numbers, underscores,
and middle dash.
zh-cn: 与API-1的名称相同,1~128个字符,不能以数字、中划线开头,包含字母、数字、下划线和中划线。
ConstraintDescription:
en: 1 to 128 characters, including letters, Numbers, underscores, and middle
lines. Do not begin with Numbers or middle lines.
zh-cn: 1~128个字符,包含字母、数字、下划线和中划线,不能以数字、中划线开头。
Default: sign_up
MinLength: 1
MaxLength: 128
Function2Name:
Type: String
Label:
en: Function 2 Name
zh-cn: 函数2名称
Description:
en: With the same name as API-2, it has 1 to 128 characters and cannot begin
with a number or middle dash, but contains letters, Numbers, underscores,
and middle dash.
zh-cn: 与API-2的名称相同,1~128个字符,不能以数字、中划线开头,包含字母、数字、下划线和中划线。
ConstraintDescription:
en: 1 to 128 characters, including letters, Numbers, underscores, and middle
lines. Do not begin with Numbers or middle lines.
zh-cn: 1~128个字符,包含字母、数字、下划线和中划线,不能以数字、中划线开头。
Default: login
MinLength: 1
MaxLength: 128
Function3Name:
Type: String
Label:
en: Function 3 Name
zh-cn: 函数3名称
Description:
en: With the same name as API-3, it has 1 to 128 characters and cannot begin
with a number or middle dash, but contains letters, Numbers, underscores,
and middle dash.
zh-cn: 与API-3的名称相同,1~128个字符,不能以数字、中划线开头,包含字母、数字、下划线和中划线。
ConstraintDescription:
en: 1 to 128 characters, including letters, Numbers, underscores, and middle
lines. Do not begin with Numbers or middle lines.
zh-cn: 1~128个字符,包含字母、数字、下划线和中划线,不能以数字、中划线开头。
Default: avatar_setting
MinLength: 1
MaxLength: 128
Api1RequestHttpMethod:
Type: String
Label:
en: HTTP Method
zh-cn: HTTP请求方法
Description:
en: HTTP Method
zh-cn: HTTP请求方法。
Default: POST
AllowedValues:
- GET
- POST
- DELETE
- PUT
- HEADER
- PATCH
- OPTIONS
Api1RequestProtocol:
Type: String
Label:
en: Request Protocol
zh-cn: 请求协议
Description:
en: HTTP request protocol
zh-cn: HTTP请求协议
Default: HTTP,HTTPS
AllowedValues:
- HTTP
- HTTPS
- HTTP,HTTPS
Api1RequestPath:
Type: String
Label:
en: API-1 Request Path
zh-cn: API-1请求Path
Description:
en: The request path must contain the parameter path in the request parameters,
contained in [], such as /getUserInfo/[userId], not starting with x-ca.
zh-cn: 请求Path必须包含请求参数中的Parameter path,包含在[]中,比如/getUserInfo/[userId],不能以x-ca开头。
Default: /signUp
MinLength: 1
Api2RequestPath:
Type: String
Label:
en: API-2 Request Path
zh-cn: API-2请求Path
Description:
en: The request Path must contain the parameter path in the request parameters,
contained in [], such as /getUserInfo/[userId], not starting with x-ca.
zh-cn: 请求Path必须包含请求参数中的Parameter Path,包含在[]中,比如/getUserInfo/[userId],不能以x-ca开头。
Default: /login
MinLength: 1
Api3RequestPath:
Type: String
Label:
en: API-3 Request Path
zh-cn: API-3请求Path
Description:
en: The request path must contain the parameter path in the request parameters,
contained in [], such as /getUserInfo/[userId], not starting with x-ca.
zh-cn: 请求Path必须包含请求参数中的Parameter Path,包含在[]中,比如/getUserInfo/[userId],不能以x-ca开头。
Default: /avatarSetting
MinLength: 1
VSw1Zone:
Type: String
Label:
en: VSwitch 1 Availability Zone
zh-cn: 交换机1可用区
Description:
en: Availability Zone ID,<br><b>note: <font color='blue'>Before selecting, please
confirm that the Availability Zone supports the specification of creating
RDS resources.</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择可用区前请确认该可用区是否支持创建RDS资源。</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
DBInstanceEngineAndVersion:
Type: String
Label:
en: Type And Version
zh-cn: 类型与版本号
Description:
en: Database type and version number.
zh-cn: 数据库类型与版本号。
Default: MySQL-5.6
AllowedValues:
- MySQL-5.5
- MySQL-5.6
- MySQL-5.7
- MySQL-8.0
DBInstanceClass:
Type: String
Label:
en: Instance Specification
zh-cn: 实例规格
Description:
en: 'Select the instance specification based on the type of database engine
and the available area support;<br>See detail: <a href=''https://www.alibabacloud.com/help/doc-detail/26312.htm''
target=''_blank''><b><font color=''blue''>Instance specification sheet</font></b></a>'
zh-cn: 根据数据库引擎的类型和可用的区域支持选择实例规格;<br>请参见详细信息:<a href='https://help.aliyun.com/document_detail/26312.html'
target='_blank'><b><font color='blue'>实例规格表</font></b></a>
Default: rds.mysql.s2.large
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。
ConstraintDescription:
en: 'Value range: 5-1000, per 5GB increment.'
zh-cn: 取值范围:5-1000,每5GB进行递增。
Default: 5
MinValue: 5
MaxValue: 1000
DBName:
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: dbname01
RdsUserName:
Type: String
Label:
en: Database Account
zh-cn: 数据库账号
Description:
en: Database read-write account, consist of 2-16 characters, consisting of lowercase
letters, Numbers, underscores, beginning letters, and ending letters or Numbers.
zh-cn: 数据库可读写的账号,2-16个字符, 由小写字母,数字、下划线组成、字母开头,字母或数字结尾。
ConstraintDescription:
en: Database read-write account, consist of 2-16 characters, consisting of lowercase
letters, Numbers, underscores, beginning letters, and ending letters or Numbers.
zh-cn: 数据库可读写的账号,2-16个字符, 由小写字母,数字、下划线组成、字母开头,字母或数字结尾。
Default: myuser
MinLength: 2
MaxLength: 16
RdsUserPassword:
Type: String
Label:
en: Account Password
zh-cn: 账号密码
Description:
en: Length 8-32, can contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*_-+=| {}[]:;' <>,.? / Special symbol in).
zh-cn: 长度8-32,可包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: '8-32 characters, can contain size letters, Numbers and special symbols
(including:!@ # $% ^ & * - + = _).'
zh-cn: 8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
MinLength: 8
MaxLength: 32
NoEcho: true
Resources:
ApiGateWayGroup:
Type: ALIYUN::ApiGateway::Group
Properties:
InstanceId: api-shared-vpc-001
GroupName:
Fn::Join:
- _
- - StackId
- Fn::Replace:
- '-': _
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: b75c55d1-9a93-43df-8886-59692c3b9a23
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 2547c704-f5bd-4014-a8d3-1697b887b896
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: EcsVpc
SecurityGroupIngress:
- IpProtocol: icmp
NicType: internet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: internet
PortRange: 80/80
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: internet
PortRange: 443/443
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: internet
PortRange: 22/22
Priority: 1
SourceCidrIp: 0.0.0.0/0
SecurityGroupName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Tags:
- Key: best_practice
Value: '024'
Metadata:
ALIYUN::ROS::Designer:
id: e67c36dd-5137-4e56-8d2e-56c8cb2e0ea8
EcsVSwitch2:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSw2Zone
VpcId:
Ref: EcsVpc
CidrBlock: 192.168.1.0/24
VSwitchName:
Fn::Join:
- '-'
- - VSwitch2
- StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 01a5abe8-c2be-4932-92d6-f674f1c802b8
RamRole:
Type: ALIYUN::RAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service:
- fc.aliyuncs.com
- apigateway.aliyuncs.com
- oss.aliyuncs.com
- cdn.aliyuncs.com
Version: '1'
Policies:
- PolicyDocument:
Statement:
- Action:
- vpc:DescribeVSwitchAttributes
Effect: Allow
Resource:
- '*'
- Action:
- ecs:CreateNetworkInterface
- ecs:DeleteNetworkInterface
- ecs:DescribeNetworkInterfaces
- ecs:CreateNetworkInterfacePermission
- ecs:DescribeNetworkInterfacePermissions
- ecs:DeleteNetworkInterfacePermission
Effect: Allow
Resource:
- '*'
- Action:
- rds:*
Effect: Allow
Resource:
- '*'
- Action:
- fc:InvokeFunction
Effect: Allow
Resource:
- '*'
- Action:
- oss:*
Effect: Allow
Resource:
- '*'
Version: '1'
PolicyName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
RoleName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 986f262f-e65c-4a2c-a73e-c606aad98858
FcService:
Type: ALIYUN::FC::Service
Properties:
InternetAccess: true
Role:
Fn::GetAtt:
- RamRole
- Arn
ServiceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
VpcConfig:
SecurityGroupId:
Ref: EcsSecurityGroup
VSwitchIds:
- Ref: EcsVSwitch2
VpcId:
Ref: EcsVpc
DependsOn:
- RamRole
Metadata:
ALIYUN::ROS::Designer:
id: a1d7246e-ff49-45be-bee5-845d12097a8d
FcFunction1:
Type: ALIYUN::FC::Function
Properties:
Code:
SourceCode: |-
# -*- coding: utf-8 -*-
def handler(event, context):
return 'hello Function1'
if __name__ == '__main__':
handler()
FunctionName:
Ref: Function1Name
Handler: index.handler
MemorySize: 512
Runtime: python2.7
ServiceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Timeout: 60
DependsOn:
- FcService
Metadata:
ALIYUN::ROS::Designer:
id: 2d0ebdca-9e6d-4bfd-9add-a7a62866eedb
ApiGatewayApi1:
Type: ALIYUN::ApiGateway::Api
Properties:
ApiName:
Ref: Function1Name
AuthType: APP
GroupId:
Ref: ApiGateWayGroup
RequestConfig:
BodyFormat: FORM
RequestHttpMethod:
Ref: Api1RequestHttpMethod
RequestMode: MAPPING
RequestPath:
Ref: Api1RequestPath
RequestProtocol:
Ref: Api1RequestProtocol
ResultSample: '{''Msg'': ''Success''}'
ResultType: JSON
ServiceConfig:
ContentTypeCatagory: CLIENT
FunctionComputeConfig:
fcRegionId:
Ref: ALIYUN::Region
functionName:
Ref: Function1Name
roleArn:
Fn::GetAtt:
- RamRole
- Arn
serviceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
ServiceProtocol: FunctionCompute
Visibility: PUBLIC
DependsOn:
- ApiGateWayGroup
- FcFunction1
- FcService
Metadata:
ALIYUN::ROS::Designer:
id: 891f4ea5-66d7-415c-afd0-92acf8fb6ddf
ApiGatewayApi2:
Type: ALIYUN::ApiGateway::Api
Properties:
ApiName:
Ref: Function2Name
AuthType: APP
GroupId:
Ref: ApiGateWayGroup
RequestConfig:
BodyFormat: FORM
RequestHttpMethod:
Ref: Api1RequestHttpMethod
RequestMode: MAPPING
RequestPath:
Ref: Api2RequestPath
RequestProtocol:
Ref: Api1RequestProtocol
ResultSample: '{''Msg'': ''Success''}'
ResultType: JSON
ServiceConfig:
ContentTypeCatagory: CLIENT
FunctionComputeConfig:
fcRegionId:
Ref: ALIYUN::Region
functionName:
Ref: Function2Name
roleArn:
Fn::GetAtt:
- RamRole
- Arn
serviceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
ServiceProtocol: FunctionCompute
Visibility: PUBLIC
DependsOn:
- ApiGateWayGroup
- FcFunction1
- FcService
Metadata:
ALIYUN::ROS::Designer:
id: 2e22ec07-a875-4fee-a5cb-b022cac63601
ApiGatewayApi3:
Type: ALIYUN::ApiGateway::Api
Properties:
ApiName:
Ref: Function3Name
AuthType: APP
GroupId:
Ref: ApiGateWayGroup
RequestConfig:
BodyFormat: FORM
RequestHttpMethod:
Ref: Api1RequestHttpMethod
RequestMode: MAPPING
RequestPath:
Ref: Api3RequestPath
RequestProtocol:
Ref: Api1RequestProtocol
ResultSample: '{''Msg'': ''Success''}'
ResultType: JSON
ServiceConfig:
ContentTypeCatagory: CLIENT
FunctionComputeConfig:
fcRegionId:
Ref: ALIYUN::Region
functionName:
Ref: Function3Name
roleArn:
Fn::GetAtt:
- RamRole
- Arn
serviceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
ServiceProtocol: FunctionCompute
Visibility: PUBLIC
DependsOn:
- ApiGateWayGroup
- FcFunction1
- FcService
Metadata:
ALIYUN::ROS::Designer:
id: 7a8e6d68-f2f8-4847-9e84-8d4d027da6c7
ApiGatewayApp1:
Type: ALIYUN::ApiGateway::App
Properties:
AppName: first_test_app
Metadata:
ALIYUN::ROS::Designer:
id: a08ffa2e-912e-4e98-bdc1-bf9b5fa054db
ApiGatewayApp2:
Type: ALIYUN::ApiGateway::App
Properties:
AppName: second_test_app
Metadata:
ALIYUN::ROS::Designer:
id: c8842bed-0a51-4e49-b0f9-e34c7ac662f9
ApiGatewayApp3:
Type: ALIYUN::ApiGateway::App
Properties:
AppName: third_test_app
Metadata:
ALIYUN::ROS::Designer:
id: 00afa2e0-ec89-4ffe-8d3d-d36eb4231da4
ApiGatewayAuthorization:
Type: ALIYUN::ApiGateway::Authorization
Properties:
ApiIds:
- Ref: ApiGatewayApi1
- Ref: ApiGatewayApi2
- Ref: ApiGatewayApi3
AppIds:
- Ref: ApiGatewayApp1
- Ref: ApiGatewayApp2
- Ref: ApiGatewayApp3
GroupId:
Ref: ApiGateWayGroup
StageName: TEST
Metadata:
ALIYUN::ROS::Designer:
id: ac8b1a29-778c-41af-9111-3fdbdf73aa6d
ApiGatewayDeployment1:
Type: ALIYUN::ApiGateway::Deployment
Properties:
ApiId:
Ref: ApiGatewayApi1
Description: first test
GroupId:
Ref: ApiGateWayGroup
StageName: TEST
Metadata:
ALIYUN::ROS::Designer:
id: c8006fe0-fe3b-495a-ad98-89ed421d59dc
ApiGatewayDeployment2:
Type: ALIYUN::ApiGateway::Deployment
Properties:
ApiId:
Ref: ApiGatewayApi2
Description: first test
GroupId:
Ref: ApiGateWayGroup
StageName: TEST
Metadata:
ALIYUN::ROS::Designer:
id: e1a3cf19-cf14-4645-9d2a-90bd421a73a8
ApiGatewayDeployment3:
Type: ALIYUN::ApiGateway::Deployment
Properties:
ApiId:
Ref: ApiGatewayApi3
Description: first test
GroupId:
Ref: ApiGateWayGroup
StageName: TEST
Metadata:
ALIYUN::ROS::Designer:
id: f87f2d65-27ec-4284-8057-1e1515e928c5
OssBucket:
Type: ALIYUN::OSS::Bucket
Properties:
AccessControl:
Ref: BucketAccessControl
BucketName:
Ref: BucketName
DeletionForce:
Ref: DeletionForce
StorageClass: Standard
Tags:
Key: best_practice
Value: '024'
Metadata:
ALIYUN::ROS::Designer:
id: 1a39b75d-7715-45c4-b2c8-423a7cc555fb
CdnDomain:
Type: ALIYUN::CDN::Domain
Condition: IsCreateDomainRecord
Properties:
CdnType: web
DomainName:
Fn::Join:
- .
- - Ref: CdnDomainNamePrefix
- Ref: DnsDomainName
Scope:
Ref: CdnDomainScope
Sources:
Fn::Join:
- ''
- - '[{"content": "'
- Fn::GetAtt:
- OssBucket
- DomainName
- '",'
- '"type": "oss",'
- '"port": 80}]'
DependsOn:
- OssBucket
Metadata:
ALIYUN::ROS::Designer:
id: 1e7c5536-24f3-4c57-b79d-0ed965afd5b3
DnsDomainCnameRecord2Cdn:
Type: ALIYUN::DNS::DomainRecord
Condition: IsCreateDomainRecord
Properties:
DomainName:
Ref: DnsDomainName
RR:
Ref: CdnDomainNamePrefix
TTL: 600
Type: CNAME
Value:
Fn::GetAtt:
- CdnDomain
- Cname
DependsOn:
- CdnDomain
Metadata:
ALIYUN::ROS::Designer:
id: 1ad8dd07-da4a-4df8-bc55-31b4e5eeae7f
CdnDomainConfig:
Type: ALIYUN::CDN::DomainConfig
Condition: IsCreateDomainRecord
Properties:
DomainNames:
Fn::Join:
- .
- - Ref: CdnDomainNamePrefix
- Ref: DnsDomainName
Functions:
Fn::Join:
- ''
- - '[{"functionArgs": [{'
- '"argName": "oss_bucket_id",'
- '"argValue": "'
- Fn::GetAtt:
- OssBucket
- DomainName
- '"}],'
- '"functionName": "oss_auth"},'
- '{"functionArgs": [{'
- '"argName": "private_oss_auth",'
- '"argValue": "on"}],'
- '"functionName": "l2_oss_key"},'
- '{"functionArgs": [{"argName": "auth_type", "argValue": "no_auth"}], "functionName":
"aliauth"}]'
DependsOn:
- DnsDomainCnameRecord2Cdn
Metadata:
ALIYUN::ROS::Designer:
id: d90c5e2e-1259-4c9f-808f-0eeac3406431
DnsDomainCnameRecord1Api:
Type: ALIYUN::DNS::DomainRecord
Condition: IsCreateDomainRecord
Properties:
DomainName:
Ref: DnsDomainName
RR:
Ref: DomainNamePrefix
TTL: 600
Type: CNAME
Value:
Fn::GetAtt:
- ApiGateWayGroup
- SubDomain
DependsOn:
- ApiGateWayGroup
Metadata:
ALIYUN::ROS::Designer:
id: 679be93e-9396-4136-9db4-886c97f097b9
DnsDomainCnameRecord3Oss:
Type: ALIYUN::DNS::DomainRecord
Condition: IsCreateDomainRecord
Properties:
DomainName:
Ref: DnsDomainName
RR:
Ref: CdnDomainNamePrefix
TTL: 600
Type: CNAME
Value:
Fn::GetAtt:
- CdnDomain
- DomainName
DependsOn:
- CdnDomain
Metadata:
ALIYUN::ROS::Designer:
id: d3ad126b-15b2-46db-9ea4-dd7461c4012a
EcsVSwitch1:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSw1Zone
VpcId:
Ref: EcsVpc
CidrBlock: 192.168.0.0/24
VSwitchName:
Fn::Join:
- '-'
- - VSwitch1
- StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 993c66bd-cdab-420b-9281-d4b9de24a52c
FcFunction2:
Type: ALIYUN::FC::Function
Properties:
Code:
SourceCode: |-
# -*- coding: utf-8 -*-
def handler(event, context):
return 'hello Function2'
if __name__ == '__main__':
handler()
FunctionName:
Ref: Function2Name
Handler: index.handler
MemorySize: 512
Runtime: python2.7
ServiceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Timeout: 60
DependsOn:
- FcService
Metadata:
ALIYUN::ROS::Designer:
id: 5e8ac0ff-eff2-435f-a3eb-5033bf9cf940
FcFunction3:
Type: ALIYUN::FC::Function
Properties:
Code:
SourceCode: |-
# -*- coding: utf-8 -*-
def handler(event, context):
return 'hello Function3'
if __name__ == '__main__':
handler()
FunctionName:
Ref: Function3Name
Handler: index.handler
MemorySize: 512
Runtime: python2.7
ServiceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Timeout: 60
DependsOn:
- FcService
Metadata:
ALIYUN::ROS::Designer:
id: bc33fb85-42a6-488c-bd24-c7ce94cf47b3
RdsDBInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch1
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceStorage:
Ref: DBInstanceStorage
DBMappings:
- CharacterSetName: utf8
DBName:
Ref: DBName
Engine:
Fn::Select:
- '0'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
EngineVersion:
Fn::Select:
- '1'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
MasterUserPassword:
Ref: RdsUserPassword
MasterUserType: Normal
MasterUsername:
Ref: RdsUserName
SecurityIPList: 192.168.0.0/24
Tags:
Key: best_practice
Value: '024'
Metadata:
ALIYUN::ROS::Designer:
id: 0ea367ba-33d5-468f-a08f-83916fdb8e00
RdsAccountPrivilege:
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountName:
Ref: RdsUserName
AccountPrivilege: ReadWrite
DBInstanceId:
Ref: RdsDBInstance
DBName:
Ref: DBName
DependsOn:
- RdsDBInstance
Metadata:
ALIYUN::ROS::Designer:
id: 841f9962-ec3a-44c7-91e4-7c21a57040f8
Outputs:
ApiGateWayGroupName:
Description:
en: Api gateway group name
zh-cn: Api网关分组名称
Value:
Fn::Join:
- _
- - StackId
- Fn::Replace:
- '-': _
- Ref: ALIYUN::StackId
FcServiceName:
Description:
en: Function calculates the service name
zh-cn: 函数计算服务名称