-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
55 lines (48 loc) · 1.36 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
service: Webpay
plugins:
#- serverless-webpack
- serverless-offline
custom:
stage: ${opt:stage, self:provider.stage}
paymentsTableName: ${self:custom.stage}-payments
chargesTableName: ${self:custom.stage}-charges
tableThroughputs:
prod: 5
default: 1
tableThroughput: ${self:custom.tableThroughputs.${self:custom.stage}, self:custom.tableThroughputs.default}
environment: ${file(env.yml):${self:custom.stage}, file(env.yml):default}
provider:
name: aws
runtime: nodejs8.10
region: us-east-2
stage: dev
environment:
paymentsTableName: ${self:custom.paymentsTableName}
chargesTableName: ${self:custom.chargesTableName}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
# Restrict our IAM role permissions to
# the specific table for the stage
Resource:
- "Fn::GetAtt": [ PaymentsTable, Arn ]
- "Fn::GetAtt": [ ChargesTable, Arn ]
functions:
app:
handler: handler.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
resources:
# DynamoDB
- ${file(resources/dynamodb-tables.yml)}
# Cognito
- ${file(resources/cognito-user-pool.yml)}
- ${file(resources/cognito-identity-pool.yml)}