-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
82 lines (67 loc) · 1.96 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
service: test-crud-node-less
# DRY constants: define all compound/generated names in one place
# Override args are: .. defaults:
# --app_acronym test-crud-node-less
# --aws_id your_aws_account_id
# --region eu-central-1
# --stage dev
custom:
default_app_acronym: serverless-crud-node
default_stage: dev
default_region: eu-west-1
aws_account_ids:
dev: xxxx
stg: xxxxx
prod: xxxxx
region: ${opt:region, self:custom.default_region}
app_acronym: ${opt:app_acronym, self:custom.default_app_acronym}
aws_account_id: ${opt:aws_id, self:custom.aws_account_ids.${self:custom.stage}}
stage: ${opt:stage, self:custom.default_stage}
stack_name: ${self:custom.app_acronym}-${self:custom.stage}
# ------------------ DYN DATA ITEMS ------------------- #
dynamodb_host: https://dynamodb.${self:custom.region}.amazonaws.com
dynamodb_table_items: ${self:custom.stage}-items-dynamodb-table
dynamodb_arn_items: arn:aws:dynamodb:${self:custom.region}:*:table/${self:custom.dynamodb_table_items}
# For serverless-webpack
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
packager: 'npm'
plugins:
- serverless-offline
- serverless-webpack
package:
exclude:
- .idea/**
- scripts/**
- tests/**
- README.md
- .eslintignore
- .eslintrc.json
- docker-compose.yml
- Dockerfile
- yarn.lock
- package.json
- package-lock.json
provider:
name: aws
runtime: nodejs8.10
stage: ${self:custom.stage}
region: ${self:custom.region}
environment:
ACCOUNT_ID: ${self:custom.aws_account_id}
DDB_REGION: ${self:custom.region}
DYNAMO_DB_ENDPOINT: ${self:custom.dynamodb_host}
DB_TABLE: ${self:custom.dynamodb_table_items}
functions:
app:
handler: handler.main
events:
- http:
method : ANY
path : '/'
- http:
method: ANY
path: '{proxy+}'
# authorizer:
# handler: authorizer.main