-
Notifications
You must be signed in to change notification settings - Fork 35
/
cen.yml
330 lines (330 loc) · 8.25 KB
/
cen.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建CEN实例及带宽包,关联VPC,配置路由条目和路由策略,实现多地域VPC间互联与流量控制。
en: Create CEN instances and bandwidth packages, associate them with VPCs, configure
route entries and routing policies to enable interconnectivity between multi-region
VPCs and implement traffic control.
Parameters:
CenName:
Type: String
Description: CenInstance Name.
Default: mytest
Priority:
Type: Number
Default: 3
VpcName:
Type: String
Default: mytest
VSwitchName:
Type: String
Default: mytest
ZoneId:
Type: String
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
GeographicRegionAId:
Type: String
Description: The other area A to connect.
Default: China
AllowedValues:
- China
- North-America
- Asia-Pacific
- Europe
- Australia
GeographicRegionBId:
Type: String
Description: The other area B to connect.
Default: China
AllowedValues:
- China
- North-America
- Asia-Pacific
- Europe
- Australia
Bandwidth:
Type: Number
Description: The bandwidth in Mbps of the bandwidth package. The bandwidth cannot
be less than 2 Mbps.
Default: 2
MinValue: 2
MaxValue: 1000
OppositeRegionId:
Type: String
Description: The ID of the other interconnected region.
Default: cn-beijing
OppositeChildInstanceId:
Type: String
Description: The ID of the network to attach.
DestinationRouteTableIds:
Type: String
Description: The ID of the network to attach.
BandwidthLimit:
Type: Number
Description: 'The bandwidth configured for the interconnected regions communication.
Minimal value: 1'
Default: 1
MinValue: 1
CcnName:
Type: String
Description: The name can contain 2 to 128 characters including a-z, A-Z, 0-9,
chinese, underlines, and hyphens. The name must start with an English letter,
but cannot start with http:// or https://.
Default: test123321
CenUid:
Type: String
TransmitDirection:
Type: String
Description: "The direction in which the route map is applied. Valid values: \n\
\ RegionIn: Routes are advertised to CEN gateways. \n For example, routes are\
\ advertised from network instances deployed in the current region or other\
\ regions to the gateways deployed in the current region. \n RegionOut: Routes\
\ are advertised from CEN gateways. \n For example, routes are advertised from\
\ gateways deployed in the current region to network instances or gateways deployed\
\ in other regions."
Default: RegionIn
MapResult:
Type: String
Description: "The route map behavior after all conditions are matched. Valid values:\
\ \n Permit: allows the routes that are matched. \n Deny: rejects the routes\
\ that are matched."
Default: Permit
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Ref: VpcName
CidrBlock: 192.168.0.0/16
Vpc2:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Fn::Join:
- ''
- - VpcName
- Ref: ALIYUN::StackId
CidrBlock: 192.168.0.0/16
VpcDestination:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Ref: VpcName
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock: 192.168.100.0/24
VSwitchName:
Ref: VSwitchName
CenInstance:
Type: ALIYUN::CEN::CenInstance
Properties:
Name:
Ref: CenName
CenBandPackage:
Type: ALIYUN::CEN::CenBandwidthPackage
Properties:
GeographicRegionAId:
Ref: GeographicRegionAId
GeographicRegionBId:
Ref: GeographicRegionBId
Bandwidth:
Ref: Bandwidth
BandwidthPackageChargeType: POSTPAY
CenBandwidthPackageAssociation:
Type: ALIYUN::CEN::CenBandwidthPackageAssociation
Properties:
CenId:
Ref: CenInstance
CenBandwidthPackageId:
Ref: CenBandPackage
DependsOn:
- CenBandPackage
- CenInstance
CenInstanceAttachmentLocalVpc:
Type: ALIYUN::CEN::CenInstanceAttachment
Properties:
ChildInstanceRegionId:
Ref: ALIYUN::Region
ChildInstanceType: VPC
ChildInstanceId:
Ref: Vpc
CenId:
Ref: CenInstance
DependsOn:
- CenInstance
- VSwitch
CenInstanceAttachmentOppositeVpc:
Type: ALIYUN::CEN::CenInstanceAttachment
Properties:
ChildInstanceRegionId:
Ref: OppositeRegionId
ChildInstanceType: VPC
ChildInstanceId:
Ref: OppositeChildInstanceId
CenId:
Ref: CenInstance
DependsOn:
- CenInstance
- Vpc
CenBandwidthLimit:
Type: ALIYUN::CEN::CenBandwidthLimit
Properties:
OppositeRegionId:
Ref: OppositeRegionId
CenId:
Ref: CenInstance
BandwidthLimit:
Ref: BandwidthLimit
LocalRegionId:
Ref: ALIYUN::Region
DependsOn:
- CenBandwidthPackageAssociation
- CenInstanceAttachmentLocalVpc
- CenInstanceAttachmentOppositeVpc
RouteEntry:
Type: ALIYUN::CEN::RouteEntry
Properties:
ChildInstanceRegionId:
Ref: ALIYUN::Region
CenId:
Ref: CenInstance
DestinationCidrBlock: 192.168.100.0/24
ChildInstanceRouteTableId:
Fn::GetAtt:
- Vpc
- RouteTableId
ChildInstanceType: VPC
ChildInstanceId:
Fn::GetAtt:
- Vpc
- VpcId
DependsOn:
- CenBandwidthLimit
CloudConnectNetwork:
Type: ALIYUN::SAG::CloudConnectNetwork
Properties:
Description: Test
Name:
Ref: CcnName
GrantCcnToCen:
Type: ALIYUN::SAG::GrantCcnToCen
Properties:
CenInstanceId:
Fn::GetAtt:
- CenInstance
- CenId
CenUid:
Ref: CenUid
CcnInstanceId:
Fn::GetAtt:
- CloudConnectNetwork
- CcnId
DependsOn:
- CenInstance
- CloudConnectNetwork
GrantInstanceToCen:
Type: ALIYUN::VPC::GrantInstanceToCen
Properties:
InstanceId:
Ref: Vpc
CenOwnerId:
Ref: CenUid
CenId:
Fn::GetAtt:
- CenInstance
- CenId
InstanceType: VPC
DependsOn: CenInstance
CENCenRouteMap:
Type: ALIYUN::CEN::CenRouteMap
Properties:
Description: Test123
SourceInstanceIdsReverseMatch: true
TransmitDirection:
Ref: TransmitDirection
MatchCommunitySet:
- '65501:1'
SourceRegionIds:
- Ref: ALIYUN::Region
CommunityMatchMode: Include
CenRegionId:
Ref: ALIYUN::Region
SourceRouteTableIds:
- Fn::GetAtt:
- Vpc
- RouteTableId
DestinationRouteTableIds:
- Ref: DestinationRouteTableIds
SourceInstanceIds:
- Ref: Vpc
- Ref: Vpc2
DestinationInstanceIds:
- Ref: OppositeChildInstanceId
Priority:
Ref: Priority
CenId:
Ref: CenInstance
NextPriority: 20
DestinationInstanceIdsReverseMatch: false
MapResult:
Ref: MapResult
SourceChildInstanceTypes:
- VPC
DestinationChildInstanceTypes:
- VPC
DestinationCidrBlocks:
- 1.1.1.0/10
CidrMatchMode: Include
RouteTypes:
- System
MatchAsns:
- 65501
AsPathMatchMode: Include
CommunityOperateMode: Additive
OperateCommunitySet:
- '65501:1'
Preference: 22
PrependAsPath:
- '65501'
DependsOn:
- CenInstanceAttachmentLocalVpc
- GrantCcnToCen
- GrantInstanceToCen
- RouteEntry
Outputs:
CenId:
Value:
Fn::GetAtt:
- CenInstance
- CenId
CenBandwidthPackageId:
Description: The ID of the bandwidth package.
Value:
Fn::GetAtt:
- CenBandPackage
- CenBandwidthPackageId
CcnId:
Description: The ID of the CCN instance.
Value:
Fn::GetAtt:
- CloudConnectNetwork
- CcnId
InstanceId:
Description: The ID of the network instance.
Value:
Fn::GetAtt:
- GrantInstanceToCen
- InstanceId
RouteMapId:
Description: The ID of the route map.
Value:
Fn::GetAtt:
- CENCenRouteMap
- RouteMapId