-
Notifications
You must be signed in to change notification settings - Fork 4
/
serverless.yml
56 lines (51 loc) · 1.23 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
custom:
service: ${file(./package.json):name}
prefix: ${self:custom.service}-${env:ENVIRONMENT}-
dotenv:
file: file(./.env)
basePath: ./
service: ${self:custom.service}
provider:
name: aws
runtime: nodejs12.x
stage: ${env:ENVIRONMENT}
region: ${env:AWSC_REGION}
timeout: 15
environment:
SERVICE: ${self:custom.service}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- { Fn::GetAtt: ["${env:DB_POSTS}", 'Arn'] }
functions:
records:
handler: dist/handler._records
events:
- http:
path: /records
method: get
resources:
Resources:
posts:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: ${env:DB_DEL_POLICY}
Properties:
TableName: ${self:custom.prefix}${env:DB_POSTS}
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
plugins:
- serverless-offline
- serverless-dotenv-plugin
- serverless-plugin-include-dependencies