Micro-Applications With AWS Lambda

At this year’s Amazon Web Services re:Invent conference, AWS unveiled their second compute service - Lambda. AWS Lambda is a PaaS-like service that runs discrete chunks of code in response to a given event - without needing to manage any of the underlying compute resources. Lambda responds to a wide range of events within your AWS infrastructure within milliseconds of their occurrence and completely removes the need for inefficient polling as you wait for resources to change.

Lambda will fundamentally change the way applications are built in the future by allowing developers to shift from a single application to multiple event-based Micro-Applications. Today, traditional software development consists of three main components: Functions, Interactions, and Data. Functions are core business logic, Data holds business state, and the Interactions are the events that tie the two together. Lambda exists at the intersection of Functions, Interactions, and Data by responding to particular events within your AWS infrastructure and executing a code tailored to that specific event.

Functions, Events, and Data

With the new paradigm shift that Lambda introduces, your applications turn from single source code solutions (i.e. .NET solution/project) into multiple event based Micro-Applications that consist of the core building blocks of functionality required to run your application. This allows for the entire suite of back-end services in your application to scale in a huge way since they are individual, discrete components backed by the complete power of AWS EC2.

In the example below, three Lambda applications are run to extract metadata from a photo and write it to DynamoDB (based off of an S3 event), calculate trending data and write to DynamoDB (based off of a Dynamo event from the data inserted in the first step), and finally notify the end user of trending data based on their photo (based off of the second Dynamo insert).

AWS Lambda Workflow

Lambda also decouples your application from the compute resources required to run it. AWS handles all of this, so you no longer have to worry about managing the infrastructure, monitoring, and logging programatically - it’s all done for you.

AWS offers unique pricing for Lambda functionality based on the number of requests run paired with execution time for a given block of memory.

  • $0.20 per million requests
  • $0.00000021 per 100 milliseconds at 128MB

If you are interested in getting started with Lambda, you can sign up for the Preview here. AWS is gracious enough to offer 3.2 million seconds of execution and 1 million requests as part of the Free Tier. What are you waiting for? It’s time to experience a new way to build applications.

Creative Commons License

What do you think?