AWS Lambda Tutorial – Create a Serverless Function
Please use the menu below to navigate the article sections:

Are you new to cloud computing and looking for a hands-on experience using Lambda? If so, you’re in the right place!
In this beginner AWS Lambda Tutorial, you’ll be creating your first Lambda function.
Lambda is the AWS serverless method of running code as a function (also known as FaaS) and you’ll be using it to run a “Hello from Lambda” response.
Everything in this tutorial is included in AWS free tier, so you won’t have to worry about getting charged if you follow along.
But first, what exactly does serverless mean?
Serverless
The word “serverless” is thrown around quite a bit. You may have seen it mentioned while reading articles or AWS documentation, and you’ll definitely see it in your exam and real life.
It’s important to understand what serverless is and what it isn’t. So to our first question, we’ll answer… is AWS Lambda really serverless?
The simple answer is: no, Lambda is not really serverless. There are definitely servers behind AWS Lambda. So why call it “serverless”?
Lambda is called serverless because there isn’t any management of the servers that we, as users, have to handle for it to work.
Lambda is essentially Amazon’s way of saying, “you give us the code and we’ll take care of the rest.”
A Typical AWS Lambda Use Case
Let’s say Sarah is at a startup where her team leader has put her in charge of a particular set of code that needs to be run occasionally.
The company just started so she’s on a tight budget and has other demanding responsibilities. She doesn’t want to go through the process of provisioning an EC2 instance, configure its environment, and then pay for all the time it’s not being used.
This would be a perfect use case for Lambda. Sarah could use Lambda in this case because with Lambda, you only pay for the time the function is running.
Lambda is a cost-effective way of computing in the cloud that will save you the hassle of managing servers. So, let’s get started with our hands-on tutorial.
Requirements
- AWS ACCOUNT SETUP – All you’ll need for this tutorial is an AWS Account. To create an account, simply follow the instructions in Neal’s video tutorial on How to create an AWS Free Tier Account.
AWS Lambda Tutorial – Let’s Get Started!
After logging in to the AWS Management Console, we’ll start by clicking on Services, and then Lambda.

You’ll then see a page that looks something like this. It’ll be blank if you don’t currently have any functions created. Go ahead and click on “Create Function”.

Here you’ll want to name your function. Go ahead and leave all other settings as the default.
Before we move on, let me explain what the default execution role allows. This will essentially allow the Lambda function to connect to Amazon CloudWatch. CloudWatch will then be able to create logs as the Lambda function is used.
Great, now click on “Create Function.”

Upon creating your function you should see a similar page. Let’s test our function by moving over to the “Test” tab.

First, enter a name for your test and then click on “Save Changes”.

After your test event saves successfully, click on “Test”.

You should get back a result saying that your test succeeded. Here you’ll also notice some details about your function such as how long it ran and the max memory used to run the function.
These are the measurements that AWS would use to charge you if your usage exceeded the free tier limit of “1M free requests per month and 400,000 GB-seconds of compute time per month” (https://aws.amazon.com/lambda/pricing/).

Go ahead and click on “logs” to see how your function details as recorded in CloudWatch.

Select your log stream.

You’ll then see different timestamps for events that have been recorded by CloudWatch for your function. Click on the arrow as seen below.

Here are the details of your Lambda function execution events! You’ll see information similar to what we saw on the Lambda page including execution time, memory used, and related ID numbers.

Let’s navigate back to your Lambda function and click on “Monitor”. To see CloudWatch metrics from Lambda.

Here you will be able to see the CloudWatch metrics as promised. One test runtime will show up as a single dot.

Congratulations! You’ve successfully completed your first AWS Lambda Tutorial.
You’ve created your first AWS Lambda function, tested it, and monitored the results in Amazon CloudWatch.
This is a great start for gaining an understanding of serverless technology and Functions as a Service (FaaS) on AWS.
If you want to learn more please check out some of our other articles:
- Cloud Computing Basics – Compute
- Cloud Computing Service Models – IaaS, PaaS, SaaS
- Cloud Computing Basics – Serverless
Become an AWS expert with our value-packed training
AWS Training – Our popular AWS training will maximize your chances of passing your AWS certification the first time.
Membership – For unlimited access to our cloud training catalog, enroll in our monthly or annual membership program.
Challenge Labs – Build hands-on cloud skills in a secure sandbox environment. Learn, build, test and fail forward without risking unexpected cloud bills.