-
Notifications
You must be signed in to change notification settings - Fork 35
/
snat-entry.yml
74 lines (74 loc) · 1.73 KB
/
snat-entry.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建VPC、交换机、EIP、NAT网关并关联EIP,设置SNAT条目,实现VPC内私有网络访问公网。
en: Create a VPC, configure subnets, provision Elastic IP (EIP) addresses, set up
a NAT Gateway, associate EIPs with the NAT Gateway, establish SNAT entries, thereby
enabling private network within the VPC to access the public internet.
Parameters:
VpcName:
Type: String
Description: VPC Name.
VSwitchName:
Type: String
Description: VSW Name.
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: 可用区ID
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Ref: VpcName
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchName:
Ref: VSwitchName
CidrBlock: 192.168.0.0/16
Eip:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
Bandwidth: '1'
NatGateway:
Type: ALIYUN::VPC::NatGateway
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
EIP_Association:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: NatGateway
AllocationId:
Ref: Eip
SNatTableEntry:
Type: ALIYUN::ECS::SNatEntry
Properties:
SNatTableId:
Fn::GetAtt:
- NatGateway
- SNatTableId
SNatIp:
Fn::GetAtt:
- EIP_Association
- EipAddress
SourceVSwitchId:
Ref: VSwitch
Outputs:
SNatEntryId:
Value:
Fn::GetAtt:
- SNatTableEntry
- SNatEntryId