forked from simalexan/s3-lambda-ffmpeg-mov-to-mp4-s3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
67 lines (63 loc) · 1.67 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: A serverless component for MP4 compression
Parameters:
ConversionTimeout:
Type: Number
Default: 180
InputS3BucketName:
Type: String
Default: 'emrevideo'
MinLength: 3
OutputS3BucketName:
Type: String
Default: 'emrevideocompressed'
MinLength: 3
Resources:
InputS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref InputS3BucketName
ffmpeglambdalayer:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:145266761615:applications/ffmpeg-lambda-layer
SemanticVersion: 1.0.0
ConvertFileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Timeout: !Ref ConversionTimeout
MemorySize: 1024
Runtime: nodejs12.x
CodeUri: src/
Layers:
- !GetAtt ffmpeglambdalayer.Outputs.LayerVersion
Policies:
- S3CrudPolicy:
BucketName: !Ref OutputS3BucketName
- S3ReadPolicy:
BucketName: !Ref InputS3BucketName
Environment:
Variables:
OUTPUT_BUCKET: !Ref OutputS3Bucket
EXTENSION: '.mp4'
MIME_TYPE: 'video/mp4'
Events:
FileUpload:
Type: S3
Properties:
Bucket: !Ref InputS3Bucket
Events: s3:ObjectCreated:*
OutputS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref OutputS3BucketName
Outputs:
InputS3Bucket:
Description: Input S3 bucket
Value: !Ref InputS3Bucket
OutputS3Bucket:
Description: Output S3 bucket
Value: !Ref OutputS3Bucket