-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
65 lines (60 loc) · 1.5 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
service: peanuts-comic-api
plugins:
- serverless-domain-manager
- serverless-bundle
- serverless-offline
custom:
stage: ${opt:stage, self:provider.stage}
customDomain:
domainName: api.peanuts.today
certificateName: '*.peanuts.today'
basePath: ${self:custom.stage}
stage: ${self:custom.stage}
createRoute53Record: true
bundle:
sourcemaps: true
caching: true
stats: false
linting: true
existingResources:
peanutsDynamoDBTable: peanuts-comics
peanutsDynamoDBTableDateGSI: display_date-index
package:
excludeDevDependencies: true
provider:
name: aws
runtime: nodejs10.x
region: us-east-1
stage: staging # default
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:Query
Resource:
Fn::Join:
- ""
- - "arn:aws:dynamodb:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":table/"
- ${self:custom.existingResources.peanutsDynamoDBTable}*
apiKeys:
- ${self:custom.stage}-website
functions:
api:
handler: src/api.handler
events:
- http:
path: /
method: any
private: true
- http:
path: '{proxy+}'
method: any
private: true
environment:
STAGE: ${self:custom.stage}
peanutsDDBTable: ${self:custom.existingResources.peanutsDynamoDBTable}
peanutsDDBTableDateGSI: ${self:custom.existingResources.peanutsDynamoDBTableDateGSI}