-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
74 lines (70 loc) · 1.95 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
service: uid2-normalization-and-encoding
frameworkVersion: '3'
provider:
name: aws
runtime: python3.9
region: ${file(./config.yml):region}
environment:
region_code: ${file(./config.yml):region_code}
source_bucket: ${file(./config.yml):source_bucket}
destination_bucket: ${file(./config.yml):destination_bucket}
expires_in: ${file(./config.yml):expires_in}
iam:
role:
statements:
- Effect: Allow
Action:
- s3:ListBucket
Resource:
- arn:aws:s3:::${self:provider.environment.source_bucket}
- arn:aws:s3:::${self:provider.environment.destination_bucket}
- Effect: Allow
Action:
- s3:GetObject
- s3:PutObject
- s3:DeleteObject
Resource:
- arn:aws:s3:::${self:provider.environment.source_bucket}/*
- arn:aws:s3:::${self:provider.environment.destination_bucket}/*
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- "*"
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: non-linux
functions:
eventCreat:
handler: handler.normalization_and_encoding
events:
- s3:
bucket: ${self:provider.environment.source_bucket}
event: "s3:ObjectCreated:*"
eventUpload:
handler: handler.upload_file_to_s3
events:
- http:
path: eventUpload/upload_file_to_s3
method: GET
cors: true
- http:
path: eventUpload/upload_file_to_s3
method: POST
cors: true
- http:
path: upload
method: GET
cors: true
- http:
path: upload
method: POST
cors: true
rateHandler:
handler: handler.clean_up_buckets
events:
- schedule: rate(${file(./config.yml):expires_in} minutes)