🧱 What I Built
I created a simple Lambda function that returns a message like:
Hello, Andre! Your serverless function is working.
The function runs instantly when someone hits the API URL. No servers. No maintenance. Just code.
🪜 Step-by-Step: Building the Serverless Function
- Open AWS Lambda
- Log in to AWS
- Search for Lambda
- Click Create function
- Create the Function
- Choose Author from scratch
- Name: myServerlessFunction
- Runtime: Node.js 20.x
- Leave everything else as default
- Click Create function
- Add the Code Replace the default code with this:
export const handler = async (event) => {
const name = event.queryStringParameters?.name || "World";
return {
statusCode: 200,
body: JSON.stringify({
message: Hello, ${name}! Your serverless function is working.,
}),
};
};
Click Deploy.
- Add an API Gateway Trigger This makes your function accessible through a URL.
- Scroll to Function overview
- Click Add trigger
- Choose API Gateway
- Select Create a new API
- API type: HTTP API
- Security: Open
- Click Add AWS will generate a public endpoint URL.
- Test the Function Open the URL in your browser:
Got my result at below link
https://yz179ik8xe.execute-api.us-east-2.amazonaws.com/default/myServerlessFunction
🧠What I Learned
Building this project helped me understand:
- How AWS Lambda works
- How serverless functions scale automatically
- How API Gateway exposes functions through HTTP endpoints
- How to pass query parameters into a Lambda function
- How to deploy backend logic without provisioning servers This is a great beginner project because it teaches the fundamentals of serverless architecture without overwhelming complexity.
Top comments (0)