AWS Lambda In Plain English "AWS Scripts"

So, it's officially called Simple Storage Service and we jokingly refer to it as the Amazon Unlimited Internet File Server, but it's actully much better than that.

What Does Lambda Do?

Lambda runs your code (currently Java, Node or Python). Things that you’d typically do with a server (or EC2) can instead be broken down into small chunks.

It’s like if you asked AWS to make you a custom computer whose one and only purpose was to execute your code block.

Flowcharts are commonly used to represent the entirety of a web application. Lambda’s would be the processing blocks within the larger program.

Amazon refers to each set of code, supporting libraries (like ImageMagick) and config files as a “Lambda function.” This is deeply confusing as “Lambda” and “function” are both used so often in so many ways in different programming languages.

In your overall application you might have several Lambda functions each of which does a discrete task. You could imagine an image processing application that takes each photo pushed into it and a series of Lambda functions on it.

  • Lambda Function #1: resize the image
  • Lambda Function #2: detect faces in image
  • Lambda Function #3: detect if Monica Tribbler who stole my milk in 3rd grade is in the photo.

The Concept of a Lambda

In many ways Lambda is an executable version of the Unix Philosophy where you strive to make short, simple, clear, modular, and extensible scripts that you tie together into a larger system.

What Makes it Awesome

Efficiency.

In the physical world, it’s immediately obvious when things are inefficient.

In the world of web services the inefficiencies aren’t always so clear, but at the core of things Lambda is an Amazon service that seeks to create a computing system that perfectly fits what you’re trying to accomplish.

Even better, Lambda is efficient in multiple ways:

  • Scales Up It’s design heavily encourages you to structure your code in a way that supports parallel processing. So if you jump from 100 to 100 million requests in a day, your app will won’t catch a server on fire.

  • Scales Down The flip side of this stereotypical scaling story is also true, that if you suddenly aren’t processing 100 million requests per day, then you aren’t paying anything for each one.

  • Right Sized For each Lambda instance you can tune how much memory it takes so you can easily tweak to fit a perfect price/performance ratio. Prior to Lambda you’d need to ballpark your processing and memory requirements across your whole application - which for most places translated into bumping up to the next tier of server “to be on the safe side” as predicting usage was so difficult.

Easy to Integrate with Events

Lambda functions are natively part of the AWS ecosystem and can be automatically kicked off when certain actions take place in other parts of your application.

For example: when an image is uploaded to S3, pass it to a Lambda and have it generate all the thumbnails for it.

This ability to set up events greatly reduces the amount of code and orchestration that you’d otherwise have to write.

Where to Start?

If you’d like to get started with AWS Lambda, I’d recommend playing around with the JAWS framework: https://github.com/jaws-framework/JAWS

Official Docs: https://aws.amazon.com/lambda/