-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
100 lines (90 loc) · 2.32 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
service: muxlexbots
provider:
name: aws
runtime: nodejs10.x
region: us-east-1
stage: ${self:custom.secrets.NODE_ENV}
profile: default
environment:
NODE_ENV: ${self:custom.secrets.NODE_ENV}
DYNAMODB_TABLE: ${self:custom.secrets.DYNAMODB_TABLE}
SESSIONS_TABLE: ${self:custom.secrets.SESSIONS_TABLE}
BUCKET_NAME: ${self:custom.secrets.BUCKET_NAME}
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:ListBucket"
- "s3:GetObject"
- "s3:PutObject"
Resource: "arn:aws:s3::*:bucket/${self:provider.environment.BUCKET_NAME}"
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
plugins:
- serverless-apigw-binary
# - serverless-dynamodb-local
# - serverless-offline
functions:
client:
handler: handler.expresss
events:
- http:
path: /
method: GET
cors: true
- http: GET {proxy+}
- http:
path: /reply
method: POST
cors:
origin: '*'
headers:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
- CSRF-Token
allowCredentials: true
intents:
handler: handler.intents
custom:
secrets: ${file(secrets.json)}
apigwBinary:
types:
- '*/*'
# dynamodb:
# stages:
# - dev
# start:
# port: 8000
# inMemory: false
# migrate: true
# noStart: true
resources:
Resources:
S3OperationsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:provider.environment.BUCKET_NAME}
serversessions:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
ProvisionedThroughput:
ReadCapacityUnits: '5'
WriteCapacityUnits: '5'
KeySchema:
- AttributeName: id
KeyType: HASH
TableName: ${self:provider.environment.SESSIONS_TABLE}