“No server is easier to manage than no server.” — Werner Vogels, Amazon CTO
A contradiction? The concept might be causing you come confusion – “IT Infrastructure without servers”?
As is so often the case the answer is “not exactly”!
The term “serverless” in this context doesn’t strictly mean without servers. It means you no longer have to think about them like you once did.
Traditionally the code that makes up applications would be run on physical servers. Until recently a Cloud based architecture would mirror this making use of virtualised servers in place of the physical ones. Several Cloud providers have now started providing services which allow you to upload your code into the Cloud where it can be executed based on events or schedules you specify without having to provision any servers at all. Instead the Cloud provider creates the execution environment for the code as needed.
This means that you no longer have to worry about scaling, capacity and updates. Deploying code also becomes simpler since you there is no need to create virtual machine images anymore. Perhaps best of all though is the fact that you don’t need to have servers running all the time costing you money. You are only charged while the code is executing and many tasks can complete in seconds, or even milliseconds. This means that moving from a traditional server based architecture to a serverless architecture has the potential to generate huge savings.
It is probably fair to say that the front-runner in providing serverless tools is Amazon Web Services (AWS) <https://aws.amazon.com/>. The main service that AWS provide for facilitating serverless architectures is AWS Lambda <https://aws.amazon.com/lambda/>.
As described above this allows code to be uploaded into your AWS account. The code can then be executed in response to events generated from other AWS services. For example, you could configure code to run in response to image files being uploaded to an S3 <https://aws.amazon.com/s3/> bucket. This code could produce a watermarked version of the image and put it in another bucket for use by another piece of code. This processing can all be done without any AWS EC2 <https://aws.amazon.com/ec2/> instances being created at all. AWS Lambda code can also be run based upon a specified schedule allowing you to create overnight batch processing jobs for instance.
To make AWS Lambda even more useful however it can also tie in with the AWS API Gateway <https://aws.amazon.com/api-gateway/> service. In essence this allows Lambda code to respond to HTTP web requests. This means that it is possible to code serverless web based RESTful APIs. In addition, by using S3 to serve static content, entirely serverless web applications and sites can be created.
As an example we recently created an internal monitoring tool where we architected out the use of AWS EC2 instances. Here we used a range of AWS services in combination with other IT Technologies:
- AWS API Gateway <https://aws.amazon.com/api-gateway/>: Using the API Gateway service we were able to create routes to Lambda functions. The Lambda functions are then invoked in response to normal GET and POST requests. In effect the API Gateway routes act like a trigger to run the Lambda functions.
- AWS Lambda <https://aws.amazon.com/lambda/>: This is the core AWS service for deploying applications using a serverless architecture. We wrote the core components of the application using python and deployed these python components to AWS as Lambda functions.
- AWS DynamoDB <https://aws.amazon.com/dynamodb/>: This managed NoSQL database service is not required for a serverless deployment however we made use of it as it integrates very smoothly with other AWS services. DynamoDB has great flexibility and near infinite scalability.
- AWS CloudWatch <https://aws.amazon.com/cloudwatch/>: To monitor the deployed AWS resources which made up the application.
Serverless architecture has to be one of the most exciting and innovative concepts to grow out of Cloud computing and has real potential to reduce the complexity, management overheads and cost of running applications.
It also undoubtedly gets you lots of kudos if you can say that your web application is running without using any servers at all!
Cloud is about how you do computing, not where you do computing.