-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
101 lines (91 loc) · 2.49 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
service: ${self:custom.serviceName}
plugins:
- serverless-s3-sync
provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage, 'demo'}
region: eu-west-1
memorySize: 128
stackTags:
name: ${self:service}
iamRoleStatements:
- Effect: 'Allow'
Action:
- 's3:*'
Resource: "*"
resources:
Resources:
GatewayResponseDefault4XX:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: DEFAULT_4XX
RestApiId:
Ref: 'ApiGatewayRestApi'
S3Data:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.bucketName}
functions:
getDataCSV:
handler: lib/index.handler
environment:
BUCKET: ${self:custom.bucketName}
QUERY: ${file(${self:custom.setupFile}):SQL1}
FILE: ${file(${self:custom.setupFile}):sampleFile1}
events:
- http:
path: /getDataCSV
method: get
cors: true
getDataJSON:
handler: lib/index.handler
environment:
BUCKET: ${self:custom.bucketName}
QUERY: ${file(${self:custom.setupFile}):SQL2}
FILE: ${file(${self:custom.setupFile}):sampleFile2}
TYPE: ${file(${self:custom.setupFile}):type2}
events:
- http:
path: /getDataJSON
method: get
cors: true
getDataParquet:
handler: lib/index.handler
environment:
BUCKET: ${self:custom.bucketName}
QUERY: ${file(${self:custom.setupFile}):SQL3}
FILE: ${file(${self:custom.setupFile}):sampleFile3}
TYPE: ${file(${self:custom.setupFile}):type3}
events:
- http:
path: /getDataParquet
method: get
cors: true
postQuery:
handler: lib/index.handler
environment:
BUCKET: ${self:custom.bucketName}
FILE: ${file(${self:custom.setupFile}):sampleFile4}
TYPE: ${file(${self:custom.setupFile}):type4}
METHOD: POST
events:
- http:
path: /postQuery
method: post
cors: true
custom:
setupFile: ./setup.${self:provider.stage}.json
serviceName: ${file(${self:custom.setupFile}):serviceName}
bucketName: ${self:custom.serviceName}-${file(${self:custom.setupFile}):bucketName}
s3Sync:
- bucketName: ${self:custom.bucketName}
localDir: data/files
deleteRemoved: true
package:
exclude:
- node_modules/**
- data/**