-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
40 lines (36 loc) · 1.04 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
service: aws-python-webp-converter
plugins:
- serverless-dotenv-plugin
useDotenv: true
provider:
name: aws
runtime: python3.8
region: ap-northeast-2
lambdaHashingVersion: '20201221'
iam:
role:
statements:
- Effect: Allow
Action:
- s3:GetObject
- s3:PutObject
- s3:DeleteObject
Resource:
- arn:aws:s3:::${env:BUCKET_NAME}/*
functions:
convert-to-webp:
handler: handler.webp_handler
layers:
- arn:aws:lambda:ap-northeast-2:770693421928:layer:Klayers-p38-Pillow:3
environment:
WEBP_DIRECTORY_NAME: ${env:WEBP_DIRECTORY_NAME} # directory name where you want to store webp file
IS_DELETE_ORIGINAL: ${env:IS_DELETE_ORIGINAL} # True or False
events:
- s3:
bucket: ${env:BUCKET_NAME}
event: s3:ObjectCreated:*
existing: true
# You can set the trigger rule. This prevents the recursive trigger.
# Please refer to the example below.
# rules:
# - prefix: images/