-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc_v2.yaml
55 lines (46 loc) · 1.3 KB
/
vpc_v2.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
Description:
This template creates one VPC and two subnets. Each subnet belongs to one AvailabilityZone.
It also creates an InternetGateway and attaches is to the VPC.
Parameters:
VpcCidrBlock:
Type: String
Default: "10.100.0.0/16"
Description: "Input the VPC CIDR Block"
Subnet1CidrBlock:
Type: String
Default: "10.100.1.0/24"
Description: "Subnet 1 CIDR Block"
Subnet2CidrBlock:
Type: String
Default: "10.100.2.0/24"
Description: "Subnet 2 CIDR Block"
Resources:
GabiVPC:
Type: "AWS::EC2::VPC"
Properties:
CidrBlock: !Ref VpcCidrBlock
MyInternetGateway:
Type: "AWS::EC2::InternetGateway"
#Connect the VPC and the InternetGateway
IntGw2VPCconnection:
Type: "AWS::EC2::VPCGatewayAttachment"
Properties:
InternetGatewayId: !Ref MyInternetGateway
VpcId: !Ref GabiVPC
Subnet1:
Type: "AWS::EC2::Subnet"
Properties:
VpcId: !Ref GabiVPC
CidrBlock: !Ref Subnet1CidrBlock
MapPublicIpOnLaunch: True
AvailabilityZone: !Select [0, !GetAZs ]
# Fn::Select:
# - 0
# - Fn::GetAZs: ""
Subnet2:
Type: "AWS::EC2::Subnet"
Properties:
VpcId: !Ref GabiVPC
CidrBlock: !Ref Subnet2CidrBlock
MapPublicIpOnLaunch: True
AvailabilityZone: !Select [1, !GetAZs ]