Emily Shea

emshea

My blog on learning AWS cloud technology & building serverless apps 🌻


Getting started with AWS serverless

AWS Nov 06 2023

If you're looking to get started building serverless applications on AWS, this resource guide is for you!

This guide includes courses and common serverless patterns with hands-on tutorials, templates, and example projects of my own. This combination will help you progressively grow your skills and comfort level with serverless. This 2023 version has been updated with plenty of new resources that will help you build your own serverless applications in no time.

The only prerequisites are beginning coding experience (I took Python and Javascript intro courses on Codecademy, you can read more in this post) and an AWS account.

Jump to:

Courses

  1. Cloud Essentials Learning Plan
  2. Serverless Learning Plan

Building

  1. Set up a static website with Amplify
  2. Interact with an external API from your static website
  3. Get started with a deployment framework
  4. Build a Lambda function that's invoked by API Gateway
  5. Build a Lambda function that's invoked by EventBridge Scheduler
  6. Build a Lambda function that processes and saves files in S3
  7. Build a Lambda function that writes to DynamoDB
  8. Build a multi-step workflow with Step Functions

Courses

I'm a big fan of hands-on learning through building your own projects, but beginning with a learning course can be helpful to understand the core concepts and how it all fits together. These two are both available for free on AWS Skill Builder.

Cloud Essentials Learning Plan

If you're new to cloud, the Cloud Essentials Learning Plan is a great course to start with. This course gives you a foundational understanding of cloud concepts.

Serverless Learning Plan

If you're familiar with cloud but new to building with serverless, the Serverless Learning Plan will take you through the core serverless services.


Building

I found that I learned best by starting small and steadily adding in more services, increasing the complexity of my applications over time. The guide below starts with simple static websites. It then introduces some of the most common patterns in serverless applications. By the end, you'll be able to build an application that uses Amplify, Lambda, API Gateway, EventBridge, Step Functions, S3, and DynamoDB.

To stay motivated while I'm learning, I like to use tutorials as references while building projects of my own. For each tutorial, I've included one of my projects that uses the same concepts in the tutorial to provide you with ideas.

1. Set up a static website with Amplify

Amplify

A good place to start is hosting a static website with Amplify. You can do so by uploading a HTML file with just few lines of code, like this:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>My Website Home Page</title>
</head>
<body>
  <h1>Welcome to my website</h1>
  <p>Now hosted with Amplify!</p>
</body>
</html>

You can drag and drop a file into Amplify:

Or, you can connect Amplify to a version control system, like a GitHub repository:

Amplify also gives you an easy way to add a custom domain name for your static website:

2. Interact with an external API from your static website

This tutorial covers the basics of working with an external API. To get started working with APIs, I found it useful to first practice calling an existing API before building my own API. You can add the JavaScript files to your existing static website hosted with Amplify.

3. Get started with a deployment framework

Next up is starting to build the backend application, and a serverless deployment framework will come in handy.

The AWS Console is a great place to explore new services, but as you start building and your application grows with more resources, it can become easy to forget what code or configuration changes you've made. A serverless deployment framework lets you define and deploy all of the resources in your application as infrastructure as code. By defining your application with a framework, you know exactly what you're deploying each time. You can also save and review your application definition in a version control system like GitHub. This makes building complex applications much easier to manage.

I use the Serverless Application Model (SAM). SAM also has a SAM CLI tool to deploy your application that the next tutorial uses. There are a few other framework options like Serverless Framework and Terraform.

SAM

Here is an example of defining a Lambda function with SAM:

You can write your application definition with SAM manually, or you can use the Application Composer visual designer tool to drag-and-drop resources into your application. Application Composer will then export a SAM template for you.

App Composer

For the rest of the guide, I've included SAM templates of my own or from the Serverless Land Patterns collection as examples.

4. Build a Lambda function that's invoked by API Gateway

Here you'll build your first Lambda function and invoke it through API Gateway. Your Lambda function will be invoked every time you call your API endpoint.

API Gateway to Lambda diagram

5. Build a Lambda function that's invoked by EventBridge Scheduler

Another way to trigger a Lambda function is to create an EventBridge scheduled event that will invoke your function on a schedule (ex, once a week, once a minute).

EventBridge Lambda diagram

6. Build a Lambda function that processes and saves files in S3

You can use Simple Storage Service (S3) to store objects like text, image, and audio files. When an object is uploaded or changed in S3, S3 emits an event that can invoke a Lambda function. Lambda functions can also interact with S3 files. You can learn more about this pattern in this video.

S3 Lambda diagram

7. Build a Lambda function that writes to DynamoDB

DynamoDB is a database that's optimized for use with serverless applications. You can use it to store data, like frequently changing data about your application's users. This DynamoDB core components guide is a great read to start with.

Lambda DynamoDB diagram

8. Build a multi-step workflow with Step Functions

With Step Functions, you can build workflows with AWS services. A workflow can include components like branching logic, looping over an array, or waiting for a human approval step. Step Functions also has a visual builder tool, Workflow Studio, that you can use to design workflows and export infrastructure-as-code. Step Functions workflows are defined in Amazon States Language which you can deploy as part of your SAM template (tutorial).

Workflow studio gif


Starting with these components - Amplify, Lambda, API Gateway, EventBridge, S3, DynamoDB, and Step Functions - and a few common patterns, there are endless possibilities of applications that you can build.

Happy building!

🐿️

← Back Home


Never miss a new blog post! Subscribe here to get posts delivered directly to your inbox.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.