If you are like me then you are always working in environments where everything wants to increase speed & efficiency while lowering cost. Serverless compute functions or functions as a service unlock this ability for end users like developers. No longer do developers have to manage servers but they just manage code.
If you would like assistance in the below or have general questions about Cloud solutions, VMware, and more, feel free to visit the following URL and I will be able to work directly with you:
Benefits of functions:
- No servers to manage
- Built for short run times
- Can be run on-demand
- Scaling is automatic
The walkthrough – why use serverless computing & Lambda
In the example, we have a function that logs something and returned hello from lambda. Simple code and we can click run and just run it from Lambda.
The function ran and we got the return message
As you can see many different event sources can send events to Lambda and cause Lambda will respond.
From the earlier example you can see I haven’t been billed until I hit my 1 millionth request.
Cost grows linearly based on usage and load
Let’s create the first function
If I had my own custom code to deploy I would run through author from scratch. However, to keep things simple for this how to I will use a blueprint instead.
I searched by hello to find an easy python blueprint for hello world
Then click configure in the bottom right hand
Provide your function a name
Lambda needs to have an IAM role to interact with other AWS service offerings. I am just selecting create a new role and it will be named
The default python language here is basically saying the handler will print three values and return a value
As you can see my function was created and I have the ability to test the function.
Provide an event name and click create
Now that my test event has been created I now can test
Expand details for more information
What if we want to make changes?
Make sure your function is selected in Designer
Our original code
Made a change to now return an exception that something went wrong – need to click deploy to save
Changes saved – now let’s run the test again
As expected we got an error that something went wrong
Now you can scroll down and changed many different settings and get as granular as you need based on your thought out design.
I kept the Lambda examples simple for a reason. This was intended as a quick walkthrough but it also displays how powerful Lambda functions and serverless computing can be. As always, I hope y’all found this useful.