DEV Community

Cover image for Challenge 1: Create a simple app in Lambda + DynamoDB + Serverless Framework
Raphael Jambalos
Raphael Jambalos

Posted on • Updated on

Challenge 1: Create a simple app in Lambda + DynamoDB + Serverless Framework

This article was also presented as a talk last July 17, 2021 for

About the challenge

A few of my developer friends and colleagues at work asked me how they can learn more about AWS. I told them that the best way to learn is:

  • To do hands-on experience
  • Learn something that has close parallels to what you're doing
  • Solve a well-defined problem that you have to research the answer for instead of handing it to you.

Hence, the serverless challenge was born. The challenge is best suited for people who have some experience in development but have not necessarily touched up on the latest trend of serverless computing.


You are the dev lead (aka 'the only dev') of a chain of restaurants. To increase sales, your boss wants you to create a simple loyalty application. He has heard of the Serverless Framework and how it allows your team to use serverless technologies like Lambda to deploy your application. Your boss is particularly sensitive to cost. Since Lambda only charges you when the code is run (when someone uses your app), your boss is thrilled to introduce the technology.


Create 3 Lambda functions for each endpoint:

  • POST /loyalty-cards: create a loyalty card
  • GET /loyalty-cards/10: display the loyalty card you just created using the id
  • GET /loyalty-cards: display all loyalty cards

Alt Text

You must follow the guidelines below:

  • The Lambda function must be deployed using the Serverless Framework (SF). SF is a tool that makes deploying Lambda functions easier. You no longer have to package dependencies and upload code to Lambda manually. All you need to do is run "serverless deploy".
  • Your data must persist, and your database must be DynamoDB. DynamoDB is a NoSQL database service by AWS. Unlike traditional relational databases, DynamoDB does not maintain a schema. Except for the primary key attributes (which have to be unique for each record), you can add different attributes for different items in the table.


The resources here will certainly help you get started with this challenge. But it won't be the only ones you'll use. You will have to research some answers.

Set up your AWS CLI

Serverless in AWS

Useful Hints

  1. Use serverless to initialize a project
  2. Use serverless deploy to deploy your project. A link to API Gateway will be displayed after deployment. Use that link to test in Postman
  3. At this point, the only way to test your code is to keep deploying using serverless deploy and using APIGW to test.
  4. To debug, leave print messages in your code and find the log group for the lambda function. It is under cloudwatch > logs > log groups (
  5. If you are wondering why we have to test by deploying your function every time and test via APIGW and if there's a better way, you are right. The better way is to use serverless offline and serverless invoke. You can find them at the third challenge
  6. If you really are a bit lost, you can see the Github repository of the code I did as I made this article.

Show off your work!

Comment a screencap of your work below. Or better yet, create a blog post here in explaining how you did it.

If you have any questions or are stuck somewhere, comment below or send me a pm, and I'd be happy to help you.

Photo by Avi Richards on Unsplash

Top comments (0)