-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVPC.yaml
46 lines (46 loc) · 1.24 KB
/
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
Description: Enables IPv6 addresses
Parameters:
VPCCidrBlock:
Type: String
Description: 'The /16 CIDR block for the VPC'
Default: 10.0.0.0/16
AllowedPattern: '(\d{1,3})\.(\d{1,3})\.0\.0/16'
ConstraintDescription: Must be a valid IP /16 CIDR block
Resources:
Vpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref VPCCidrBlock
Tags:
- Key: Name
Value: "Test VPC"
InternetGateway:
Type: AWS::EC2::InternetGateway
AttachGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref Vpc
InternetGatewayId: !Ref InternetGateway
PublicRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref Vpc
PublicRoute:
Type: AWS::EC2::Route
DependsOn: InternetGateway
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref InternetGateway
PublicSubnet:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !Select [0, !Cidr [!GetAtt 'Vpc.CidrBlock', 1, 8]]
VpcId: !Ref Vpc
PublicSubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref PublicSubnet
RouteTableId: !Ref PublicRouteTable
Transform:
- EnableIPv6