-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtemplate.yml
241 lines (241 loc) · 5.53 KB
/
template.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
ROSTemplateFormatVersion: '2015-09-01'
Transform: 'Aliyun::Serverless-2018-04-03'
Parameters:
Password:
Type: String
Default: masteruser_123
VpcName:
Type: String
Default: myVPC
CidrBlock:
Type: String
Default: 192.168.0.0/16
DBName:
Type: String
Default: admin
Mappings:
RegionMap:
cn-shanghai:
ZoneId: cn-shanghai-e
cn-hangzhou:
ZoneId: cn-hangzhou-g
cn-qingdao:
ZoneId: cn-qingdao-c
cn-beijing:
ZoneId: cn-beijing-c
cn-zhangjiakou:
ZoneId: cn-zhangjiakou-b
cn-huhehaote:
ZoneId: cn-huhehaote-a
cn-shenzhen:
ZoneId: cn-shenzhen-d
cn-hongkong:
ZoneId: cn-hongkong-c
ap-southeast-1:
ZoneId: ap-southeast-1a
ap-southeast-2:
ZoneId: ap-southeast-2a
ap-southeast-5:
ZoneId: ap-southeast-5a
ap-northeast-1:
ZoneId: ap-northeast-1a
eu-central-a:
ZoneId: eu-central-a
us-west-1:
ZoneId: us-west-1a
us-east-1:
ZoneId: us-east-1a
ap-south-1:
ZoneId: ap-south-1a
Resources:
EcsVpc:
Type: 'ALIYUN::ECS::VPC'
Properties:
CidrBlock:
Ref: CidrBlock
VpcName:
Ref: VpcName
VSwitch1:
Type: 'ALIYUN::ECS::VSwitch'
Properties:
VpcId:
'Fn::GetAtt':
- EcsVpc
- VpcId
ZoneId:
'Fn::FindInMap':
- RegionMap
- Ref: 'ALIYUN::Region'
- ZoneId
CidrBlock: 192.168.1.0/24
VSwitchName: VSwitch1-x
SecurityGroup_default:
Type: 'ALIYUN::ECS::SecurityGroup'
Properties:
VpcId:
'Fn::GetAtt':
- EcsVpc
- VpcId
SecurityGroupName: AliyunECS_SecurityGroup1
SecurityGroupIngress:
- PortRange: 22/22
Priority: 1
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: internet
SecurityGroupEgress:
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
DestCidrIp: 0.0.0.0/0
NicType: internet
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
DestCidrIp: 0.0.0.0/0
NicType: intranet
Mongo:
Type: 'ALIYUN::MONGODB::Instance'
Properties:
EngineVersion: '4.2'
DBInstanceClass: dds.mongo.mid
DBInstanceStorage: 10
VpcId:
'Fn::GetAtt':
- EcsVpc
- VpcId
ZoneId:
'Fn::FindInMap':
- RegionMap
- Ref: 'ALIYUN::Region'
- ZoneId
VSwitchId:
'Fn::GetAtt':
- VSwitch1
- VSwitchId
SecurityIPArray: '192.168.1.0/24'
AccountPassword:
Ref: Password
ChargeType: PostPaid
NetworkType: VPC
DatabaseNames:
Ref: DBName
fc-mongo:
Type: 'Aliyun::Serverless::Service'
Properties:
Description: This is FC service for mongo
VpcConfig:
VpcId:
'Fn::GetAtt':
- EcsVpc
- VpcId
VSwitchIds:
- 'Fn::GetAtt':
- VSwitch1
- VSwitchId
SecurityGroupId:
'Fn::GetAtt':
- SecurityGroup_default
- SecurityGroupId
java:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: 'example.App::handleRequest'
Runtime: java8
Timeout: 60
MemorySize: 512
CodeUri: java/
EnvironmentVariables:
MONGO_URL:
'Fn::GetAtt':
- Mongo
- ConnectionURI
MONGO_DATABASE:
Ref: DBName
nodejs:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs10
CodeUri: nodejs/
MemorySize: 128
Timeout: 15
EnvironmentVariables:
MONGO_URL:
'Fn::GetAtt':
- Mongo
- ConnectionURI
MONGO_DATABASE:
Ref: DBName
python:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: 'index.handler'
Runtime: python3
Timeout: 10
MemorySize: 128
CodeUri: python/
EnvironmentVariables:
MONGO_URL:
'Fn::GetAtt':
- Mongo
- ConnectionURI
MONGO_DATABASE:
Ref: DBName
PYTHONPATH: /code/.fun/python/lib/python/site-packages
php:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: 'index.handler'
Runtime: php7.2
Timeout: 10
MemorySize: 128
CodeUri: 'php'
EnvironmentVariables:
MONGO_URL:
'Fn::GetAtt':
- Mongo
- ConnectionURI
MONGO_DATABASE:
Ref: DBName
dotnetcore:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: 'mongodb::mongodb.MongoDBHandler::Handler'
Runtime: dotnetcore2.1
Timeout: 60
MemorySize: 512
CodeUri: ./dotnetcore
EnvironmentVariables:
MONGO_URL:
'Fn::GetAtt':
- Mongo
- ConnectionURI
MONGO_DATABASE:
Ref: DBName
Outputs:
VpcId:
Value:
'Fn::GetAtt':
- EcsVpc
- VpcId
SecurityGroupId:
Value:
'Fn::GetAtt':
- SecurityGroup_default
- SecurityGroupId
VSwitchId:
Value:
'Fn::GetAtt':
- VSwitch1
- VSwitchId
MongoInstanceId:
Value:
'Fn::GetAtt':
- Mongo
- DBInstanceId
MongoConnectionURI:
Value:
'Fn::GetAtt':
- Mongo
- ConnectionURI