
Show HN: JAWS – A JavaScript and AWS Stack - ac360
https://github.com/servant-app/JAWS
======
DocSavage
Thanks for sharing. I've just started work on a server-free AWS architecture,
but instead of using the AWS API Gateway feeding into Lambda, I'm working on
static pages with AWS SDK for Javascript (served from S3) talking directly to
Cognito, RDS and S3 with lambda for async processing:

[https://aws.amazon.com/sdk-for-browser/](https://aws.amazon.com/sdk-for-
browser/)

I'm surprised I haven't seen more discussion of SDK for Javascript since it
removes a lot of the server requirements. Have you considered using AWS SDK
for Javascript, or do you explicitly want a REST API as an abstraction layer?
The API certainly provides some advantages if you ever want to migrate off
AWS. In my case, the lambda functions get invoked by particular events on RDS,
S3, or manual/browser triggers instead of AWS API Gateway invocation.

~~~
at-fates-hands
I'd like to see this when you get finished. I'm looking for a new way to do
static webpages that's fast and hassle free.

~~~
DocSavage
Unfortunately my client is closely coupled to a venture I'm doing on the side.
I won't be open sourcing it. If it's just static web pages you need without
mutable data, you can do that directly off Amazon S3. There are lots of blogs
and open source projects for that:

