-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yaml
More file actions
89 lines (73 loc) · 1.9 KB
/
Copy pathserverless.yaml
File metadata and controls
89 lines (73 loc) · 1.9 KB
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
# file: serverless.yml
service: customers-api
frameworkVersion: ">=1.3.0 <2.0.0"
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-2'}
environment:
CUSTOMERS_TABLE: ${self:service}-${self:provider.stage}-${self:custom.customersTable}
iamRoleStatements:
# allow all of the functions to use this role to access dynamodb
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: 'arn:aws:dynamodb:${self:provider.region}:*:table/${self:provider.environment.CUSTOMERS_TABLE}'
Resources:
# define the dynamodb table to be created
ContactsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: dni
AttributeType: S
-
AttributeName: typeDoc
AttributeType: S
KeySchema:
-
AttributeName: dni
KeyType: HASH
-
AttributeName: typeDoc
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.CUSTOMERS_TABLE}
package:
# excludes are added first
exclude:
- seed/**
- coverage/**
- .vscode/**
- .dockerignore
- .editorconfig
- .env
- .gitignore
- Dockerfile
- README.MD
- '*.{ts,js,json,yml}' # the rest of the configs
include:
- src/**
# exclude the tests and yml files from src
- '!src/**/*.spec.js'
- '!src/**/*.template.yaml'
functions:
- '${file(src/handlers/customers/customers.serverless.yml)}'
plugins:
- serverless-offline
custom:
# vars
customersTable: 'customers'
# plugins
serverless-offline:
host: 0.0.0.0 # for docker container hosting