-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserverless.yml
107 lines (97 loc) · 2.35 KB
/
serverless.yml
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
service: tileserverless
frameworkVersion: ">=3.29.0 <4.0.0"
package:
patterns:
- '!.git/**'
- '!src/**'
- '!docs/**'
- '!.*'
- '!tsconfig.*'
- '!package-lock.json'
- '!yarn.lock'
- '!README.md'
- '!serverless.yml'
provider:
name: aws
runtime: nodejs16.x
memorySize: 256
region: ap-northeast-1
apiGateway:
shouldStartNameWithService: true # serverless@^2
versionFunctions: false
logRetentionInDays: 30
stage: ${opt:stage, 'dev'}
deploymentBucket:
name: geolonia-slsdeploymentbucket-${self:provider.region}
httpApi:
cors:
allowedOrigins:
- "*"
allowedHeaders:
- Content-Type
allowedMethods:
- GET
maxAge: 6000
vpc:
securityGroupIds:
!Split
- ","
- ${self:custom.sgId}
subnetIds:
!Split
- ","
- ${self:custom.subnetId}
environment:
MOUNT_PATH: ${self:custom.mountPath}
CLOUDFRONT_DOMAIN_NAME: ${env:CLOUDFRONT_DOMAIN_NAME}
iam:
role:
statements:
- Effect: Allow
Action:
- "elasticfilesystem:ClientMount"
- "elasticfilesystem:ClientWrite"
Resource:
- ${self:custom.efsApArn}
custom:
sgId: ${env:TILESERVERLESS_SECURITY_GROUP_ID}
subnetId: ${env:TILESERVERLESS_SUBNET_ID}
accessPointId: ${env:TILESERVERLESS_FILESYSTEM_ACCESS_POINT_ID}
fsId: ${env:TILESERVERLESS_FILESYSTEM_ID}
mountPath: /mnt/efs
efsApArn:
Fn::Join:
- ":"
- - arn:aws:elasticfilesystem
- ${self:provider.region}
- !Ref AWS::AccountId
- access-point/${self:custom.accessPointId}
resources:
extensions:
TileLambdaFunction:
Properties:
FileSystemConfigs:
- Arn: ${self:custom.efsApArn}
LocalMountPath: ${self:custom.mountPath}
MetaLambdaFunction:
Properties:
FileSystemConfigs:
- Arn: ${self:custom.efsApArn}
LocalMountPath: ${self:custom.mountPath}
functions:
tile:
handler: dist/tile.handler
events:
- httpApi:
# Remove .mvt extension with Lambda
path: "/{ver}/tiles/{z}/{x}/{y}"
method: get
meta:
handler: dist/meta.handler
events:
- httpApi:
path: "/{ver}/tiles.json"
method: get
- httpApi:
path: "/{ver}/metadata.json"
method: get