Store list of strings in database
I need to store a list of strings in between lambda invocations. I considered using dynamodb, but is there any better way to do this?
Posted Mar 10, 2020, 6:00 PM UTC
I need to store a list of strings in between lambda invocations. I considered using dynamodb, but is there any better way to do this?
Posted Mar 10, 2020, 6:00 PM UTC
SQS?
[deleted]
Redis would be my go-to, but really depends on your specific use-case details.
I think redis is a bit too powerful for my case. I need to add ~50 strings to the cache every 10 minutes, and retrieve those strings ~50 at a time every 10 minutes.
Why do they need to persist to disk? Could you just cluster them in memory with an API?
Redis is a key/value store intended to do exactly what you just mentioned. You could use a very small Redis instance for this.
Parameter Store?
No, just strings
Route 53, obviously :)
I'd go for Dynamo DB for this. You can set a TTL and can store it as a List type too.
what's the size of these payloads? i am using dynamodb as key-val cache (cause it's serverless) and i gzip strings (of json, in my case) when the payload is in "danger" of exceeding 400k (object-max size in ddb)
Very short, like less than a kb
This sounds like a textbook example of when to use dynamodb.
DynamoDB would work well for this. S3 is also an option. If you create a unique item for each Lamba invocation, you can configure a lifecycle policy on the bucket to delete old items and not even worry about deleting them in your code. Creating new S3 items each time guarantees read consistency (otherwise you could read stale data).
DynamoDB items can have a TTL set on them as well.