-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathserverless.yml
77 lines (70 loc) · 1.79 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
75
76
77
# Service name
service: serverless-ffmpeg
custom:
# Configure these
source_bucket: ${file(./config.yml):source_bucket}
destination_bucket: ${file(./config.yml):destination_bucket}
ffmpeg_params: ${file(./config.yml):ffmpeg_params}
# Leave as is
remover:
buckets:
- ${self:custom.source_bucket}
- ${self:custom.destination_bucket}
plugins:
- serverless-webpack
- serverless-s3-remover
provider:
name: aws
runtime: nodejs6.10
timeout: 300
stage: ${file(./config.yml):stage}
region: ${file(./config.yml):region}
memorySize: ${file(./config.yml):memorySize}
environment:
DESTINATION_BUCKET: ${self:custom.destination_bucket}
FFMPEG_PARAMS: ${self:custom.ffmpeg_params}
iamRoleStatements:
# List buckets
- Effect: Allow
Action:
- s3:ListBucket
Resource:
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- ${self:custom.source_bucket}
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- ${self:custom.destination_bucket}
# Operate in buckets
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
Resource:
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- ${self:custom.source_bucket}
- "/*"
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- ${self:custom.destination_bucket}
- "/*"
functions:
ffmpeg:
handler: handler.main
events:
- s3:
bucket: ${self:custom.source_bucket} # This will create the source bucket
event: s3:ObjectCreated:*
resources:
Resources:
# Make the output bucket
FfmpegDestination:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.destination_bucket}