[http://stout.is/](http://stout.is/)

[https://sysadmincasts.com/episodes/48-static-sites-using-
aws...](https://sysadmincasts.com/episodes/48-static-sites-using-
aws-s3-cloudfront-and-route-53-1-5)

If you sprinkle in AWS SDK for Javascript in the browser, you can handle
mutations directly into various persistence services without needing EC2. I'm
still very early in my exploration of this approach so I was hoping to see
some case study myself. If there's no direct way to invoke lambda from a
service event (e.g., an RDS mutation), you could invoke it from the client
after returning from the RDS request.

------
zer00eyz
First of all nice work!

Second there is already a product out there called jaws:
[http://www.freedomscientific.com/Products/Blindness/JAWS](http://www.freedomscientific.com/Products/Blindness/JAWS)

The last time I checked (and my information is very dated, 5+ years) this was
a fairly popular piece of software in the blind community. I also do not know
the status of trademark around the term. If you were going to change names,
its early days for you now would be the good time to do it.

~~~
mwcampbell
JAWS the screen reader is still quite popular, though an open-source one
called NVDA ([http://www.nvaccess.org/](http://www.nvaccess.org/)) is on the
rise.

I doubt that FS will come after this project for trademark infringement, since
it's not a threat to them, not even in the same field.

~~~
zer00eyz
I agree with you "minimal" risk assessment. However we have all see companies
do stupid things. I don't remember off hand if you are REQUIRED to defend a
trademark for it to be enforceable.

~~~
xeromal
You are REQUIRED or you lose it. It is what has caused a lot of lawsuits in
the first place.

------
krschultz
Note that you should be wary of AWS Lambda limits. We blew through them on our
first day directing traffic on a system we were testing with Lambda. They were
able to increase our limits a few days later, but something to think about
before you base your whole stack around it.

[http://docs.aws.amazon.com/lambda/latest/dg/limits.html](http://docs.aws.amazon.com/lambda/latest/dg/limits.html)

~~~
ac360
Those will be raised soon.

AWS introduced API Gateway because they want back-ends being built on AWS
Lambda. They will raise the limits, but this is all bleeding-edge tech and
they are likely moving forward with caution.

~~~
chadmaughan
They've already increased it from the originally published concurrent requests
per function limit (originally 50, now 100) [1]

We'd like the "Total size of all the deployment packages that can be uploaded
per account" increased. Since you have to "require in" (as you put it) all
your dependencies with each published function it's plausible to hit that
limit pretty quick.

The average node module is 1.6MB [2]. If your functions have 3 dependencies,
you're near 5MB. That limits you to ~300 functions. That initially seems like
a lot until you realize you may have to start breaking up complex logic into
multiple functions to hit time limits. You also might need to maintain
multiple versions for backwards compatibility (think v1 endpoints). And if you
use Java 8, you're just screwed. That size limit can be hit quick.

[1] -
[https://web.archive.org/web/20150315092544/http://docs.aws.a...](https://web.archive.org/web/20150315092544/http://docs.aws.amazon.com/lambda/latest/dg/limits.html)

[2] - [https://www.npmjs.com/package/npmjs-
stats](https://www.npmjs.com/package/npmjs-stats)

~~~
deegles
It might be possible to write a wrapper function that pulls a larger function
from S3. I think you get up to 500mb of /tmp storage per function. Obviously
the initial startup time would be atrocious but if you have a high enough TPS
it wouldn't be hit too often.

I could also see Lambda adding a paid-for option to keep a function "warmed
up" at all times.

------
mands
Great work - looks like a really useful piece to help you quickly get going
using the AWS stack and Lambda/JS. The biggest issue I've always found is the
extra steps between writing your code and getting it onto a server.

The "no server" movement definitely seems to be gathering steam, with Firebase
and Parse on the data side and Lambda (augmented with JAWS and others) on the
computation side. Am excited to see what this area will bring, in particular
due to the combination of scalable hosting and containerisation.

(Plug - we're working on StackHut
([http://www.stackhut.com](http://www.stackhut.com)) in the "no server" space
that provides a language-agnostic Lambda-like platform (currently JS/ES6 and
Python with Ruby soon) that's powered by Docker and is accessible via JSON-RPC
over HTTP. Would love to hear your thoughts on this and the "no server" space
in general.)

~~~
Jake232
Tried your public demo's, they don't seem to work.

~~~
pea
Hi Jake! Sorry you're having issues.

I'm presuming you're on Sky in the UK? They are currently blocking HTTPS on
various CloudFlare endpoints (such as ours!) We're attempting to get this
sorted ASAP. Let me know if this isn't the case!

Cheers -- Leo

~~~
Jake232
I am on Sky in the UK, looks like it is an ISP issue then. I'll keep an eye on
you guys though, I'm a big fan of being able to just run functions on-demand
like this. I used to use PiCloud extensively before it was bought out.

------
foolinaround
This seems very convenient...

Is there some blog/resource that provides an estimate of the pricing when we
go this route, instead of a seperate server for the APIs.

I would like to know the rough pricing in an order of magnitude level?

Would it be twice as expensive as a django app for an application with light
usage, etc?

TIA!

------
ahallock
Love this idea, but I wish there were an official integration between Lambda
and RDS; I don't want to use DynamoDB.

~~~
ac360
The plan was always to add RDS integration, specifically Aurora support.

That plan hasn't changed! Just need to find more time for open-source projects
:P

~~~
alexbilbie
I believe to support RDS in Lambda you'll either need to dynamically add the
Lambda instance's public IP address to your RDS security group (and remove it
once complete) on each run or make the RDS instance open to a large number of
AWS IP ranges^1

[1] [http://docs.aws.amazon.com/general/latest/gr/aws-ip-
ranges.h...](http://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html)

~~~
ac360
Hmmm, I'll look into this. Either way, I'm sure Amazon is aware that RDS in
Lambdas is a good thing, and they will continue to make this and their other
tools easier.

We'll get there!

------
ac360
Just added a section in JAWS Optimization on the AWS Pop-Up Loft because it's
a tremendous resource and I don't think many people know about it. Since this
page is so popular, I'll paste the section in here:

AWS Pop-Up Loft

AWS has an office/loft in downtown San Francisco where you can meet with an
AWS engineer for free to discuss your project and your use of AWS services.
It's an incredibly valuable resource, but I don't think many people know about
it.

All you have to do is schedule a meeting in advance. Meetings can last up to 1
hour and can be scheduled M-F during normal business hours.

Further, their office and loft is also a free co-working space, as long as you
are using AWS services. They have some nice couches and desks and it's a great
way to network with other developers who use AWS services.

Again, all of this costs nothing. If you're in SF, or traveling there, check
it out!

------
rabbyte
This is jawsome. I feel like you're cheating on the "no server" bit with some
AWS semantics but you're not the first so, whatever, nice job.

~~~
ramon
It's no server because Lambda is not a server like VPS that you get it up and
running 24 hours, it's a service that gets a call and runs your function. You
don't have a server up it's a function on the backend. It's being called by
the JS SDK on the browser, therefore no server, plain static + function
calling architecture.

Best,

~~~
aikah
> It's no server because Lambda is not a server like VPS that you get it up
> and running 24 hours,

What you say makes no sense. There is a server , you just don't manage it
yourself.

> it's a function on the backend

And where is the "backend" ? that's right , on a server.

> It's being called by the JS SDK on the browser,

What does the SDK call ? a server when your functions lie.

Lambda + api gateway are a BAAS. You might have some logic running in the
browser but the lambda functions run @AWS. So there is a server.

It's a bit like Couch Apps by the way,except that you can scale at the 'design
document level', not just at the 'node level'.

~~~
benologist
It's "no servers" for the developer in the sense that there is zero
infrastructure to manage, configure or deploy. This is popularly known as a
"PaaS" or platform as a service, ala Heroku and similar providers.

------
aikah
It's a bit what Couch Apps where supposed to be, without the vendor-locking
part...

> no server

But you have to rely on AWS infrastructure. So what you meant is no server
management.

~~~
rajington
the pricing difference is huge too, AWS's PaaS Elastic Beanstalk took away the
"server management" part for the most part but this allows a lot of power when
you need it and absolutely no costs when you don't.

------
xeromal
I've been trying to find a core example of how Jaws works without having to
download anything. Could you include an example in your readme of an example
API using lambda? Even some pseudocode would help me understand.

~~~
ac360
Yes, I'm working on an overview video now.

------
reilly3000
I've been looking for something like this within a ClojureScript workflow.
With the new JS compiler it seems not too far off.

This is very cool. I would love to see more aws resources exposed as well
through JAWS like dynamo or RDS.

~~~
ac360
JAWS uses DynamoDB. Aurora (RDS) support is coming soon!

~~~
reilly3000
sweet!

------
Jonovono
This is interesting, thanks for sharing. Was a bit confused about lambda.

So this would be cheaper than just having an EC2/DO instance running flask
with a couple of endpoints?

~~~
ac360
Absolutely.

You pay for EC2/DO even if your app isn't used. With JAWS, you pay only when
your app is used.

Here is Lambdas pricing FYI:
[https://aws.amazon.com/lambda/pricing/](https://aws.amazon.com/lambda/pricing/)

~~~
sologoub
The examples are very interesting, as it's not necessarily cheaper, because if
you could handle the same 3 million requests per month with a t2.micro for
~$10 per month, Lambda approach would be close to 2x more expensive.

However, the benefit here is that you don't have to provision to peak capacity
needs + (some safety fudge factor), thereby having paid for, but idle
capacity.

It's a very intriguing proposition for new services where you may not be able
to optimize costs as much for fear of losing up time, but I'm sure it makes a
lot of financial sense for AWS. Nothing stopping this from being a win/win
though.

~~~
inopinatus
Here's a problem with cloud economics. People don't compare apples.
Essentially, I am not short $10 but I could use some time back in my week.

Getting bogged down in managing servers, or a fleet of instances, or the
devops stack to automate a fleet of instances; it's all a time sink with
either an actual cost or at the very least an opportunity cost, orders of
magnitude beyond that $10/month.

This is especially true for organisations where provisioning an instance
requires an epic chain of approvals "because it's a server". Unfortunate but
all too common.

Of course if you were planning to become (or already are) a competent devopsy
admin then provisioning instances is not necessarily a waste of your time. For
everyone else, platform-as-a-service such as Lambda can be an huge win. Sure,
there's still a tipping point but it's much greater when time, rather than
simply price, is considered.

On the other hand, and contrary to the Amazon-is-scalping-me gripes I hear on
HN all too frequently, my experience has consistently been that AWS want you
to minimise costs due to design. Every well-run business knows the long-term
virtuous cycle of satisfied & continuing customers far outweighs a short-term
revenue grab.

ObDisclosure: I am a former AWS architecture manager but do not speak on
behalf of my ex-employer.

~~~
sologoub
Couldn't agree more. The $10 example was in response to the EC2/flask comment
earlier in the thread.

------
reedlaw
Is there a way to use a file system-backed storage with this? For example, I
would love to create a web frontend for ledger [1]. Ledger only reads text
files but for a frontend to be useful it would need to write entries to files.

1\. [http://www.ledger-cli.org/](http://www.ledger-cli.org/)

~~~
rajington
'getObject' and 'putObject' using the JS AWS S3 SDK on Lambda, triggered by
the API Gateway:
[http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.ht...](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html)

~~~
reedlaw
Is there an append function? Otherwise it seems like it will have to send the
entire file for each incremental write.

------
joeyspn
Really cool... Now we just need longer Lambda execution times (current limit
is 60s) and a proper crontab. For a complete auth flow you can also check:

[https://github.com/danilop/LambdAuth](https://github.com/danilop/LambdAuth)

It would be nice to integrate some ideas from LambdAuth into JAWS.

~~~
danilop
Hi, I am the author of LambdAuth and would be more than happy to help! JAWS is
both interesting and promising!

------
hoprocker
Great experiment here. Lambda has been intriguing me for a while. More and
more, as I scope out work for clients, I'm finding bits that could probably be
run as Lambda processes instead of requiring an entire EC2 instance. This is
kind of like taking a REST interface to a natural extreme.

~~~
ac360
Agreed. I think of it as "cloud computing, fully realized".

------
Skywing
I was looking into using lambda functions called in response to an S3 event.
Specifically, I wanted to create a record in my SQL database after a file is
uploaded to S3. Users are uploading directly to S3 using pre-signed requests,
so I needed some way to step in and create a database record after they
actually perform the upload to S3. S3 supports this via several methods, one
of which is the lambda functions, but when looking into lambda functions there
was no way to have the code access my SQL database internally, I would have
had to make my SQL database open to the world. I didn't find any IAM rules etc
to enable lambda functions to access my SQL database resources. I'd be curious
to see how this is handled by this JAWS work flow.

~~~
cddotdotslash
I've also needed to have Lambda functions access databases on an RDS instance
within a VPC and haven't been able to do so without opening the database up to
everyone. Seems like a feature they should think of adding soon.

------
imechura
You may want to reconsider the name since JAWS is widley known as the defacto
application for accessibility screen readers.

As far as legal stuff goes the american federation of the blind has been known
to litigate against technology companies.

------
impostervt
Ha, been working on something similar. If you get a chance, take a look. Maybe
we can collaborate.

[https://github.com/johntitus/hocus](https://github.com/johntitus/hocus)

------
exratione
I'm presently about three quarters done with writing one of these myself;
Lamdba plus SQS plus arbitrary functions. I have a different take on
deployment, going with CloudFormation. Version updates are something you have
to think about quite hard with this sort of system.

The real challenge is how to manage within the 60 second, 1024 thread limits
in a sane way, however. You have to approach application decomposition in a
much more rigorous way.

~~~
cayblood
exratione, please consider posting a github link of your approach.

------
thallium205
And the move towards Google App Engine continues...

~~~
mrtron
If App Engine had some neat AWS features early on, it could have done really
well. I think App Engine was one too many hops away from 'mainstream dev', but
is probably very close now.

------
silverlight
Is it really true that Lambdas can take 5 minutes to start up? Doesn't that
rule them out as useful for things like running a website (instead of just
background jobs)? Or does the article mean 5 minutes from the first time you
deploy a new one to the time it's available, but after that new lambdas can be
spun up in milliseconds to server each request?

~~~
ac360
No, that is not true. While AWS Lambda has cold-start issues, they can be
mitigated.

While AWS continues to improve Lambda performance (it's still early tech),
I've started an "Optimization" section in the wiki, detailing how everyone can
get better performance out of JAWS.

Further, JAWS is optimized for AWS Lambda performance.

~~~
silverlight
Oh, okay, I must have misread the article then. Sounds good :-)

------
ramon
Great job, grabbed my attention, I really liked this, but I'm doing so great
with gulp that if I used this I really would still need to use gulp because of
the optimizations, I'm also using S3 and Lambda, but I like the idea of
running aws lambda locally before uploading and the "run a server locally"
before upload.

~~~
ac360
Ramon,

Could you share some of your gulp optimizations so that I can incorporate them
into the project?

You don't have to share their code if you don't want to, but if you could
write down what the gulp tasks are, I could incorporate them into the JAWS
Command Line Interface.

Thanks for the positive feedback btw :)

~~~
ramon
I really liked the concept of your project and it's in my bookmarks already. I
can share, can you add me in twitter it's ramonck, I'll write down a paper in
Medium sharing the details, I already wrote down the concept of a mobile
product I did with Gulp and Lambda I'm about to share in Medium as well, I'll
also be glad to share the indepth details of the technology, but I think it
will be more productive for you and for others to have it in a single spot.
Add me there I'll share in the next week or so.

Best Regards,

~~~
steezeburger
Looking forward to this. Added you.

------
dmmalam
Does AWS API Gateway support Websocket endpoint? Would be interesting to
created a realtime websocket API, backed by lambda.

~~~
jkarneges
You could probably do this with Fanout.io, which has a WebSocket->HTTP
gateway.

------
xasos
Nice work on the project! Big fan of the graphics also :)

Reminds me of Divshot [0], a heroku-like service for hosting static sites.
It's great that you can roll your own site, and don't need a middleman to host
for you.

[0] [https://divshot.com/](https://divshot.com/)

------
aakilfernandes
Sounds interesting. What kind of apps make the most sense for JAWS?

~~~
alexbilbie
I've got to implement a simple site this week for our customers to be able to
upload photos to S3 and then I need an API endpoint to list these photos. JAWS
seems like a great solution for this.

------
Murali4ever
this is really cutting edge stuff, great job. Would be event cool to include
polymer webcomponents (on client side) , AWS Cognito for authentication along
with this.

------
joeevans1000
Jaws already exists as a software project, for the blind.

Perhaps I am exposing ignorance about the needs of the blind community, but it
would seem to me that a primarily important piece of software for them could
be more confusing to find and update and so on if another piece of software
appears with the same name. Maybe you should consider changing the name of
your software before it's too late? It's possible that your Jaws may, in the
long run, cause considerable confusion for the users of the pre-existing Jaws
software.

I'm making a case based on empathy rather than trademark law and so on.

------
Nitramp
Woohoo! It's the second coming of stored procedures and PL/SQL! Party like
it's 1988!

Seriously though, these kinds of architectures come at a cost. The website's
claims are either misleading, or the authors haven't understood the problem
domain. E.g.:

 _Each of your API URLs points to one of these Lambda functions. This way, the
code for each API Route is completely isolated, enabling you to develop
/update/configure/deploy/maintain code for specific API urls at any time
without affecting any other part of your application(!!!)._

Even if you add more exclamation marks, you'll still end up with front end
code depending on the interface exposed by your backend code, meaning you'll
have to do versioned rollouts, except you no longer have a single deployable
but a zoo of store proce^W^Wlambda functions, with unclear interdependencies
and (usually) no proper versioning or tracking.

This might be the right architecture for certain apps, but it's not the easy
win/win that's presented here.

~~~
ac360
Up next, I will add the ability to define your entire JAWS API in JSON via
Swagger.

Swagger JSON can be imported to create/update your REST API instantly via AWS
API Gateway.

Meaning, you can still do larger, versioned roll-outs by simply updating the
JSON in your Swagger file.

This will give beautiful structure and simplicity to the JAWS workflow.

The single deployable server you advocate is a single point of failure.

~~~
Nitramp
I'm sure you'll further improve this, good luck!

 _The single deployable server you advocate is a single point of failure._

I'm not talking about a deployable server, I'm talking about a deployable as a
unit of deployment, e.g. a war archive. A deployable is a compile time
artefact, a single point of failure is a runtime concept. In that sense,
saying a deployable was a single point of failure is like saying a line of
code is a single point of failure.

------
shaneqful
Anyone else immediately think of the screen-reader

------
alpacaaa
This thing is awesome, thanks for sharing!

------
techpeace
Excellent work, thanks for sharing!

------
jitix
Seems great for cloud applications. Only thing I would worry about is vendor
lock in.

------
wampler
There's a server here -- it's just that it is not yours.

~~~
findjashua
While I understand the need to give a snappy comment, does this really
contribute any value to the discussion? It's obvious that OP means develop
apps without dealing with servers. I don't think anyone would imagine that the
entire app is running without any servers at all.

Please reconsider leaving this comment here.

------
kevindeasis
beautiful, this will be fun to try out!

------
sigmonsays
Is this an april fools joke in August?

~~~
desdiv
What's so funny about this?

~~~
tycho01
the name combined with the shark!

------
curiousjorge
Yes! Yes! Yes! Now I just wish there was Python support.

------
mk00
this idea is terrible

~~~
ac360
Thanks :)

