forked from Vinayakrevankar/colibre-hackathon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
77 lines (71 loc) · 1.79 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
service: colibre-hackathon
custom:
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
bucketName: ${self:service}-${self:custom.stage}-images
esbuild:
platform: "node"
target: node18
sourcemap: linked
external:
- mock-aws-s3
- nock # Exclude unnecessary dev dependencies
serverless-offline:
httpPort: 4000
noPrependStageInUrl: true
reloadHandler: true
provider:
name: aws
stage: ${self:custom.stage}
region: ${self:custom.region}
runtime: nodejs18.x
memorySize: 128
timeout: 15
logRetentionInDays: 7
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:*
Resource:
- arn:aws:dynamodb:${self:provider.region}:*:table/*
- Effect: "Allow"
Action:
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
Resource:
- arn:aws:s3:::${self:custom.bucketName}/*
httpApi:
cors: true
functions:
app:
handler: backend/src/handler.handler
events:
- httpApi:
path: "/{proxy+}"
method: "*"
resources:
Resources:
UsersTable3:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.stage}-student-users3
AttributeDefinitions:
- AttributeName: "id"
AttributeType: "S"
KeySchema:
- AttributeName: "id"
KeyType: "HASH"
BillingMode: PAY_PER_REQUEST
plugins:
- serverless-dotenv-plugin
- serverless-esbuild
- serverless-offline
package:
patterns:
- "!**/*.test.ts"
- "!node_modules/mock-aws-s3/**" # Explicitly exclude mock dependency
- "!node_modules/nock/**" # Explicitly exclude nock if not needed
- "!node_modules/aws-sdk/**" # AWS SDK is bundled by AWS Lambda runtime
individually: true
excludeDevDependencies: true