Amazon Web Services (AWS) makes heavy use of server virtualization technologies, but recently it introduced something very cool and new: AWS Lambda.
The idea behind virtualization is to run multiple workloads on one physical server you own and maintain, and the idea behind public cloud computing infrastructure like AWS's is that you run workloads on virtual servers running on physical servers that you don't own or maintain.
AWS Lambda takes this a step further. How? Amazon bills Lambda as an event-driven computing service for dynamic applications, and it allows you to run code without physical servers — and also without having to worry about virtual servers or any virtualization technologies.
"Lambda will run code automatically without any compute infrastructure that you have to provision for it," Amazon CTO Werner Vogels explained at AWS re:Invent at Las Vegas. "You can run code without having to manage any infrastructure."
The idea is that you can write little programs called Lambda functions that are triggered every time a change is made to an Amazon S3 bucket, an Amazon DynamoDB table or an Amazon Kinesis stream. An example Vogels suggests is that every time a photo is uploaded to S3, a Lambda function can get to work generating a thumbnail.
"Upload your Node.js code directly to Lambda, set triggers to run the code (which can come from other AWS services like Amazon S3 or Amazon DynamoDB, to name a couple), and that's it: you're ready to go," says Vogels. "You can go from code to service in three clicks and then let AWS Lambda take care of the rest."
Constructing Complex Chains of Functions with AWS Lambda
By design it is possible to construct complex chains of functions that can be put in place to create complete event-driven applications: one function could generate a thumbnail while another could extract metadata from the photo and store it in a DynamoDB table.
This table update could trigger another function that analyzes the metadata to establish what type of photo is trending — perhaps based on location. And this could trigger sending an SMS alert to the owner of the photograph informing them that the location of their photo is a trending item.
Anyway, the point of all this is that the code itself is triggered within milliseconds of an update event, and the Lambda service then manages the compute capacity for you, spinning up the necessary infrastructure, deploying your code and running it for each event.
Each event is processed individually, so thousands of functions can run in parallel and performance remains consistently high regardless of the frequency of events, the company says.
With normal cloud applications you pay for the resources you use, and in practice that means the virtual machines that you use. But with Lambda, Amazon promises that you only pay for your code to be executed, charged per request, and for the time that it takes your code to run.
A Closer Look at Lambda's Costs
So what are the costs for Lambda? AWS intends to charge 20 cents per million requests, and 0.00000021 cents for 100ms of compute time using up to 128MB of memory. Not much, in other words.
There is also a base free tier with up to 3.2 million seconds of execution and up to a million requests per month at no cost, Vogels revealed, although it is not clear how long this free tier will be available.
So there you have it. For some applications you'll be able to forget about virtual machines running in the public cloud, and just perch your code on the edge of S3 data buckets and the like.
When new data comes in, the code will instantly — or nearly instantly — be provided with compute resources, execute, and then go back to sleep till the next time its needed. A very neat idea indeed.
AWS Lamda is available to preview to AWS account holders at: http://aws.amazon.com/lambda/preview/.
Paul Rubens is a technology journalist and contributor to ServerWatch, EnterpriseNetworkingPlanet and EnterpriseMobileToday. He has also covered technology for international newspapers and magazines including The Economist and The Financial Times since 1991.