CEO of Stark & Wayne, a consultancy for people who love Cloud Foundry, BOSH and DevOps in general.

AWS Lambda came out in late 2014 solving "run code without thinking about servers". But since I've been deploying code to Cloud Foundry installations since 2012, I have not been thinking about servers for much longer than the birth of AWS Lambda. So I didn't get excited about Lambda. It is proprietary. It only runs a subset of programming languages natively. And at $2.70/mth to run a 128M container, it's so easy and cost effective to run apps on Pivotal Web Services (a cheap, production-grade Cloud Foundry http://run.pivotal.io/pricing/).

The idea of only paying for applications when they are being used is attractive. I wish Cloud Foundry and Pivotal Web Service had this feature. Many programming languages/code frameworks are very quick to launch and so they are well positioned to run in containers that stop & restart quickly on demand.

AWS Lambda style pricing - pay for running the code, not just keeping containers running - is the inevitable pricing/consumption model for platforms such as Cloud Foundry. Just not yet. I am currently exploring https://github.com/cloudfoundry-community/autosleep which might offer similar features for auto-shutdown of inactive containers.

But today I wanted to play with the state-of-the-art in deploying applications/functions to AWS Lambda. I found Apex (github). I was impressed.

With apex, creating/updating AWS Lambda functions is as easy as:

apex deploy

Getting started

http://apex.run/ has a good introduction to getting the apex CLI installed, and for setting up AWS credentials (~/.aws/credentials).

For a new project, run the apex init command. It helpfully creates a sample Lambda "function" (Lambda language for "application"), and Apex also creates an AWS IAM role to allow it to manage AWS Lambda.

mkdir helloworld
cd helloworld
apex init -r us-east-1

This will prompt for some getting started questions. It also includes ASCII art, so you know its good.

This looks to be a quirk of Amazon AWS's fancy "eventual consistency" behavior, which is otherwise known as "sometimes wrong". Wait 5 seconds and run apex deploy again and the issue should have resolved itself.

Apex also allows you to invoke a function directly and get the output to the terminal.

As referenced in the sample code above, Apex includes a Golang library https://github.com/apex/go-apex for support for Apex/Lambda – providing handlers for Lambda sources, environment variables, and the runtime requirements such as implementing the Node.js shim stdio interface.