https://serverless-stack.com/ logo
#help
Title
# help
f

Francois Lachance

01/16/2022, 7:45 PM
Hello all! I'm pretty new at this serverless stuff and I do see this as the way of the future. DynamoDB is a bit of a challenge for me given that it's very different than my relational background. My application is in need of what would be normally a lookup table with just under 200 rows. The data is pretty static, meaning it's very unlikely to change. Is this something that would be best practice to setup in a stack - define a DynamoDB table and load it with the static data? Or would it be better to simply create a constant in the code and hard coded values?
t

thdxr

01/16/2022, 7:55 PM
Probably not worth keeping in dynamo unless you need to manage the values of the data frequently and want to enable non engineers to do that
Otherwise a JSON file loaded into memory works well
r

Ross Coundon

01/16/2022, 7:55 PM
Retrieving it from parameter store is an option. Store it as a JSON value, retrieve and store it outside your handler
t

thdxr

01/16/2022, 7:55 PM
That's a cool idea too. Comes down to whether you want to put it in VCS and require a deploy to update it or put it somewhere more runtime
f

Francois Lachance

01/16/2022, 8:58 PM
I think the idea of a JSON file makes the most sense. What's VCS? Given how static the data is, doing a deploy to modify it is probably fine given how rarely that's going to happen.
t

thdxr

01/16/2022, 8:58 PM
version control system (assuming git in your situation)
I'm pretty sure you could just
import data from "./mydata.json"
in your code and it'll be bundled
f

Francois Lachance

01/16/2022, 10:51 PM
Cool! Thanks for the help.