-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
92 lines (81 loc) · 2.02 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Api:
OpenApiVersion: 3.0.1
Parameters:
Stage:
Type: String
Default: staging
ServiceName:
Type: String
Default: eventConsumer
Resources:
EventS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub event-consumer-${Stage}
NotificationConfiguration:
LambdaConfigurations:
- Function:
"Fn::GetAtt":
- "Function"
- "Arn"
Event: s3:ObjectCreated:*
Function:
Type: AWS::Serverless::Function
Properties:
CodeUri: ''
Handler: main.main
Timeout: 180
MemorySize: 512
Runtime: python3.6
FunctionName: !Sub ${ServiceName}-${Stage}
Environment:
Variables:
SOURCE_BUCKET: !Sub event-consumer-${Stage}
TRANSFORMED_BUCKET: uchenchostorage
Policies:
- VPCAccessPolicy: {}
- S3ReadPolicy:
BucketName: !Sub event-consumer-${Stage}
- S3WritePolicy:
BucketName: uchenchostorage
Events:
s3Upload:
Type: S3
Properties:
Bucket:
Ref: EventS3Bucket
Events: s3:ObjectCreated:*
Layers:
- !Ref libs
- "arn:aws:lambda:us-east-1:668099181075:layer:AWSLambda-Python36-SciPy1x:37"
libs:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: pandas-lib
Description: pandas dependency.
ContentUri: external/.
CompatibleRuntimes:
- python3.6
Outputs:
FunctionName:
Description: Service function name
Value: !Sub ${ServiceName}-${Stage}
Export:
Name: !Sub ${ServiceName}-name
FunctionArn:
Description: Service Service Function ARN
Value: !GetAtt Function.Arn
Export:
Name: !Sub ${ServiceName}-arn
EventS3BucketName:
Value: !Ref EventS3Bucket
Export:
Name: event-consumer
PandasLibrary:
Value: !Ref libs
Export:
Name: pandas-lib