forked from evanchiu/serverless-galleria
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.yml
67 lines (67 loc) · 1.73 KB
/
template.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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Transforms images by cropping
Resources:
transform:
Type: AWS::Serverless::Function
Properties:
Description: Transforms images by cropping
Handler: src/index.handler
Runtime: nodejs12.x
CodeUri: build/transform.zip
MemorySize: 1536
Policies:
- S3ReadPolicy:
BucketName:
Ref: sourceBucket
- S3CrudPolicy:
BucketName:
Ref: destBucket
Timeout: 300
Events:
upload:
Type: S3
Properties:
Bucket:
Ref: source
Events: s3:ObjectCreated:*
Environment:
Variables:
DEST_BUCKET:
Ref: destBucket
WIDTH:
Ref: width
HEIGHT:
Ref: height
X_COORDINATE:
Ref: xCoordinate
Y_COORDINATE:
Ref: yCoordinate
source:
Type: AWS::S3::Bucket
Properties:
BucketName:
Ref: sourceBucket
Parameters:
sourceBucket:
Type: String
Description: Name of the S3 Bucket to read source images from (must NOT exist prior to deployment)
destBucket:
Type: String
Description: Name of the S3 Bucket to put transformed images into (must exist prior to deployment)
width:
Type: Number
Description: Width of cropped image
Default: 600
height:
Type: Number
Description: Height of cropped image
Default: 400
xCoordinate:
Type: Number
Description: (x, y) is the upper left corner of the cropped region
Default: 50
yCoordinate:
Type: Number
Description: (x, y) is the upper left corner of the cropped region
Default: 50