Skip to main content

Command Palette

Search for a command to run...

Ever Wondered How you can Create Your Own AWS Lambda Service!

Step-by-step guide to creating a service like AWS Lambda using OpenFaaS.

Updated
3 min read
Ever Wondered How you can Create Your Own AWS Lambda Service!
J
Passionate and results-driven Senior Software Engineer with over 7 years of experience building scalable backend systems, designing cloud-native architectures, and automating deployments. Specialized in Python, AWS cloud services, k8s, Docker, Golang, GitHub Actions with a strong focus on performance, security, and reliability.

Have you ever wondered how services like AWS Lambda work—and if you could build one yourself? Imagine creating your own platform that lets you run code on-demand, scales automatically, and supports multiple programming languages. Sounds exciting, right?

Serverless functions, such as AWS Lambda, Azure Functions, and Google Cloud Functions, have revolutionized the way we build applications. They handle infrastructure for you, scale effortlessly, and let you focus purely on your code. But there’s a catch: vendor lock-in. Once you commit to a particular provider, moving to another can be tricky, and that’s where the promise of serverless sometimes falls short.

Reasons You Might Not Want to Use AWS Lambda—But Still Want All Its Features

Maybe you want to use a public cloud, but don’t want to rely on AWS Lambda. Instead, you’d like to run your own serverless functions on a Kubernetes cluster like EKS or GKE using OpenFaaS.

Or maybe you’re concerned about security and privacy and don’t want to use public cloud providers at all. In that case, running everything on your own on-premises private cloud makes more sense.

Or perhaps you already have your own lab, hardware, or racks, and you want to make the most of it. Why not save some cost while creating something that works just like AWS Lambda—smooth and reliable?

Or maybe you’re just curious. You want to know how services like AWS Lambda, Azure Functions, or Google Cloud Functions actually work—and how you could build one yourself.

Whatever your reason—learning, experimenting, saving money, or focusing on security—you’re in the right place! this guide is here to help.

In this guide, we’ll use OpenFaaS, a CNCF-graduated project that lets you scale your functions, release faster, and run them efficiently—just like the big cloud providers.

OpenFaaS is an open-source serverless platform that enables developers to build and deploy functions as Docker containers on platforms like Kubernetes. It is designed to make it easier to turn any code into a serverless function that can be run anywhere, including on-premises or in the cloud. Key features include auto-scaling, a command-line interface (CLI), a web UI, and support for a wide range of programming languages(from official documentation)

Enough discussion—time to dive in and see it in action!

Prerequisites

  1. kubectl configured for that cluster

  2. helm installed (version 3+)

  3. Install faas-cli (OpenFaaS CLI):

curl -sSL https://cli.openfaas.com | sudo sh

to Verify:

faas-cli version

Add the OpenFaaS Helm repo

Add the official helm repo:

helm repo add openfaas https://openfaas.github.io/faas-netes/
helm repo update

Create a namespace

Create the openfaas and openfaas-fn namespaces:

kubectl create namespace openfaas
kubectl create namespace openfaas-fn

Install OpenFaaS via Helm

Install using Helm with a basic configuration:

helm upgrade openfaas \
  --install openfaas/openfaas \
  --namespace openfaas \
  --set basic_auth=true \
  --set functionNamespace=openfaas-fn

Get your admin password

kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo

Port-forward the Gateway

Expose the OpenFaaS UI and API locally:

kubectl port-forward svc/gateway -n openfaas 8080:8080

Now open your browser:
http://127.0.0.1:8080

Login using: admin and password(you got it from previous step)

Result

Screenshot of the OpenFaaS web interface. The sidebar has options for deploying new functions, with "nodeinfo" listed. A blue button labeled "DEPLOY NEW FUNCTION" is present. Instructions for using "faas-cli" to deploy functions via a command line are displayed.

Voilà! You made it!

A big thank you to Alex Ellis for creating this project and making it all possible!

And there you go — you’ve built your very own Lambda that you can actually use!

If you enjoyed this article, don’t forget to hit the like ❤ button!

Catch you later! ✨ Keep coding, keep decoding, and most importantly, keep having fun! ❤
– Jamil