-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse-development-example.yaml
More file actions
431 lines (431 loc) · 12.1 KB
/
parse-development-example.yaml
File metadata and controls
431 lines (431 loc) · 12.1 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormation Template demonstrating how to create a development Parse application
with an Elastic Beanstalk environment in a VPC. The stack contains 1 public subnet that
allows HTTP and SSH access to the 'single instance' Elastic Beanstalk host.
You will be billed for the AWS resources used if you create a stack from this template.
Parameters:
KeyName:
Description: >-
Name of an existing EC2 KeyPair to enable SSH access to the Elastic
Beanstalk hosts
Type: 'AWS::EC2::KeyPair::KeyName'
ConstraintDescription: must be the name of an existing EC2 KeyPair.
SSHLocation:
Description: >-
Lockdown SSH access to the bastion host (default can be accessed from
anywhere)
Type: String
MinLength: '9'
MaxLength: '18'
Default: 0.0.0.0/0
AllowedPattern: '(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})'
ConstraintDescription: must be a valid CIDR range of the form x.x.x.x/x.
DevelopmentMongoDBURI:
Description: >-
The connection string for your DEVELOPMENT database, i.e.
mongodb://user:pass@host1:port1,host2:port2/dbname?replicaSet=replicasetname.
Be sure to URL encode your password if your password has special
characters.
Type: String
ConstraintDescription: must be the URI of an existing MongoDB deployment
AppId:
Description: >-
The application id to host with this server instance. You can use any
arbitrary string.
Type: String
MasterKey:
Description: >-
The master key to use for overriding ACL security. You can use any
arbitrary string. Keep it secret!
Type: String
Mappings:
SubnetConfig:
VPC:
CIDR: 172.31.0.0/16
Public:
CIDR: 172.31.1.0/24
AWSInstanceType2Arch:
t2.nano:
Arch: HVM64
t2.micro:
Arch: HVM64
t2.small:
Arch: HVM64
t2.medium:
Arch: HVM64
t2.large:
Arch: HVM64
t2.xlarge:
Arch: HVM64
t2.2xlarge:
Arch: HVM64
m5.large:
Arch: HVM64
m5.xlarge:
Arch: HVM64
m5.2xlarge:
Arch: HVM64
m5.4xlarge:
Arch: HVM64
m5.12xlarge:
Arch: HVM64
c4.large:
Arch: HVM64
c4.xlarge:
Arch: HVM64
c4.2xlarge:
Arch: HVM64
c4.4xlarge:
Arch: HVM64
c4.9xlarge:
Arch: HVM64
AWSRegionArch2AMI:
us-east-1:
HVM64: ami-6869aa05
us-west-2:
HVM64: ami-7172b611
us-west-1:
HVM64: ami-31490d51
eu-west-1:
HVM64: ami-f9dd458a
eu-west-2:
HVM64: ami-886369ec
eu-west-3:
HVM64: NOT_SUPPORTED
eu-central-1:
HVM64: ami-ea26ce85
ap-northeast-1:
HVM64: ami-374db956
ap-northeast-2:
HVM64: ami-2b408b45
ap-southeast-1:
HVM64: ami-a59b49c6
ap-southeast-2:
HVM64: ami-dc361ebf
ap-south-1:
HVM64: ami-ffbdd790
us-east-2:
HVM64: ami-f6035893
ca-central-1:
HVM64: ami-730ebd17
sa-east-1:
HVM64: ami-6dd04501
cn-north-1:
HVM64: ami-8e6aa0e3
cn-northwest-1:
HVM64: ami-cb858fa9
Region2Principal:
us-east-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
us-west-2:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
us-west-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
eu-west-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
eu-west-2:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
eu-west-3:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
ap-southeast-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
ap-northeast-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
ap-northeast-2:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
ap-southeast-2:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
ap-south-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
us-east-2:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
ca-central-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
sa-east-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
cn-north-1:
EC2Principal: ec2.amazonaws.com.cn
OpsWorksPrincipal: opsworks.amazonaws.com.cn
cn-northwest-1:
EC2Principal: ec2.amazonaws.com.cn
OpsWorksPrincipal: opsworks.amazonaws.com.cn
eu-central-1:
EC2Principal: ec2.amazonaws.com
OpsWorksPrincipal: opsworks.amazonaws.com
Resources:
VPC:
Type: 'AWS::EC2::VPC'
Properties:
CidrBlock: !FindInMap
- SubnetConfig
- VPC
- CIDR
EnableDnsSupport: 'true'
EnableDnsHostnames: 'true'
Tags:
- Key: Application
Value: !Ref 'AWS::StackId'
- Key: Name
Value: ParseDevelopmentVPC
PublicSubnet:
Type: 'AWS::EC2::Subnet'
Properties:
VpcId: !Ref VPC
CidrBlock: !FindInMap
- SubnetConfig
- Public
- CIDR
MapPublicIpOnLaunch: 'true'
AvailabilityZone: "us-east-1a"
Tags:
- Key: Application
Value: !Ref 'AWS::StackId'
- Key: Name
Value: PublicSubnet
- Key: Network
Value: Public
InternetGateway:
Type: 'AWS::EC2::InternetGateway'
Properties:
Tags:
- Key: Application
Value: !Ref 'AWS::StackId'
- Key: Name
Value: ParseDevelopmentIG
- Key: Network
Value: Public
GatewayToInternet:
Type: 'AWS::EC2::VPCGatewayAttachment'
Properties:
VpcId: !Ref VPC
InternetGatewayId: !Ref InternetGateway
PublicRouteTable:
Type: 'AWS::EC2::RouteTable'
Properties:
VpcId: !Ref VPC
Tags:
- Key: Application
Value: !Ref 'AWS::StackId'
- Key: Name
Value: ParsePublicRouteTable
- Key: Network
Value: Public
PublicRoute:
Type: 'AWS::EC2::Route'
DependsOn: GatewayToInternet
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref InternetGateway
PublicSubnetRouteTableAssociation:
Type: 'AWS::EC2::SubnetRouteTableAssociation'
Properties:
SubnetId: !Ref PublicSubnet
RouteTableId: !Ref PublicRouteTable
PublicNetworkAcl:
Type: 'AWS::EC2::NetworkAcl'
Properties:
VpcId: !Ref VPC
Tags:
- Key: Application
Value: !Ref 'AWS::StackId'
- Key: Name
Value: ParseDevelopmentPublicACL
- Key: Network
Value: Public
InboundHTTPPublicNetworkAclEntry:
Type: 'AWS::EC2::NetworkAclEntry'
Properties:
NetworkAclId: !Ref PublicNetworkAcl
RuleNumber: '100'
Protocol: '6'
RuleAction: allow
Egress: 'false'
CidrBlock: 0.0.0.0/0
PortRange:
From: '80'
To: '80'
InboundHTTPSPublicNetworkAclEntry:
Type: 'AWS::EC2::NetworkAclEntry'
Properties:
NetworkAclId: !Ref PublicNetworkAcl
RuleNumber: '101'
Protocol: '6'
RuleAction: allow
Egress: 'false'
CidrBlock: 0.0.0.0/0
PortRange:
From: '443'
To: '443'
InboundSSHPublicNetworkAclEntry:
Type: 'AWS::EC2::NetworkAclEntry'
Properties:
NetworkAclId: !Ref PublicNetworkAcl
RuleNumber: '102'
Protocol: '6'
RuleAction: allow
Egress: 'false'
CidrBlock: !Ref SSHLocation
PortRange:
From: '22'
To: '22'
InboundEphemeralPublicNetworkAclEntry:
Type: 'AWS::EC2::NetworkAclEntry'
Properties:
NetworkAclId: !Ref PublicNetworkAcl
RuleNumber: '103'
Protocol: '6'
RuleAction: allow
Egress: 'false'
CidrBlock: 0.0.0.0/0
PortRange:
From: '1024'
To: '65535'
OutboundPublicNetworkAclEntry:
Type: 'AWS::EC2::NetworkAclEntry'
Properties:
NetworkAclId: !Ref PublicNetworkAcl
RuleNumber: '100'
Protocol: '6'
RuleAction: allow
Egress: 'true'
CidrBlock: 0.0.0.0/0
PortRange:
From: '0'
To: '65535'
PublicSubnetNetworkAclAssociation:
Type: 'AWS::EC2::SubnetNetworkAclAssociation'
Properties:
SubnetId: !Ref PublicSubnet
NetworkAclId: !Ref PublicNetworkAcl
EC2SecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupName: Parse Development EC2 SG
GroupDescription: Allow EB to connect to EC2
VpcId: !Ref VPC
SecurityGroupIngress:
-
IpProtocol: tcp
FromPort: '80'
ToPort: '80'
CidrIp: 0.0.0.0/0
-
IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: 0.0.0.0/0
SecurityGroupEgress:
- IpProtocol: '-1'
CidrIp: 0.0.0.0/0
WebServerRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- !FindInMap
- Region2Principal
- !Ref 'AWS::Region'
- EC2Principal
Action:
- 'sts:AssumeRole'
Path: /
WebServerRolePolicy:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: WebServerRole
PolicyDocument:
Statement:
- Effect: Allow
NotAction: 'iam:*'
Resource: '*'
Roles:
- !Ref WebServerRole
WebServerInstanceProfile:
Type: 'AWS::IAM::InstanceProfile'
Properties:
Path: /
Roles:
- !Ref WebServerRole
ParseApplication:
Type: 'AWS::ElasticBeanstalk::Application'
Properties:
ApplicationName: ParseDevelopmentApplication
Description: AWS Elastic Beanstalk Parse Application
ParseApplicationVersion:
Type: 'AWS::ElasticBeanstalk::ApplicationVersion'
Properties:
Description: Version 1.0
ApplicationName: !Ref ParseApplication
SourceBundle:
S3Bucket: changy
S3Key: chrisckchang-parse.zip
ParseDevelopmentEnvironment:
Type: 'AWS::ElasticBeanstalk::Environment'
Properties:
ApplicationName: !Ref ParseApplication
Description: Development Parse Environment
EnvironmentName: "DevelopmentParseEnv"
SolutionStackName: 64bit Amazon Linux 2017.09 v4.4.4 running Node.js
VersionLabel: !Ref ParseApplicationVersion
OptionSettings:
- Namespace: 'aws:elasticbeanstalk:application'
OptionName: Application Healthcheck URL
Value: '/'
- Namespace: 'aws:elasticbeanstalk:application:environment'
OptionName: DATABASE_URI
Value: !Ref DevelopmentMongoDBURI
- Namespace: 'aws:elasticbeanstalk:application:environment'
OptionName: APP_ID
Value: !Ref AppId
- Namespace: 'aws:elasticbeanstalk:application:environment'
OptionName: MASTER_KEY
Value: !Ref MasterKey
- Namespace: 'aws:elasticbeanstalk:environment'
OptionName: EnvironmentType
Value: SingleInstance
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: InstanceType
Value: t2.micro
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: EC2KeyName
Value: !Ref KeyName
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value: !Ref EC2SecurityGroup
- Namespace: 'aws:ec2:vpc'
OptionName: VPCId
Value: !Ref VPC
- Namespace: 'aws:ec2:vpc'
OptionName: Subnets
Value: !Ref PublicSubnet
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: IamInstanceProfile
Value: !Ref WebServerInstanceProfile
Outputs:
URL:
Description: The URL of the development Parse application
Value: !Join
- ''
- - 'http://'
- !GetAtt
- ParseDevelopmentEnvironment
- EndpointURL