-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yaml
121 lines (114 loc) · 2.64 KB
/
serverless.yaml
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
111
112
113
114
115
116
117
118
119
120
service: serveless-python
frameworkVersion: ">=1.1.0 <2.0.0"
provider:
name: aws
runtime: python3.7
stage: ${opt:stage,'test'}
plugins:
- serverless-localstack
- serverless-dotenv-plugin
- serverless-offline-sns
- serverless-offline-sqs
- serverless-dynamodb-local
- serverless-offline
custom:
localstack:
debug: true
stages:
- test
serverless-offline:
host: 0.0.0.0
noTimeout: true
noPrependStageInUrl: true
serverless-offline-sns:
host: 0.0.0.0
sns-subscribe-endpoint: ${env:SNS_ENDPOINT_SUBSCRIPTION }
sns-endpoint: ${env:SNS_ENDPOINT}
serverless-offline-sqs:
autoCreate: true
apiVersion: '2012-11-05'
endpoint: ${env:SQS_ENDPOINT}
region: us-east-1
accessKeyId: root
secretAccessKey: root
dynamodb:
stages:
- test
start:
host: ${env:DYNAMO_HOST}
port: 4566
inMemory: false
heapInitial: 200m
heapMax: 2g
seed: true
dbPath: ./infra
sharedDb: true
migrate: true
noStart: true
seed:
test:
sources:
- table: pizzas
sources: [infra/data/pizzas-fake-data.json]
functions:
pizzas:
handler: src/pizzas/handler.pizzas
events:
- http: GET pizzas
orders:
handler: src/orders/handler.orders_in_range
events:
- http: GET pizza/orders
order:
handler: src/order/handler.send_order
events:
- http: POST pizzas/order
process-order:
handler: src/process/handler.process_order
events:
- sqs:
queueName: orders-queue
save-order:
handler: src/saver/handler.save_order
events:
- sns: orders-topic
order-email:
handler: src/email/handler.send_mail
events:
- sns: orders-topic
order-status:
handler: src/status/handler.update_order
events:
- http: PUT order/{id}/status
pokemon:
handler: src/hello/handler.hello
events:
- http: GET pokemon/{name}
resources:
Resources:
pizzas-table:
Type: AWS::DynamoDB::Table
Properties:
TableName: pizzas
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
orders-table:
Type: AWS::DynamoDB::Table
Properties:
TableName: orders
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1