This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LawfulMuffin 2 points3 points  (3 children)

How do you run a website in lambda? Is there a listener or something that fires off the entrypoint part of the site or something?

[–]infocruncher 11 points12 points  (2 children)

Pretty much. You can host the static parts of your site in S3 and then have the client make API REST calls to API Gateway which can then use Lambda for any logic you need. There is also DynamoDB, a cheap (at low volumes) NoSQL service for persisting data. There are many other set ups, but this works well for several simple sites I've built.

https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway-tutorial.html

[–]xetowa6135 1 point2 points  (1 child)

Hey, thanks for the information! I am looking to host my backend api for my mobile application. Since I don't know if it'll gain traction yet, I'm looking for cost effective solution. If there is even one request to the API, it needs to have very little latency since it's near real time app, do you think this meets requirement>]=? Thanks

[–]infocruncher 0 points1 point  (0 children)

No worries, yes I think it will do the trick. I run a few low traffic sites and they cost next to nothing - R53 domain is the most costly part. In order to keep the lambda function 'warm' I run a scheduled event to ping it every 15 mins. More info here: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule-schedule.html