Skip to content

Commit

Permalink
feat: Dynamo
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsign committed Mar 27, 2024
1 parent 311ea94 commit c1b9a1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions resources/dynamodb-table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Resources:
DynamoTable:
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain # Make sure the tables can't be deleted by CloudFormation/Serverless
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: PK
AttributeType: S
- AttributeName: SK
AttributeType: S
KeySchema:
- AttributeName: PK
KeyType: HASH
- AttributeName: SK
KeyType: RANGE
# Set the capacity to auto-scale
BillingMode: PAY_PER_REQUEST
4 changes: 4 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ provider:
QUICKNODE_API_KEY: ${env:QUICKNODE_API_KEY}
QUICKNODE_HTTP_URL: ${env:QUICKNODE_HTTP_URL}
RESERVOIR_API_KEY: ${env:RESERVOIR_API_KEY}
tableName: ${self:custom.tableName}

functions:
fallback:
Expand Down Expand Up @@ -411,6 +412,7 @@ functions:

custom:
stage: ${opt:stage, self:provider.stage}
tableName: ${self:custom.stage}-llamafolio-table
esbuild:
config: './esbuild.config.cjs'
prune:
Expand All @@ -420,6 +422,8 @@ custom:
resources:
# CORS for api gateway errors
- ${file(resources/api-gateway-errors.yml)}
# DynamoDB
- ${file(resources/dynamodb-table.yml)}

plugins:
- serverless-esbuild
Expand Down

0 comments on commit c1b9a1c

Please sign in to comment.