-
Notifications
You must be signed in to change notification settings - Fork 7
/
vpc-cryosparc.template
155 lines (133 loc) · 3.95 KB
/
vpc-cryosparc.template
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
AWSTemplateFormatVersion: "2010-09-09"
Description: Deploys the basic network architecture for a CryoSPARC ParallelCluster
Parameters:
AvailabilityZone:
Type: String
Default: us-east-1b
Description: Availability zone where the compute node subnet is deployed
EnvironmentName:
Type: String
Default: CryoSPARC
Description: An environment name that is prefixed to resource names
PrivateSubnetCIDR:
Type: String
Default: "10.0.1.0/24"
Description: Please enter the IP range (CIDR notation) for the private subnet where compute nodes will be launched
PublicSubnetCIDR:
Type: String
Default: "10.0.0.0/28"
Description: Please enter the IP range (CIDR notation) for the public subnet where the head node will be launched
VpcCIDR:
Type: String
Default: "10.0.0.0/16"
Description: Please enter the IP range (CIDR notation) for this VPC
Resources:
NatEIPPublic:
Type: "AWS::EC2::EIP"
DependsOn: VPCGatewayAttachment
Properties:
Domain: vpc
InternetGateway:
Type: "AWS::EC2::InternetGateway"
Properties:
Tags:
- Key: Name
Value: !Sub ${EnvironmentName}-IG
- Key: Stack
Value: !Ref "AWS::StackId"
VPC:
Type: "AWS::EC2::VPC"
Properties:
CidrBlock: !Ref VpcCIDR
EnableDnsHostnames: true
EnableDnsSupport: true
Tags:
- Key: Name
Value: !Sub ${EnvironmentName} VPC
- Key: Stack
Value: !Ref "AWS::StackId"
PrivateRouteTable:
Type: "AWS::EC2::RouteTable"
Properties:
Tags:
- Key: Name
Value: !Sub ${EnvironmentName} Private Route Table
- Key: Stack
Value: !Ref "AWS::StackId"
VpcId: !Ref VPC
PublicRouteTable:
Type: "AWS::EC2::RouteTable"
Properties:
Tags:
- Key: Name
Value: !Sub ${EnvironmentName} Public Route Table
- Key: Stack
Value: !Ref "AWS::StackId"
VpcId: !Ref VPC
VPCGatewayAttachment:
Type: "AWS::EC2::VPCGatewayAttachment"
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
DefaultPublicRoute:
Type: "AWS::EC2::Route"
DependsOn: VPCGatewayAttachment
Properties:
DestinationCidrBlock: "0.0.0.0/0"
GatewayId: !Ref InternetGateway
RouteTableId: !Ref PublicRouteTable
PrivateSubnet:
Type: "AWS::EC2::Subnet"
Properties:
AvailabilityZone: !Ref AvailabilityZone
CidrBlock: !Ref PrivateSubnetCIDR
MapPublicIpOnLaunch: false
Tags:
- Key: Name
Value: !Sub ${EnvironmentName} Private Subnet
- Key: Stack
Value: !Ref "AWS::StackId"
VpcId: !Ref VPC
PublicSubnet:
Type: "AWS::EC2::Subnet"
Properties:
AvailabilityZone: !Ref AvailabilityZone
CidrBlock: !Ref PublicSubnetCIDR
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub ${EnvironmentName} Public Subnet
- Key: Stack
Value: !Ref "AWS::StackId"
VpcId: !Ref VPC
NatGatewayPublic:
Type: "AWS::EC2::NatGateway"
Properties:
AllocationId: !GetAtt NatEIPPublic.AllocationId
SubnetId: !Ref PublicSubnet
RouteAssociationPrivate:
Type: "AWS::EC2::SubnetRouteTableAssociation"
Properties:
RouteTableId: !Ref PrivateRouteTable
SubnetId: !Ref PrivateSubnet
RouteAssociationPublic:
Type: "AWS::EC2::SubnetRouteTableAssociation"
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet
NatRoutePrivate:
Type: "AWS::EC2::Route"
Properties:
DestinationCidrBlock: "0.0.0.0/0"
NatGatewayId: !Ref NatGatewayPublic
RouteTableId: !Ref PrivateRouteTable
Outputs:
PrivateSubnetId:
Description: A reference to the private subnet
Value: !Ref PrivateSubnet
PublicSubnetId:
Description: A reference to the public subnet
Value: !Ref PublicSubnet
VpcId:
Description: A reference to the created VPC
Value: !Ref VPC