News for hackers. Stuff that matters.
Re:Going Serverless: AWS and Compelling Science Fiction by mojoe on Friday November 11, 2016 @02:17PM (#12933442)
Has anyone used the AWS API Gateway service with lambdas to set up a small backend for a web service? The next thing I'm thinking about setting up is a slush reader with a GUI, and I'm wondering how difficult it will be to pipe binary files from S3 -> Lambda -> API Gateway -> client. It looks like I'll probably need to encode the binaries to base64 on the lambda side, and will need a library for that.
Re:Going Serverless: AWS and Compelling Science Fiction by balls187 on Friday November 11, 2016 @02:21PM (#12933482)
Yes extensively.

API-Gateway => Lambda isn't fun to trouble shoot.

That said, once you get it working, it works really well, and it's ridiculously cheap.

Re:Going Serverless: AWS and Compelling Science Fiction by mojoe on Friday November 11, 2016 @02:25PM (#12933522)
Have you written anything about this, or can you point me to any resources that might help me avoid pitfalls? I'd appreciate it!
Re:Going Serverless: AWS and Compelling Science Fiction by balls187 on Friday November 11, 2016 @02:28PM (#12933540)
Sadly, no I haven't written anything. (if my comments are any indication--I kinda suck as a writer).

The biggest pains are:

* Mapping parameters in API Gateway

* Setting the IAM Roles for API Gateway & Lambda (the latter is required to provide execution for API Gateway)

* Setting up custom domains for your API (it uses cloudfront, but must be done via the commandline, and the process kind of sucks)

I've done this work now 3 times. Feel free to email me any questions you have: [email protected] and I'll be happy to answer, and provide guidance.

Re:Going Serverless: AWS and Compelling Science Fiction by mojoe on Friday November 11, 2016 @06:42PM (#12935518)
Thanks, I may take you up on that down the road!
Re:Going Serverless: AWS and Compelling Science Fiction by ak217 on Friday November 11, 2016 @04:18PM (#12934422)
Take a look at https://github.com/awslabs/chalice. IMO it's better than zappa if you are Python-centric. As you can tell from the name, it strives to be the Lambda-based equivalent of Flask.

One tip regarding your workflow: don't pipe data from S3 to Lambda to your client unless you really have to. You can use S3 pre-signed URLs to granularly delegate access to S3 objects for a limited time, then refer your client to them. Even if you are generating the binary content on the fly in your lambda, it's easier to save it to S3 and refer the client to that. That said, if your content is truly too dynamic to live on S3, then gzip+base64 encoding it, serving it in json and decoding/displaying it in javascript should be straightforward.

Re:Going Serverless: AWS and Compelling Science Fiction by mojoe on Friday November 11, 2016 @06:43PM (#12935521)
I'll check this out, thanks!
Re:Going Serverless: AWS and Compelling Science Fiction by MrMullen on Friday November 11, 2016 @02:40PM (#12933643)
Zappa is a Python tool that can be extremely helpful for persons getting into Lambda. It basically handles everything except for code creation (You have to do that). You can make crontab like jobs or a website and then push the code up to Lamba with a single command. It handles all the temporary S3 buckets, IAM account creation, fetching the Lambda URL, uploading code and connecting Lambda to API Gateway. Deployments are super smooth.

pip install zappa

It supports all of the Languages for Lambda, not just Python.

Re:Going Serverless: AWS and Compelling Science Fiction by mojoe on Friday November 11, 2016 @06:43PM (#12935524)
I'm glad that tools like this exist, I wasn't aware of them, thanks
Re:Going Serverless: AWS and Compelling Science Fiction by talawahdotnet on Friday November 11, 2016 @02:36PM (#12933614)
For binary content I would recommend serving those files directly from S3 via Cloudfront under a different domain. Lambda and API gateway really aren't set up to work with binaries right now. Even serving .csv files requires some workarounds.

FYI it is also possible to go directly from the API Gateway to S3 without going thru Lambda

Re:Going Serverless: AWS and Compelling Science Fiction by defen on Friday November 11, 2016 @02:57PM (#12933771)
https://www.zappa.io/ if you value your sanity. The raw tools provided by Amazon are extremely powerful but are basically the cloud equivalent of programming in assembly.
Re:Going Serverless: AWS and Compelling Science Fiction by adzicg on Friday November 11, 2016 @05:30PM (#12935084)
shameless plug: have a look at https://claudiajs.com - I wrote lots of tutorials and example projects for common use cases of API GW+Lambda
Re:Going Serverless: AWS and Compelling Science Fiction by mojoe on Friday November 11, 2016 @06:46PM (#12935543)
This looks cool -- I'm using Python right now, but if I ever use javascript lambdas I'll give this a try.