-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
132 lines (129 loc) · 3.65 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
service: ms-${self:custom.serviceName}
frameworkVersion: '3'
useDotenv: true
provider:
name: aws
runtime: nodejs16.x
region: 'us-east-1'
stage: ${opt:stage, "${env:stage, 'dev'}"}
memorySize: 512
apiGateway:
restApiId: ${ssm:/alumnus/infra/api-gateway/id}
restApiRootResourceId: ${ssm:/alumnus/infra/api-gateway/root-resource-id}
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource:
- "*"
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:CreateTable
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: 'arn:aws:dynamodb:${aws:region}:${aws:accountId}:*'
- Effect: Allow
Action:
- s3:*
Resource: 'arn:aws:s3:::*/*'
environment:
DB_HOST: ${env:DB_HOST, ssm:/ifsp/infra/EC2-PS/host}
DB_PORT: ${env:DB_PORT, ssm:/ifsp/infra/EC2-PS/port}
DB_NAME: ${env:DB_NAME, ssm:/ifsp/infra/EC2-PS/dbname}
DB_USER: ${env:DB_USER, ssm:/ifsp/infra/EC2-PS/username}
DB_PASSWORD: ${env:DB_PASSWORD, ssm:/ifsp/infra/EC2-PS/password}
REGION: ${self:provider.region}
CREATE_IDENTITY: ${env:CREATE_IDENTITY, ssm:/alumnus/invoke/createIdentity}
STAGE: ${self:provider.stage}
IMAGES_BUCKET_NAME: ${self:custom.imagesBucketName}
custom:
esbuild:
bundle: true
minify: false
external:
- pg-native
serviceName: users
contextPath: ${self:custom.serviceName}
baseApi: ${self:custom.contextPath}
funcDir: src/4-framework/functions
imagesBucketName: ${self:custom.serviceName}-images-devi
ms-account-authorizer:
type: TOKEN
authorizerId: ${ssm:/alumnus/ms-auth/authorizer-id}
functions:
createUser:
handler: ${self:custom.funcDir}/createUser.handler
events:
- http:
path: ${self:custom.baseApi}
method: post
cors:
origin: '*'
headers: '*'
viewUser:
handler: ${self:custom.funcDir}/viewUser.handler
events:
- http:
path: ${self:custom.baseApi}/{user_id}
method: get
authorizer: ${self:custom.ms-account-authorizer}
cors:
origin: '*'
headers: '*'
removeUser:
handler: ${self:custom.funcDir}/removeUser.handler
events:
- http:
path: ${self:custom.baseApi}/{user_id}
method: delete
authorizer: ${self:custom.ms-account-authorizer}
cors:
origin: '*'
headers: '*'
updateUser:
handler: ${self:custom.funcDir}/updateUser.handler
events:
- http:
path: ${self:custom.baseApi}
method: put
authorizer: ${self:custom.ms-account-authorizer}
cors:
origin: '*'
headers: '*'
sendMailResetPassword:
handler: ${self:custom.funcDir}/sendMailResetPassword.handler
events:
- http:
path: ${self:custom.baseApi}/send-mail-reset-password
method: put
cors:
origin: '*'
headers: '*'
confirmToken:
handler: ${self:custom.funcDir}/confirmToken.handler
events:
- http:
path: ${self:custom.baseApi}/confirm-token
method: put
cors:
origin: '*'
headers: '*'
resetPassword:
handler: ${self:custom.funcDir}/resetPassword.handler
events:
- http:
path: ${self:custom.baseApi}/reset-password
method: put
cors:
origin: '*'
headers: '*'
plugins:
- serverless-esbuild
- serverless-offline
- serverless-dotenv-plugin
resources:
- ${file(./devops/resources/s3.yml)}