-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathserverless.yml
65 lines (60 loc) · 1.55 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
service: serverless-image-resizer
provider:
name: aws
runtime: nodejs4.3
region: ${env:AWS_REGION}
iamRoleStatements:
- Effect: Allow
Action:
- "s3:*"
Resource: "*"
environment:
SOURCE_S3_BUCKET_NAME: ${env:SOURCE_S3_BUCKET_NAME}
SOURCE_S3_PREFIX: ${env:SOURCE_S3_PREFIX}
RESIZE_OPTION: ${env:RESIZE_OPTION}
DEST_S3_BUCKET_NAME: ${env:DEST_S3_BUCKET_NAME}
DEST_S3_PREFIX: ${env:DEST_S3_PREFIX}
functions:
imageResizer:
handler: index.handle
events:
- s3:
bucket: ${env:SOURCE_S3_BUCKET_NAME}
event: s3:ObjectCreated:*
rules:
- prefix: ${env:SOURCE_S3_PREFIX}
- http:
method: post
path: /api/v1.0/resized_image
integration: aws_proxy
request:
parameters:
querystrings:
source_url: true
resize_option: false
dest_s3_bucket: false
dest_s3_prefix: false
response:
headers:
Content-Type: application/json
template: $input.path('$')
statusCodes:
201:
pattern: ''
plugins:
- serverless-webpack
- serverless-s3-remover
custom:
webpack: webpack.config.js
webpackIncludeModules: true
remover:
buckets:
- ${env:SOURCE_S3_BUCKET_NAME}
- ${env:DEST_S3_BUCKET_NAME}
resources:
Resources:
DestImageBucket:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
BucketName: ${env:DEST_S3_BUCKET_NAME}