-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
99 lines (95 loc) · 2.56 KB
/
serverless.yml
File metadata and controls
99 lines (95 loc) · 2.56 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
service: serverless-python-starter
package:
individually: true
provider:
name: aws
profile: varokas # Change to a profile name
runtime: python3.9
memorySize: 128
timeout: 10
region: us-west-2
stage: ${opt:stage, "staging"}
lambdaHashingVersion: 20201221
# # -- IAM Roles Example for DynamoDB & S3 bucket access
# iamRoleStatements: [
# {
# Effect: "Allow",
# Action: ["s3:GetObject","s3:GetObjectVersion","s3:PutObject","s3:PutObjectAcl","s3:ListBucket"],
# Resource: [
# "arn:aws:s3:::bucketname",
# "arn:aws:s3:::bucketname/*"
# ]
# }
# ],
# iam: {
# role: {
# managedPolicies: [
# "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess" # TODO -- better refined policy than full access
# ]
# }
# }
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: false # Or -- non-linux if we are using non-pure python libs
layer:
name: serverless-python-starter-layer
description: Starter Layer
compatibleRuntimes:
- python3.9
functions:
app:
package:
exclude:
- "requirements.txt"
- "package.json"
- "package-lock.json"
- ".serverless/**"
- ".venv/**"
- "node_modules/**"
- "__pycache__/**"
- "**/__pycache__/**"
- "pulumi-example/**"
handler: main.handler
environment:
STAGE: ${self:provider.stage}
layers:
- { Ref: PythonRequirementsLambdaLayer }
# # Uncomment HTTP Events to enable API Gateway
# events:
# - http:
# method: any
# path: /{proxy+}
# - http:
# method: any
# path: /
backend:
package:
exclude:
- "requirements.txt"
- "package.json"
- "package-lock.json"
- ".serverless/**"
- ".venv/**"
- "node_modules/**"
- "__pycache__/**"
- "**/__pycache__/**"
- "pulumi-example/**"
handler: backend.handler
environment:
STAGE: ${self:provider.stage}
layers:
- { Ref: PythonRequirementsLambdaLayer }
events:
- schedule:
rate:
- cron(0 15 * * ? *) # https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
- rate(2 hours)
inputTransformer:
inputPathsMap:
eventTime: '$.time'
inputTemplate: '{"name":"TestEvent", "time":<eventTime>, "source":"schedule"}'
- sqs:
arn: "arn:aws:sqs:us-west-2:820792572713:serverless-python-starter-events"
batchSize: 1