-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
88 lines (80 loc) · 2.23 KB
/
serverless.yml
File metadata and controls
88 lines (80 loc) · 2.23 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
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
service: lambda-ftp-to-gsheet-transform
# app and org for use with dashboard.serverless.com
app: lambda-ftp-to-gsheet-transform
org: dankez
custom:
bucket: ${env:S3_BUCKET_NAME}
alerts:
stages:
- dev
- prod
topics:
alarm:
topic: ${self:service}-${opt:stage}-alerts-alarm
notifications:
- protocol: email
endpoint: ${env:ALERTING_EMAIL_ADDRESS}
alarms:
- functionErrors
- functionThrottles
provider:
name: aws
runtime: python3.8
environment:
USE_PARAMETER_STORE: True
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
- s3:PutObjectAcl
- s3:GetObject
- s3:GetObjectAcl
- s3:ListObjects
- s3:ListObjectsV2
- s3:ListBucket
Resource:
- "arn:aws:s3:::${self:custom.bucket}"
- "arn:aws:s3:::${self:custom.bucket}/*"
- Effect: Allow
Action:
- ssm:GetParameter
Resource: "arn:aws:ssm:#{AWS::Region }:#{AWS::AccountId}:parameter/*"
functions:
ftp_to_s3_handler:
handler: handlers.handler_transfer_editrade_files_to_s3
timeout: 510
events:
- schedule: rate(10 minutes)
# Run a nightly backfill just in case there were any errors
nightly_backfill:
handler: handlers.handler_bulk_parse_xml_files
timeout: 900 # 15 min max timeout
events:
- schedule: cron(0 20 * * ? *) # Every night at 9 pm EST
# Run a nightly backfill just in case there were any errors
monthly_cleanup:
handler: handlers.handler_delete_old_files
timeout: 900 # 15 min max timeout
events:
- schedule:
rate: cron(0 21 * * ? *) # Every night at 10pm EST
input:
days_back: 30
dry_run: false
send_to_google_sheets:
handler: handlers.handler_parse_s3_xml_file_to_sheet
events:
- s3:
bucket: "${self:custom.bucket}"
event: s3:ObjectCreated:*
rules:
- prefix: EDITRADEOUT/002113/
- suffix: .xml
bulk_send_to_google_sheets:
handler: handlers.handler_bulk_parse_xml_files
timeout: 180
plugins:
- serverless-python-requirements
- serverless-plugin-aws-alerts
- serverless-dotenv-plugin
- serverless-pseudo-parameters