-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
103 lines (92 loc) · 2.46 KB
/
serverless.yml
File metadata and controls
103 lines (92 loc) · 2.46 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
app: pankkilinkki-app
service: pankkilinkki
useDotenv: true
plugins:
- serverless-webpack
- serverless-python-requirements
provider:
name: aws
region: eu-north-1
stage: ${opt:stage, 'dev'}
lambdaHashingVersion:
20201221
# Set the default RetentionInDays for a CloudWatch LogGroup
logRetentionInDays: 365
environment:
# Stage defined with serverless command line flag.
STAGE: ${opt:stage, 'dev'}
SLACK_WEBHOOK_LOGS: ${env:SLACK_WEBHOOK_LOGS}
SLACK_WEBHOOK_INFO: ${env:SLACK_WEBHOOK_INFO}
iam:
role:
statements:
- Effect: "Allow"
Action:
- sqs:GetQueueUrl
- sqs:SendMessage
- sqs:DeleteMessageBatch
Resource:
- Fn::GetAtt: [TaskQueue, Arn]
- Effect: "Allow"
Action:
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
Resource:
Fn::Join: ["", ["arn:aws:s3:::", "${self:custom.bucketName}", "/*"]]
- Effect: "Allow"
Action:
- "s3:ListBucket"
Resource: "arn:aws:s3:::*"
custom:
queueName: pankkilinkki-${self:provider.stage}
bucketName: pankkilinkki-${self:provider.stage}
pythonRequirements:
dockerizePip: true
dockerImage: lambci/lambda:build-python3.8
noDeploy:
- futures
- yapf
- flake8
- boto3
# Create resources with CloudFormation templates
resources:
- ${file(resources/sqs-queue.yml)}
package:
artifact: .serverless/pankkilinkki.zip
functions:
handler:
handler: handler.handler
runtime: python3.8
description: Pankkilinkki - handle downloaded files
environment:
ENDPOINT: ${env:ENDPOINT, 'http://localhost:8000'}
API_KEY_B64: ${env:API_KEY_B64}
events:
- s3:
bucket: ${self:custom.bucketName}
event: s3:ObjectCreated:*
rules:
- prefix: files/
linkki:
handler: linkki.handler
runtime: nodejs14.x
description: Pankkilinkki - download files
environment:
BUCKET: ${self:custom.bucketName}
QUEUE: ${self:custom.queueName}
USERNAME: ${env:PANKKILINKKI_USERNAME}
LANGUAGE: ${env:PANKKILINKKI_LANGUAGE, "FI"}
events:
- schedule:
rate: rate(12 hours)
enabled: true
name: poll
- schedule:
rate: rate(30 days)
enabled: true
name: key-check
- sqs:
batchSize: 1
arn:
Fn::GetAtt: [TaskQueue, Arn]