News for hackers. Stuff that matters.
Re:Writing Cloud Functions by encoderer on Wednesday February 10, 2016 @02:52AM (#11071309)
At Cronitor we've just finished building out lambda infrastructure for a fan-out where I would otherwise use a worker application and supervisord. Some of this is lambda specific but I think it might be interesting nevertheless.

Lambda has a lot of strengths, and it gives you solid primitives like immutable versions, version aliases/pointers and stateless functions. The problem I had was that it didn't give me any more than that. Here are just a few of the things we had figure out and then build ourselves:

1. The development workflow. How can I get a REPL workflow going that doesn't make me go crazy.

2. Deploys and Rollbacks. How can we safely deploy and rollback, especially in cases where you have the same lambda function in multiple regions and each region is at a different published version (because the version number is monotonically incrementing)

3. Permissions and Policies. The broad strokes are clear. But you want your S3 bucket or SNS topic to trigger lambda? Get ready to spend an hour trying to figure out what you've done wrong and what's missing from the vague directions. Hope you get that REPL flow solid first. In the end, we built several scripts (create_build, publish_version, promote_to_prod, etc) and we use these directly during development and from a Fabric-based deploy script. When I have time I plan to release this tooling open-source.

If I had to do it all over again, I wouldn't. And I wouldn't use Cloud Functions. I would just use a t2.small instances with a simple worker.

Re:Writing Cloud Functions by viraptor on Wednesday February 10, 2016 @03:43AM (#11071448)
My biggest issue is that (unless I'm missing something obvious), there's no way to add any configuration to the lambda. If I want different queues to do (slightly) different things, then I either need different code upload for each of them, or the parameter to be sent on the queue.

I could not find any place where I can tell it - this is the code, this lambda uses it with N=5, that lambda uses it with N=42.

Re:Writing Cloud Functions by glenjamin on Wednesday February 10, 2016 @03:59AM (#11071507)
I've spoken to an Amazon rep about this.

The best approaches they were able to suggest were:

  * Lookup config from dynamo db when the lambda runs
  * Lookup config from S3 when the lambda runs
  * Bake config into the artifacts
You can read the name of the alias you're currently running as from the context data, and use this as a key into some external system.

Not ideal.

Re:Writing Cloud Functions by twagner on Wednesday February 10, 2016 @08:01AM (#11072414)
Suboptimal ;-). This is a common request, and we're looking at options for a config feature that's independent of the code payload. Tweet or email me detailed suggestions/asks for it: @timallenwagner or timwagne at amazon.com.
Re:Writing Cloud Functions by viraptor on Wednesday February 10, 2016 @05:54PM (#11076844)
Why not inject it to `context` parameter in some variable with known name? As long as the field is exposed to CF and in the panel, it should be all we need.
Re:Writing Cloud Functions by encoderer on Wednesday February 10, 2016 @11:37AM (#11073884)
I struggled with this a bit at first. I moved all my config into my payload, which pleased me a lot, but only really works in the use case where Lambda is being triggered by a queue/topic message or by your direct invocation.
Re:Writing Cloud Functions by ignoramous on Wednesday February 10, 2016 @03:07AM (#11071350)
Valid points. Honest q: did you consider a framework like JAWS[0] for your installation? Don't any of those frameworks solve your problems out of the box?

[0] https://github.com/serverless/serverless

Re:Writing Cloud Functions by discodave on Wednesday February 10, 2016 @03:36AM (#11071424)
What they need is Lambda + CodePipeline (or something like that). The ability model your whole application (Lambdas + tables + containers etc.) and have Alpha/Beta/Gamma/Prod with tests in between :)
Re:Writing Cloud Functions by twagner on Wednesday February 10, 2016 @07:58AM (#11072401)
This is great feedback encoderer. We're going to keep iterating fast to make deployment, packaging, and global (cross-region) updates even easier for AWS Lambda.