00:00 - Beginning of video
Hi, my name is Miguel Alvarado. I am a DevOps engineer. I've been at nClouds for almost a year now. I am going to present to you today serverless applications testing with serverless framework.
00:28 - What is Serverless Framework?
What is serverless framework? Well, serverless framework consists of an open source CLI, it has the dashboard. That means it's a CLI that you can download and install on your local machine. You can create a local dashboard with simple commands. It also provides full Serverless Application Lifecycle Management. This means that when you want to deploy a serverless application, you can do it with serverless framework. You can do it from from scratch from the start until the end of the process that means that you can deploy your applications. Also, you can terminate those applications too. You can develop, deploy, troubleshoot, and secure serverless applications with less overhead and costs. This is thanks to the way the serverless framework works because we defined a configuration file where we centralize the configurations and we manage easier deployments than doing it with other tools. Also serverless framework is a multiple cloud provider. This means that we can use this framework either with AWS, GCP and Azure, too.
02:07 - Demo
Now that we have a better understanding, and an introduction of what is a serverless framework. Let's get to the demo. I'm going to start with the serverless official website. It's this one you can appreciate here. Well serverless has a bunch of functions as I was telling you, but the one we are going to see today is the Troubleshoot feature. That is a feature that helps us to test our serverless application before we go live, or even before we deploy to a cloud environment. To do that, we're going to go to the documentation. Alright, we're getting started. Here, we see the first steps, right? We see that we can install serverless by using NPM. Also, you can download the repository and install it with a Bash script. Although, I would say that this is the easiest way to do it.
03:26 - Creating & Testing Lambda Functions
07:01 - Testing the Serverless Application
09:18 - Sending Parameters to Lambda
But what if we would like to send parameters to our Lambda, right? How we should be able to send information to our Lambdas. If you're familiar with AWS Lambda, we should use the event prop. We should use event.URL. And that should be enough. But now how are we supposed to send it in our testing command? What we can do is specify the path where we have our event file. Usually, that event file is specified in a JSON format. I'm just going to create a JSON file here, just a simple JSON with a URL property. I am using another API that basically genderized the names. It says, what is the probability that a person is a woman or a man by knowing only the name. We have to specify the event file, and we go with event.JSON. And while that should be enough, here, you can see that the response of the request changed. We are sending the name Andrea. And the gender should be male with a probability of 62% or some other information that the API responds.
11:03 - Serverless Application with Python
You can also email us directly at email@example.com for your inquiries or use the form below