AWS service of the week – Lambda
Hello! Here we go with another blog in the AWS services series, and in this instalment, I’m going to go through some of the key features of the Lambda service, which is the serverless offering from AWS.
Let’s start off with the big misconception about serverless…
That there are no servers, which really is a yes and no answer. As a user of the Lambda service, you do not need to care about any infrastructure, OS, middleware etc, all that you care about is your function which is made up of programming code and the output it delivers from its execution.
Now of course this function will have to be executed on a server somewhere, but you do not need to be aware of it, maintain it, or know of its existence. Essentially the role of the server is abstracted away from your field of view, so you can focus on delivering functions that provide tangible value to your customers.
What can I do with Lambda?
As mentioned above you write a function with code and get the output, so really the possibilities are infinite, it’s the role of your developers to write some fantastic functions!
A classic use case I have worked with is around event based triggered functions. In this example every time an object was uploaded to a chosen S3 bucket, a function would be triggered in Lambda that would read the object, transform its data, and then store it in another S3 bucket to be processed later.
You could even build an entire application using this service, and Lambda is architected to scale infinitely, functions can be run in parallel, and deliver significant quantity of results in a short space of time.
What Programming languages can I use?
Lambda supports a variety of languages including: Java, Go, PowerShell, Node.js, C#, Python, and Ruby code.
When we look at the most popular languages, this makes up most of the market, so you should have confidence that your development team can use this service. However if you have an alternative language that you want to use, Lambda has recently released additional functionality to support them using custom runtimes.
How much does it cost?
The serverless cost model makes this a very affordable option. You would pay a minuscule charge of $0.0000002 (EU-West Ireland Region chosen) to request the function to run, plus a charge for how long the code is running for rounded to the nearest tenth of a second at $0.000000208.
Please note this can increase with changes to configuration, such as your function requiring additional memory, or storage of the code in an S3 bucket. However, you can see that for a business the charges are so low, it becomes a brilliant service to take advantage of compared to a more traditional VM based approach
I’m a developer, what about the coding things I care about?
You can develop your code on your local machine, using your development environment, and AWS have kindly provided information on a number of toolkits available, which you can download and test your functions against before deploying.
You can inject environment variables into the code, for whatever purpose you need them to do, and version the functions that are created. Lambda provide a concept called Step functions, which enables you to chain multiple functions together into a seamless flow of execution.
Writing a Serverless Application seems too complex
Historically I would have agreed with this statement, due to the infancy of the serverless architectural approach, and businesses/developer’s exposure to this new way of architecting to deliver value.
AWS have listened to this feedback and recently launched the AWS Serverless Application Model which provides an open-source framework to create serverless applications. As you build functions, API’s, integrations with databases, and event triggers, you can logically group them together with set parameters such as memory, timeouts etc and deploy it as one encapsulated YAML configuration file.
AWS will take this Serverless Application configuration, convert to CloudFormation and then create the resources that you have specified. This really simplifies the entire process of creating and updating your serverless applications.
So I hope you can see the real business value that serverless with Lambda can provide. The level of abstraction offered means that you can keep the focus on developing great functions to delight customers, and you do not need to waste any time, money, or effort with maintenance of servers. The running costs are incredibly low, and the scalability provided make this service something all businesses really need to explore.