forked from simalexan/s3-lambda-csv-to-xlsx-s3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
54 lines (52 loc) · 1.42 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: A serverless component for CSV to XLSX conversion
Parameters:
ConversionTimeout:
Type: Number
Default: 60
InputBucketName:
Type: String
Default: 's3-lambda-csv-input-s3-bucket'
OutputBucketName:
Type: String
Default: 's3-lambda-xlsx-output-s3-bucket'
Resources:
InputS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref InputBucketName
ConvertFileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Timeout: !Ref ConversionTimeout
MemorySize: 512
Runtime: nodejs8.10
Policies:
- S3ReadPolicy:
BucketName: !Ref InputBucketName
- S3CrudPolicy:
BucketName: !Ref OutputBucketName
Environment:
Variables:
RESULTS_BUCKET_NAME: !Ref OutputS3Bucket
EXTENSION: '.xlsx'
MIME_TYPE: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
Events:
FileUpload:
Type: S3
Properties:
Bucket: !Ref InputS3Bucket
Events: s3:ObjectCreated:*
OutputS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref OutputBucketName
Outputs:
InputS3Bucket:
Description: Input S3 bucket
Value: !Ref InputS3Bucket
OutputS3Bucket:
Description: Output S3 bucket
Value: !Ref OutputS3Bucket