Random question: Our analytics collect endpoint is...
# random
d
Random question: Our analytics collect endpoint is using an API to retrieve IP information (country, state, city). We pay for each request on that service. Generally a normal session will trigger about 5ish events. I’m thinking about some in memory database to store that IP payload for the next hour. What AWS serverless product would you use for that?
s
If it has to be in memory, then elasticache or redis. If it's fine to be persisted, then DynamoDB with a TTL column. DynamoDB only guarantee a TTL delete will happen in 48 hrs so additionally making the timestamp part of the sort key and using it in your query will be what is required. We did this for UK addresses lookup in a national government service which would make a request per person. We had a 24 hour cache so we didn't need to call the directory, due to the fact there are about 34 million people registered.
f
+1 for DynamoDB. Also you’d need to deploy ur Lambda into VPC to use elasticache/redi
d
Elastic cache was my first idea. But the whole VPC plus allocating a machine type and have to scale it up isn't appealing. I'm not from serverless habits so at first a database for this sort of process seems too much. But I'll go with dynamodb!
Thanks
r
Redis Labs does have an a truly serverless Redis option and it's sorta available for AWS via the marketplace: https://aws.amazon.com/marketplace/pp/prodview-mwscixe4ujhkq?sr=0-1&ref_=beagle&applicationId=AWSMPContessa That's still a lot of friction compared to DynamoDB though.
d
I tried with DynamoDB and using TTL. That makes it incredibly simple to operate.