forked from miztiik/serverless-s3-event-processor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless-s3-event-processor.yaml
More file actions
63 lines (56 loc) · 1.77 KB
/
serverless-s3-event-processor.yaml
File metadata and controls
63 lines (56 loc) · 1.77 KB
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: >
AWS Lambda to process new S3 Objects - For ex, Image Resizing, Object Recognition, Insert to DynamoDB etc.
Parameters:
debugMODE:
Description: Do you want to enable logging.
Default: "False"
Type: String
AllowedValues: ["True", "False"]
ConstraintDescription: Must be boolean.
FunctionNameSuffix:
Description: 'Suffix to append to the Lambda functions.'
Type: 'String'
Default: 'Mystique'
Globals:
Function:
Runtime: python3.7
Timeout: 10
MemorySize: 128
Environment:
Variables:
DEBUG_MODE:
Ref: debugMODE
Resources:
EventProcessor:
Type: AWS::Serverless::Function
Properties:
Description: 'AWS Lambda to process new S3 Objects - For ex, Image Resizing, Object Recognition, Insert to DynamoDB etc.'
FunctionName: !Sub 'EventProcessor-${FunctionNameSuffix}'
Handler: serverless-s3-event-processor.lambda_handler
CodeUri: ./src/serverless-s3-event-processor.py
Events:
EventTrigger1:
Type: S3
Properties:
Bucket: !Ref EventBucket
Events: s3:ObjectCreated:*
Policies:
- AWSLambdaExecute # Managed Policy
# - Version: '2012-10-17' # Policy Document
# Statement:
# - Effect: Allow
# Action:
# - s3:GetObject
# - s3:GetObjectACL
# Resource: !GetAtt EventBucket.Arn
EventBucket:
Type: AWS::S3::Bucket
Outputs:
S3EventBucket:
Description: S3 Bucket that triggers the Lambda
Value: !Ref EventBucket
EventProcessorFunction:
Description: ARN for the EventProcessor Lambda Function
Value: !GetAtt EventProcessor.Arn