Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can static pages be stored as lambdas? #15

Closed
LorenzoBoccaccia opened this issue Aug 5, 2015 · 8 comments
Closed

can static pages be stored as lambdas? #15

LorenzoBoccaccia opened this issue Aug 5, 2015 · 8 comments

Comments

@LorenzoBoccaccia
Copy link

can one cut out prices/complexity even more by storing pages in lambdas that return static html/js/css content?

you'd need a lambda for each page, but it seems access cost might be cheaper than s3 - well, depending on free tier allowances, but if one goes for the cheapest request count to these files can be drastically reduced using cloudflare as frontend

@adamburmister
Copy link

I'll take a stab at answering this:

When configuring your AWS API Gateway service you can configure a given endpoint to act as an HTTP Proxy.

image 2015-08-05 at 1 10 10 pm

This would allow you to direct a request to an S3 hosted file, for instance.

So... there is an architecture that would allow for this to happen easily, but I am not aware if such functionality has been implemented in this project or if it's planned.

@adamburmister
Copy link

Sorry, I realise I misread your question: You don't want to serve S3 files because of pricing.

I honestly wouldn't worry. It's fractions of cents to serve from S3.

As an aside to the original answer: @ac360 is S3 serving already implemented?

@austencollins
Copy link
Member

@LorenzoBoccaccia I haven't done any tests. But, I'd love to see some! If the tests reveal it's more economical, then this approach could be a big deal. Further, this could lead to easier, faster deployments.

To me, it comes down to the Lambda cold start issue. If you have a Lambda with a low memory size, it's slow to start up. If you up the memory size, the Lambda's CPU is also upgraded and it starts up faster, but then you increase the cost and then I'm not sure if it's still competitive with S3/Cloudfront/other options.

I'd lower the Lambda memory to the lowest possible setting. Make sure you have NO dependencies and as little code as possible and perform some tests. Make sure to wait over ~10 minutes in between some of the tests because that length of time will de-prioritize the Lambda function on AWS's infrastructure and it will have to cold start-up.

Next, I'm not sure how you would achieve fast speeds around the globe with this approach since Lambda is not yet available in all AWS regions (though, it's coming, I'm sure).

Anyway, I'm still trying to implement basic features within JAWS. If you or anyone else tests this out and the results look favorable/competitive, then we have some serious head-scratching to do.

@adamburmister S3 serving in JAWS is lacking right now. Currently, JAWS includes only a local development server, and some static asset boilerplate files for your website. There are lots of tools to help you get static assets onto S3. I'm currently surveying all of them so that I can incorporate the best for JAWS. Any suggestions?

@LorenzoBoccaccia
Copy link
Author

thanks for the reply. I'll have a look.

latency wise for cheapness sake I'd go to cloudflare - that should solve worldwide latency (but not spinup issues, albeit it can masquerade them for long enough)

@austencollins
Copy link
Member

@LorenzoBoccaccia I like this a lot. But the issue I see is the same in issue #13 -- API Gateway is designed to work primarily with JSON and it can't return anything else. I think it's time to head to the AWS developer forums and start requesting API Gateway return binary data.

@arieljake
Copy link

@LorenzoBoccaccia cloudflare or cloudfront, if we are sticking with Amazon services?

@jhairau
Copy link

jhairau commented Aug 8, 2015

Both options for caching static assets please.
On Sat, Aug 8, 2015 at 11:57 AM, Ariel Jakobovits notifications@github.com
wrote:

@LorenzoBoccaccia https://github.com/LorenzoBoccaccia cloudflare or
cloudfront, if we are sticking with Amazon services?


Reply to this email directly or view it on GitHub
#15 (comment).

@austencollins
Copy link
Member

@jhairau Absolutely 👍

@eahefnawy eahefnawy removed the question label Apr 8, 2016
felixrieseberg added a commit to felixrieseberg/serverless that referenced this issue Jun 28, 2016
Fixing lint errors for compile plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants