-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
61 lines (57 loc) · 1.5 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
service: image-watermark
plugins:
- serverless-api-stage
custom:
stage: "${opt:stage, self:provider.stage}"
stageSettings:
Variables:
uploadsBucket: leftclick.dddperth-2017.uploads-${self:custom.stage}
imagesBucket: leftclick.dddperth-2017.images-${self:custom.stage}
MethodSettings:
LoggingLevel: INFO
provider:
name: aws
runtime: nodejs6.10
region: ap-southeast-2
iamRoleStatements:
-
Effect: Allow
Action:
- "s3:GetObject"
Resource: "arn:aws:s3:::${self:custom.stageSettings.Variables.uploadsBucket}/*"
-
Effect: Allow
Action:
- "s3:PutObject"
- "s3:PutObjectAcl"
Resource: "arn:aws:s3:::${self:custom.stageSettings.Variables.imagesBucket}/*"
-
Effect: Allow
Action:
- "s3:ListBucket"
Resource: "arn:aws:s3:::${self:custom.stageSettings.Variables.imagesBucket}"
-
Effect: Allow
Action:
- "ses:SendEmail"
Resource: "arn:aws:ses:us-west-2:*:identity/*"
functions:
processImage:
handler: app/handlers/processImage.s3
timeout: 30
events:
- s3:
bucket: "${self:custom.stageSettings.Variables.uploadsBucket}"
event: s3:ObjectCreated:*
notify:
handler: app/handlers/notify.s3
events:
- s3:
bucket: "${self:custom.stageSettings.Variables.imagesBucket}"
event: s3:ObjectCreated:*
httpGet:
handler: app/handlers/http.get
events:
- http:
path: /
method: get