-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
56 lines (52 loc) · 1.37 KB
/
template.yaml
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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: A serverless PDF conversion
Parameters:
LambdaLayerArn:
Type: String
Default: 'arn:aws:lambda:us-east-1:145266761615:layer:pandoc:1'
InputFileType:
Type: String
Default: ''
ConversionFileType:
Type: String
Default: docx
ConversionMimeType:
Type: String
Default: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Resources:
UploadBucket:
Type: AWS::S3::Bucket
ResultsBucket:
Type: AWS::S3::Bucket
ConvertFileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Timeout: 180
MemorySize: 512
Runtime: nodejs8.10
CodeUri: src/
Layers:
- !Ref LambdaLayerArn
Policies:
- S3CrudPolicy:
BucketName: !Sub "${AWS::StackName}-*"
Environment:
Variables:
RESULTS_BUCKET_NAME: !Ref ResultsBucket
EXTENSION: !Sub '.${ConversionFileType}'
MIME_TYPE: !Ref ConversionMimeType
Events:
FileUpload:
Type: S3
Properties:
Bucket: !Ref UploadBucket
Events: s3:ObjectCreated:*
Outputs:
UploadBucket:
Description: "Upload S3 bucket"
Value: !Ref UploadBucket
ResultsBucket:
Description: "Results S3 bucket"
Value: !Ref ResultsBucket