4 ms·
What's the point of API Gateway? Looks like a proxy where you recreate your api and does nothing more.
by homero 10y ago
What's the point of API Gateway? Looks like a proxy where you recreate your api and does nothing more.
- pmontra 10y agoI think I leant about it when I learnt about Lambda. In this context it's a convenient way to give a URL to a function, pass parameters to it and get back the result. You could build HN with the API gw, one Lambda function per each request and a db.
- inopinatus 10y agoThat's exactly what I'm suggesting is an anti-pattern. Yes you can do that. Yes it's hardly surprising that AWS make it possible, since synchronous RESTful CRUD is such a popular integration approach and often the first one we learn. But I'd advise you to design your LambdaNews service using an asynchronous event-driven model instead. You'll find it reduces complexity and makes for a snappier, more reliable client experience (e.g. no 429 throttling responses to handle). You'll also find that the supporting AWS services like Kinesis, Cognito, IoT, SNS, SQS, DynamoDB, S3 etc are much more in tune with that pattern. The fact is that async platforms scale much better than anything that has to block and poll. It should hardly be surprising that at AWS's massive scale, it becomes a preferred service design pattern. Pub/sub integration people have known this for decades, it is not news. obdisclosure: I am ex-AWS but all the above is derived from public statements and documentation.
- pmontra 10y agoI'm sincerely interested. The POST I use to submit this comment can be asynchronous, no problem (just do ajax). Same for votes and flags. The GET I use to get the page could be a real HTTP GET or diffs coming over a websocket (but I need a page to start with). I'm not sure how to implement that in the AWS ecosystem because I don't have much experience on it, but is it this what you mean with "asynchronous event-driven model"?
- beat 10y agoAPI Gateway does a number of things. It distributes endpoints via cloudfront, which is pretty awesome. It serves as a unified front end for a collection of back end microservices. It handles client cert authentication (important to us, but not to most people) and api keys for you, and a bunch of other neat stuff as well. And it offers a test harness where you can mock up data easily. In theory, you could do the same thing with nginx and load balancers and multiple ec2 instances, but it'd be a lot more work. And I think the real magic is with integration with Lambda. That's a game-changer.
- homero 10y agoOffloading some calls into lambda does look cool