forked from Elizabeth-Warren/i90
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
110 lines (100 loc) · 2.53 KB
/
serverless.yml
File metadata and controls
110 lines (100 loc) · 2.53 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
104
105
106
107
108
109
110
service: i90
frameworkVersion: "^4.31.2"
custom:
stage: ${opt:stage, env:STAGE, "dev"}
deploy:
bucket_name: ${ssm:/i90/DEPLOYMENT_BUCKET_NAME}
pythonRequirements:
dockerizePip: true
slim: true
layer: true
useDownloadCache: false
useStaticCache: false
environment:
STAGE: ${self:custom.stage}
MY_PROTOCOL: https
TOKEN_BYTE_LENGTH: 10
MY_HOST: "${ssm:/i90/${self:custom.stage}/HOST}"
REDIRECTS_TABLE: "${ssm:/i90/${self:custom.stage}/redirects_table/name}"
TRACKING_STREAM: "${ssm:/i90/${self:custom.stage}/kinesis_firehose/name}"
layers:
- {Ref: PythonRequirementsLambdaLayer}
provider:
name: aws
runtime: python3.10
region: ${opt:region, env:REGION, "us-east-1"}
stage: ${self:custom.stage}
deploymentBucket:
name: ${self:custom.deploy.bucket_name}
blockPublicAccess: true
apiGateway:
apiKeys:
- ${self:custom.stage}-i90-default
iamRoleStatements:
- Effect: Allow
Action:
- "dynamodb:*"
Resource:
- "${ssm:/i90/${self:custom.stage}/redirects_table/arn}"
- Effect: Allow
Action:
- "firehose:PutRecord"
Resource:
- "${ssm:/i90/${self:custom.stage}/kinesis_firehose/arn}"
environment: ${self:custom.environment}
package:
excludeDevDependencies: true
individually: false
exclude:
- ".pytest_cache/**"
- "node_modules/**"
- ".vscode/**"
functions:
redirects:
name: ${self:custom.stage}-i90-redirect
handler: handlers.redirect
layers: ${self:custom.layers}
events:
- http:
method: GET
path: /
- http:
method: GET
path: /{token}
- schedule:
rate: rate(4 minutes)
get-json:
name: ${self:custom.stage}-i90-get-json
handler: handlers.get_redirect
layers: ${self:custom.layers}
events:
- http:
method: GET
path: v1/redirect/{token}
private: true
- schedule:
rate: rate(4 minutes)
claim:
name: ${self:custom.stage}-i90-claim
handler: handlers.claim
layers: ${self:custom.layers}
events:
- http:
method: POST
path: v1/claim
private: true
- schedule:
rate: rate(4 minutes)
conceive:
name: ${self:custom.stage}-i90-conceive
handler: handlers.conceive
layers: ${self:custom.layers}
events:
- http:
method: POST
path: v1/conceive
private: true
- schedule:
rate: rate(4 minutes)
plugins:
- serverless-python-requirements