Skip to content

Commit 3bab113

Browse files
author
Chris Fane
committed
An additional usage example to show the deployment of the layer from SAR and reference of the layer from the consuming function.
1 parent caaf264 commit 3bab113

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

example/template-sar.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Transform: AWS::Serverless-2016-10-31
3+
Description: >
4+
Example project demonstrating the deployment of the FFmpeg Layer for AWS Linux 2 runtimes via the AWS Serverless Application Repository, and its reference from within a function.
5+
6+
Parameters:
7+
ffmpegLambdaVersion:
8+
Type: String
9+
Default: 1.0.0
10+
Description: The semantic version of the ffmpeg layer you wish to deploy.
11+
ConversionFileType:
12+
Type: String
13+
Default: jpg
14+
ConversionMimeType:
15+
Type: String
16+
Default: image/jpeg
17+
ThumbWidth:
18+
Type: Number
19+
Default: 300
20+
Description: Thumbnail width in pixels
21+
Resources:
22+
UploadBucket:
23+
Type: AWS::S3::Bucket
24+
25+
ResultsBucket:
26+
Type: AWS::S3::Bucket
27+
28+
ffmpeglambdalayer:
29+
Type: AWS::Serverless::Application
30+
Properties:
31+
Location:
32+
ApplicationId: arn:aws:serverlessrepo:us-east-1:145266761615:applications/ffmpeg-lambda-layer
33+
SemanticVersion: !Ref ffmpegLambdaVersion
34+
35+
ConvertFileFunction:
36+
Type: AWS::Serverless::Function
37+
Properties:
38+
Handler: index.handler
39+
Timeout: 180
40+
MemorySize: 1024
41+
Runtime: nodejs10.x
42+
CodeUri: src
43+
Layers:
44+
- !GetAtt ffmpeglambdalayer.Outputs.LayerVersion
45+
Policies:
46+
- S3CrudPolicy:
47+
BucketName: !Sub "${AWS::StackName}-*"
48+
Environment:
49+
Variables:
50+
OUTPUT_BUCKET: !Ref ResultsBucket
51+
EXTENSION: !Sub '.${ConversionFileType}'
52+
MIME_TYPE: !Ref ConversionMimeType
53+
THUMB_WIDTH: !Ref ThumbWidth
54+
Events:
55+
FileUpload:
56+
Type: S3
57+
Properties:
58+
Bucket: !Ref UploadBucket
59+
Events: s3:ObjectCreated:*
60+
61+
Outputs:
62+
UploadBucket:
63+
Description: "Upload S3 bucket"
64+
Value: !Ref UploadBucket
65+
ResultsBucket:
66+
Description: "Results S3 bucket"
67+
Value: !Ref ResultsBucket

0 commit comments

Comments
 (0)