If I have lambda that scrapes web and it's executi...
# help
k
If I have lambda that scrapes web and it's execution can take 10 -20s it's better to deploy server on EC2 (never did that) or fly.io instead of deploying just lambda. Am I right?
m
If the function takes 10-20s as you stated then lambda should do it without any problems. Lambda's max timeout is 15 minutes
k
What about the price for keeping that api if I have traffic?
r
It’ll depend on your volumes and the memory size you allocate to the lambda. Lambda invocations are cheap though - https://aws.amazon.com/lambda/pricing/
k
Thanks. I'm trying to be aware of the execution time as it has
*Price per 1ms*
r
By my calculations, if you had 1Gb of memory allocated and the every invocation took 20s, you could call the lambda 2994 times before it cost you $1
k
Thanks a lot for your insights. Do you know what are the default lambda settings when it's generated and published via sst?
d
You can change all of them, including the defaults, to whatever you want.
If you are asking for general guidance on a web scraping lambda, 256MB should be plenty unless you have some kind of memory accumulating code or really huge web pages.
In which case you could call it 4x as much before getting to $1.
k
Thanks for info 🙏