Introduction
If you’ve ever wanted to host a web app without worrying about servers, AWS Lambda makes it possible. With AWS Lambda and API Gateway, you can create serverless web applications that scale automatically and are fully covered by the AWS Free Tier.
In this post, you’ll learn step-by-step how to create a simple “Hello World” web app using AWS Lambda and API Gateway.
What Is AWS Lambda?
AWS Lambda is a serverless compute service that lets you run code without managing servers. You simply upload your code, and AWS takes care of everything else — provisioning, scaling, and high availability.
Lambda only charges you for the compute time you use, and with the Free Tier, you get:
-
1 million free requests per month
-
400,000 GB-seconds of compute time per month
That’s more than enough to experiment and deploy small web apps for free.
Step 1: Create a New Lambda Function
-
Sign in to the AWS Management Console.
-
Navigate to Lambda → click Create function.
-
Choose Author from scratch.
-
Enter a name like
helloWorldLambda. -
Select Python 3.12 (or Node.js if you prefer).
-
Leave the default settings and click Create function.
This sets up the foundation of your serverless web app.
Step 2: Add Your Code
Inside the Code source editor, delete any existing code and replace it with this:
def lambda_handler(event, context):
return {
‘statusCode’: 200,
‘body’: ‘Hello from AWS Lambda!’
}
Click Deploy to save and apply the function.
Step 3: Test Your Lambda Function
-
Click Test in the top menu.
-
Create a new test event (use the default JSON provided).
-
Click Test again — you should see
"Hello from AWS Lambda!"in the output.
This confirms that your Lambda function runs correctly.
Step 4: Connect to API Gateway
Now, let’s make this function accessible through a web URL.
-
Scroll down and click Add trigger.
-
Choose API Gateway.
-
Under API type, select HTTP API.
-
Leave defaults and click Add.
AWS will generate an endpoint URL — copy it.
Step 5: Run the Web App
Open a browser and paste your endpoint URL.
You’ll see the message:
Hello from AWS Lambda!
🎉 Congratulations — you’ve just built and deployed your first serverless web app using AWS Lambda and API Gateway!
Step 6: Clean Up Resources
To avoid clutter, delete your Lambda function and API Gateway when done. This helps keep your AWS account organized and avoids accidental usage.
Full video tutorial: https://www.youtube.com/watch?v=6_S8oQVXZnc
YouTube Channel: https://www.youtube.com/@TechSimplifyNow
Why Use Serverless Architecture?
Serverless architecture offers several benefits:
-
No server management
-
Automatic scaling
-
Pay only for what you use
-
Built-in fault tolerance
It’s ideal for lightweight applications, APIs, automation scripts, and prototypes.
Conclusion
Creating a serverless web app with AWS Lambda is a powerful way to learn cloud development without complex infrastructure. With AWS Free Tier, you can explore and deploy real applications at no cost.
If you found this tutorial helpful, check out more guides on AWS cloud projects, Lambda automation, and serverless architecture to take your cloud skills to the next level.
