-
Notifications
You must be signed in to change notification settings - Fork 3
/
serverless.yml
141 lines (134 loc) · 3.72 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
service: Go-Serverless-Demo
package:
artifact: /Users/vishal/work/src/go-serverless-demo/handler.zip
exclude:
- node_modules/**
provider:
name: aws
stage: ${opt:stage, self:custom.defaultStage}
profile: ${self:custom.profiles.${self:provider.stage}}
runtime: python2.7
environment:
DYNAMODB_TASK_TABLE: "SERVERLESS_TASKS"
DYNAMODB_USER_TABLE: "SERVERLESS_USERS"
region: us-east-1
memorySize: 512
deploymentBucket:
serverSideEncryption: AES256 # Enable encryption on S3 bucket
versionFunctions: false
stackTags:
key: value
custom:
defaultStage: dev
profiles:
dev: default
prod: prodProfile
apigs3:
dist: app/dist # path within service to find content to upload (default: client/dist)
dotFiles: false # include files beginning with a dot in resources and uploads (default: false)
topFiles: true # create routes for top-level files in dist folder (default: false)
resourceName: static # route path for static assets (default: assets)
resourcePath: /static # path prefix for assets in s3 bucket (default: '')
functions:
login:
handler: handler.Handle
tags:
key: value
events:
- http:
path: auth
method: post
cors: true
register:
handler: handler.Handle
events:
- http:
path: register
method: post
cors: true
userTasksCreate:
handler: handler.Handle
events:
- http:
path: users/{userId}/tasks
method: post
authorizer:
name: authorizerFunc
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
type: token
cors: true
userTasksGet:
handler: handler.Handle
events:
- http:
path: users/{userId}/tasks
method: get
authorizer:
name: authorizerFunc
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
type: token
cors: true
userTaskGet:
handler: handler.Handle
events:
- http:
path: users/{userId}/tasks/{taskId}
method: get
authorizer:
name: authorizerFunc
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
type: token
cors: true
userTasksDelete:
handler: handler.Handle
events:
- http:
path: users/{userId}/tasks/{taskId}
method: delete
authorizer:
name: authorizerFunc
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
type: token
cors: true
authorizerFunc:
handler: handler.VerifyHandler
resources:
Resources:
TasksDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
KeySchema:
-
AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TASK_TABLE}
UsersDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: username
AttributeType: S
KeySchema:
-
AttributeName: username
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_USER_TABLE}
plugins:
- serverless-apig-s3