forked from arpcefxl/getting-started-with-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-demo-vpc.yaml
177 lines (177 loc) · 4.01 KB
/
01-demo-vpc.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Description: ''
Resources:
VPC:
Type: 'AWS::EC2::VPC'
Properties:
CidrBlock: 10.1.0.0/16
EnableDnsHostnames: true
EnableDnsSupport: true
Tags:
- Key: Name
Value: demo-vpc
PublicSubnet1:
Type: 'AWS::EC2::Subnet'
Properties:
CidrBlock: 10.1.0.0/24
MapPublicIpOnLaunch: true
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Public Subnet AZ A
AvailabilityZone:
'Fn::Select':
- '0'
- 'Fn::GetAZs':
Ref: 'AWS::Region'
PublicSubnet2:
Type: 'AWS::EC2::Subnet'
Properties:
CidrBlock: 10.1.1.0/24
MapPublicIpOnLaunch: true
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Public Subnet AZ B
AvailabilityZone:
'Fn::Select':
- '1'
- 'Fn::GetAZs':
Ref: 'AWS::Region'
PrivateSubnet1:
Type: 'AWS::EC2::Subnet'
Properties:
CidrBlock: 10.1.10.0/24
MapPublicIpOnLaunch: false
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Private Subnet AZ A
AvailabilityZone:
'Fn::Select':
- '0'
- 'Fn::GetAZs':
Ref: 'AWS::Region'
PrivateSubnet2:
Type: 'AWS::EC2::Subnet'
Properties:
CidrBlock: 10.1.11.0/24
MapPublicIpOnLaunch: false
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Private Subnet AZ B
AvailabilityZone:
'Fn::Select':
- '1'
- 'Fn::GetAZs':
Ref: 'AWS::Region'
RouteTablePublic:
Type: 'AWS::EC2::RouteTable'
Properties:
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Public Route Table
RouteTablePublicAssociation1:
Type: 'AWS::EC2::SubnetRouteTableAssociation'
Properties:
RouteTableId:
Ref: RouteTablePublic
SubnetId:
Ref: PublicSubnet1
RouteTablePublicAssociation2:
Type: 'AWS::EC2::SubnetRouteTableAssociation'
Properties:
RouteTableId:
Ref: RouteTablePublic
SubnetId:
Ref: PublicSubnet2
RouteTablePublicRoute0:
Type: 'AWS::EC2::Route'
Properties:
DestinationCidrBlock: 0.0.0.0/0
RouteTableId:
Ref: RouteTablePublic
GatewayId:
Ref: Igw
RouteTablePrivate1:
Type: 'AWS::EC2::RouteTable'
Properties:
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Private Route Table A
RouteTablePrivate1Association1:
Type: 'AWS::EC2::SubnetRouteTableAssociation'
Properties:
RouteTableId:
Ref: RouteTablePrivate1
SubnetId:
Ref: PrivateSubnet1
RouteTablePrivate1Route0:
Type: 'AWS::EC2::Route'
Properties:
DestinationCidrBlock: 0.0.0.0/0
RouteTableId:
Ref: RouteTablePrivate1
NatGatewayId:
Ref: NatGw1
RouteTablePrivate2:
Type: 'AWS::EC2::RouteTable'
Properties:
VpcId:
Ref: VPC
Tags:
- Key: Name
Value: Private Route Table B
RouteTablePrivate2Association1:
Type: 'AWS::EC2::SubnetRouteTableAssociation'
Properties:
RouteTableId:
Ref: RouteTablePrivate2
SubnetId:
Ref: PrivateSubnet2
RouteTablePrivate2Route0:
Type: 'AWS::EC2::Route'
Properties:
DestinationCidrBlock: 0.0.0.0/0
RouteTableId:
Ref: RouteTablePrivate2
NatGatewayId:
Ref: NatGw1
Igw:
Type: 'AWS::EC2::InternetGateway'
Properties: {}
IGWAttachment:
Type: 'AWS::EC2::VPCGatewayAttachment'
Properties:
VpcId:
Ref: VPC
InternetGatewayId:
Ref: Igw
NatGw1:
Type: 'AWS::EC2::NatGateway'
Properties:
SubnetId:
Ref: PublicSubnet1
AllocationId:
'Fn::GetAtt':
- NatGw1ElasticIP
- AllocationId
Tags:
- Key: Name
Value: NAT GW A
NatGw1ElasticIP:
Type: 'AWS::EC2::EIP'
Properties:
Domain: vpc
Parameters: {}
Metadata: {}
Conditions: {}