3 Simple Serverless Beginner Project Ideas
Tags: aws, serverless, devops, cloud
Published: 2020-03-23 06:30:25

---
title: 3 Simple Serverless Beginner Project Ideas
published: true
date: 2020-03-23 06:22:09 UTC
tags: AWS, Serverless, DevOps, Cloud
canonical_url: https://www.thedevcoach.co.uk/serverless-beginner-project/
---

Are you looking to learn Serverless but need a little help in where to start? One of the best ways to get your head around a new technology is to dive in and build some example projects. But what are some nice and simple serverless beginner projects?

![Dayum Llama](https://i0.wp.com/www.thedevcoach.co.uk/wp-content/uploads/2020/03/dayumllama.png?fit=760%2C463&ssl=1)

In today’s article we’ll go through three different simple examples of serverless functions you can build using AWS Lambda for your first trial with serverless.

**By the end of this article you should have an overview of three serverless beginner projects, the steps you’d need to create them, and some ways that you can later extend them to learn more.**

Before we jump in I should note that this article will be specific to AWS and AWS Lambda. The ideas can be taken across to other cloud providers but I’ll focus mainly on AWS specific terminology for simplicities sake.

For each project i’ll give you the ideas, steps and a little inspiration, but the goal is not to give an in-depth tutorial of Serverless (that’d take a lot more than one article). But don’t fear, at the end of the article i’ll reference some resources and how-to’s so that you can turn the ideas into reality.

### Project 1: Build An Operations Function

The first project for you to learn serverless is for internal operations work. Now I know what you might be thinking: “Wait what? Operations? Surely an API or Microservice is the best project to start with?” So let me explain why operations makes a lot of sense as a starting place for serverless…

Serverless is used heavily for operations to provide services within AWS that either don’t exist as current AWS features, or are quite specific for your use case. For instance you can use a lambda function to schedule shutting down old or stopped EC2 instances or for cleaning up AWS untagged resources according to your companies guidelines.

That said, regardless of the popularity of serverless in operations the main reason operations is a good place to start as a beginner is: you don’t need to string together lots of AWS services. Because on the flip-side, public-facing services such as API’s need to [configure something like an ALB](https://www.thedevcoach.co.uk/setup-aws-lambda-aws-alb/) to be exposed publically necessarily.

But of course you might be reading this and thinking “but I don’t work in a company that needs operations functions”. So it might be hard for you to imagine what operations functions might look like, let alone build one.

So let’s go through the details of an operations function you could build as your first lambda function…

 ![EC2 Ops Lambda Diagram](https://i2.wp.com/www.thedevcoach.co.uk/wp-content/uploads/2020/03/Lambda-CloudWatch-EC2-1.png?resize=760%2C428&ssl=1)

EC2 Ops Lambda Diagram

**Project Description: ** Build an AWS Lambda function that uses the [built-in AWS-SDK](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html), which comes pre-installed on all AWS Lambda’s, to [list all your EC2 instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html), view the [tags of the EC2 instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) and terminate any resources that don’t meet your companies tagging standards (real or imagined).

**Steps: **

- Setup a generic Lambda function
- [Access the native SDK within AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)
- [List all EC2 instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html)
- [Terminate EC2 instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/terminate-instances.html) that don’t meet your criteria
- [Set the Lambda to run on a schedule](https://www.thedevcoach.co.uk/terraform-lambda-scheduled-event/)

**Extensions:**

- [Add CloudWatch Logs.](https://www.thedevcoach.co.uk/lambda-logging-cloudwatch/)
- [Add CloudWatch Alarms.](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html)
- Add [SNS integration](https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html) to send email on termination.

When it comes to setting up your CloudWatch using schedule events, check out: [How To Setup AWS Lambda Scheduled Events with Terraform](https://www.thedevcoach.co.uk/terraform-lambda-scheduled-event/) for more details.

### Project 2: An HTML Website

Okay, so maybe operations Lambda functions don’t get you excited, I get that. So let’s take a look at an example that’s slightly more complicated but more “real-world” useful… and that’s a serverless function that returns raw HTML.

Or in simple terms: a website.

Lambda’s aren’t often first to mind when it comes to building HTML websites. The reason is probably because there are better options for websites like [using a straight-forward S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/static-website-hosting.html). That said, we’re in the business of serverless beginner projects, not building the most low-latency, cost-effective, uber-scale website.

But as I alluded to when we discussed operation functions, the reason I didn’t suggest a public function, like an API, as the first project is because it requires some other AWS components. Why? Because Lambda functions on their own don’t have public endpoints that you can access. Which means that if we want our website to be viewable we have a couple of options…

- **Attach an API gateway** — The API Gateway is usually the [go-to solution for exposes a Lambda function publically](https://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-with-lambda-integration.html) due to it’s heavy amount of features set.
- **Attach an ALB** — My preferred way to expose Lambda’s publically is [using an ALB](https://www.thedevcoach.co.uk/setup-aws-lambda-aws-alb/), which has slightly fewer features but I prefer the simplicity.
- **Some other hack…** — There are other ways to trigger lambda publically, such as through the AWS SDK but [invoking lambda via the CLI so requires credentials](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html) that we can’t store publically (which is not going to work in our scenario).

But apart from attaching our public-facing component like an ALB or API Gateway, what are the steps we’ll need to take?

 ![Lambda S3 Website](https://i1.wp.com/www.thedevcoach.co.uk/wp-content/uploads/2020/03/Lambda-S3-Website.png?resize=760%2C428&ssl=1)

Lambda S3 Website

**Project Description:** Build a Lambda that returns HTML to be used as a static site, such as a personal portfolio or for hosting documentation.

**Steps:**

- Setup a generic Lambda function.
- [Setup an ALB that invokes the Lambda](https://www.thedevcoach.co.uk/setup-aws-lambda-aws-alb/)
- [Respond with HTML from the Lambda.](https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html)
- [Attach a Route53 domain name to your ALB.](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer.html)

**Extensions:**

- [Stream files from a source such as S3.](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/requests-using-stream-objects.html)
- [Add authentication in your ALB.](https://aws.amazon.com/blogs/aws/built-in-authentication-in-alb/)
- [Add CloudWatch Logs.](https://www.thedevcoach.co.uk/lambda-logging-cloudwatch/)

### Project 3: A JSON API

 ![Lambda DynamoDB](https://i1.wp.com/www.thedevcoach.co.uk/wp-content/uploads/2020/03/Lambda-API.png?resize=760%2C428&ssl=1)

Lambda DynamoDB

And our final project example for today is using AWS Lambda to build a web API. Building an API project is similar to a static website that we discussed in the last project. The only real difference is that the Lambda will respond with a machine-readable format like JSON, rather than HTML.

One way that you can extend your API example would be to also use a database like DynamoDB. But that’s up to you whether you have the capacity to take on that complexity. I recommend DynamoDB because it’s popular with Lambda mainly due to it’s ability to scale incredibly well.

**Project Description: **

Setup a Lambda to return a JSON payload as a web API. To do this you’ll need to setup a Lambda and also attach an ALB load balancer.

**Steps**

- Setup a generic Lambda function.
- [Setup an ALB that invokes the Lambda](https://www.thedevcoach.co.uk/setup-aws-lambda-aws-alb/)
- [Respond with JSON from the Lambda.](https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html)
- [Attach a Route53 domain name to your ALB.](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer.html)

**Ways You Could Extend The Project**

- [Integrate with a database such as DynamoDB](https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html)
- [Add CloudWatch Logs.](https://www.thedevcoach.co.uk/lambda-logging-cloudwatch/)

## Get Building Serverless

That’s all folks!

That concludes our run through of the three different serverless beginner projects that should get you up and running with Serverless on AWS Lambda.

I’m hoping that gave you some ideas and thoughts on where to start on your first serverless project. But before you do go dive into your code editor, here are some more articles that I think might be helpful for you when you embark on your serverless journey.

- [Where (And How) to Start Learning AWS as a Beginner](https://www.thedevcoach.co.uk/start-learning-aws-beginner/)
- [Master the AWS Lambda Console: A Comprehensive Walkthrough.](https://www.thedevcoach.co.uk/understand-aws-lambda-console/)
- [5 Important Reasons To Learn Terraform Before Cloud Computing.](https://www.thedevcoach.co.uk/learn-terraform-before-cloud-computing/)
- [Serverless: An Ultimate Guide](https://www.thedevcoach.co.uk/serverless-ultimate-guide/)

Speak soon Cloud Native friend!

**_What did you (or will you) build as your first serverless project?_**  

---

The post [3 Serverless Beginner Projects Ideas](https://www.thedevcoach.co.uk/serverless-beginner-project/) appeared first on [The Dev Coach](https://www.thedevcoach.co.uk).

Lou is the editor of [The Cloud Native Software Engineering Newsletter](https://newsletter.thedevcoach.co.uk) a Newsletter dedicated to making Cloud Software Engineering more accessible and easy to understand. Every 2 weeks you’ll get a digest of the best content for Cloud Native Software Engineers right in your inbox.