[RFC] DynamoDB table #54
Replies: 2 comments 5 replies
-
Seems to be a regular use case for serverless applications. On-demand seems a good default and I don't see a need for it to be configurable in a first version. Point in time recovery is also a nice thing to have by default. But I think it makes sense to make it configurable because PITR is not included in the always free tier of dynamodb and and isn't necessary if you are using dynamodb as a cache store. |
Beta Was this translation helpful? Give feedback.
-
Thanks for putting together this proposal @mnapoli :) The equivalent CloudFormation configuration of your proposed API is (excluding point in time recovery): AWSTemplateFormatVersion: "2010-09-09"
Resources:
myDB:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
-
AttributeName: "projectId"
AttributeType: "S"
-
AttributeName: "userId"
AttributeType: "S"
KeySchema:
-
AttributeName: "projectId"
KeyType: "HASH"
-
AttributeName: "userId"
KeyType: "RANGE"
BillingMode: PAY_PER_REQUEST I fill like there is not much addition provided by Lift on top of using straight CloudFormation. Here are a few additional recommendations I'd stick by to ensure users can easily bootstrap a one-table configuration with minimal DynamoDB knowledges upfront:
Using single-table design prevents user from actually leveraging this construct when:
However, I feel like those use-cases only represents a small part of DynamoDB users. WDYT ? |
Beta Was this translation helpful? Give feedback.
-
The goal of this discussion is to get feedback on a "DynamoDB table" construct.
Use case
Setting up DynamoDB tables in serverless applications.
Quick start
How it works
On
serverless deploy
, thedynamodb
construct will create a DynamoDB table preconfigured for production.The table will be configured to scale on-demand (not provisioned). Costs will start at $0/month and will be proportional to the usage of the table.
Point in time recovery will be enabled to get continuous backups for 35 days.
Variables
All
dynamodb
constructs expose the following variables:These can be used to reference the queue from Lambda functions, for example:
How it works: the
${construct:db.tableName}
variable will automatically be replaced with a CloudFormation reference to the DynamoDB table.Permissions
By default, all the Lambda functions deployed in the same
serverless.yml
file will be allowed full access to the DynamoDB table.Configuration reference
Primary key
DynamoDB primary keys are either:
When only using a partition key:
When using a partition key + a sort key:
Would a construct like this help in your projects? What would be missing?
Beta Was this translation helpful? Give feedback.
All reactions