-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
106 lines (99 loc) · 2.33 KB
/
serverless.yml
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
org: juanroldan1989
app: serverless-url-shortener
service: serverless-url-shortener
frameworkVersion: "3"
provider:
name: aws
runtime: nodejs18.x
profile: default
region: us-east-1
environment:
DYNAMODB_TABLE: ${self:service}-${sls:stage}
SQS_URL: ${construct:urls-queue.queueUrl}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:PutItem
Resource: "arn:aws:dynamodb:${aws:region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
httpApi:
cors: true
apiGateway:
apiKeys:
- free:
- ${sls:stage}-FreePlanKey
- basic:
- ${sls:stage}-BasicPlanKey
- premium:
- ${sls:stage}-PremiumPlanKey
usagePlan:
- free:
quota:
limit: 1000
period: MONTH
throttle:
burstLimit: 200
rateLimit: 100
- basic:
quota:
limit: 2000
period: MONTH
throttle:
burstLimit: 400
rateLimit: 200
- premium:
quota:
limit: 10000
period: MONTH
throttle:
burstLimit: 2000
rateLimit: 1000
plugins:
- serverless-webpack
- serverless-lift
package:
individually: true
functions:
getUrl:
handler: lambdas/endpoints/v1/urls/get.handler
events:
- http:
path: /v1/urls/{id}
method: get
cors: true
createCode:
handler: lambdas/endpoints/v1/codes/create.handler
events:
- http:
path: /v1/codes
method: post
private: true
cors: true
enqueueUrl:
handler: lambdas/endpoints/v1/urls/enqueue.handler
events:
- http:
path: /v1/urls/enqueue
method: post
private: true
cors: true
constructs:
urls-queue:
type: queue
worker:
handler: lambdas/workers/codes/create.handler
resources:
Resources:
UrlsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE}
AttributeDefinitions: # only used for keySchema keys
- AttributeName: Id
AttributeType: S
KeySchema:
- AttributeName: Id
KeyType: HASH
BillingMode: PAY_PER_REQUEST