To generate a QR using Spring Boot we will first start with a fresh spring boot application using spring initializr. For this tutorial, we are going to use Spring Tool Suite (STS), but you are free to use other IDE like InteliJ too.

Visit and configure as below. We’ll be adding Spring Web dependency for this demonstration as we are going to expose the generation of QR endpoint via a RESTful API. Click Generate. Download the zip file and unzip it.

Now open STS, from the menu bar click File > Open Projects from File System > Import Source…

Image Source:

Let’s say, we’re running a Laravel application on AWS with Auto-scaling configured and there are some artisan commands that runs periodically to do certain jobs. There might be jobs that are long running and resource hungry. To remedy this problem, we can decouple such commands from application server by moving them into Lambda function. For example, we have a artisan command to run in every minutes that marks OTPs as expired after a predefined time period. To run that using AWS Lambda rather than in application server let us create a lambda function to do so.


Login into AWS…

Consider a transaction with two parties (Sender & Receiver). Once the transaction ends it is required to notify both sender and receiver via Email and SMS about the activity. While developing serverless application we need to keep in mind that a Lambda should have a unique responsibility. In accordance with that, in case of our scenario, we can create three separate Lambda functions to perform all these tasks. For example —

  1. sendMoneyFunction — lambda function that will take care of the transaction.
  2. sendEmailFunction — lambda function that will take care of sending the email
  3. sendSmsFunction — lambda function that will…

In Part 1 of this tutorial series we configured AWS Cognito User Pools for user management and authentication. And In Part 2 we created four (4) Lambda functions required to demonstrate SignUp, SignIn, RefreshToken and accessing Private API. In this final part we will create four (4) APIs -

  • Sign Up API
  • Sign In API
  • Refresh Token API
  • Private API

using API Gateway and mapped them with cognito user pool and respective Lambda functions. Let’s start one by one -

Creating Sign Up API

Login to your AWS console, browse API Gateway section under Services Menu from top. Click Create API, select REST protocol…


In our first tutorial we configured AWS Cognito user pools for user profiling and authentication purpose. In this tutorial we will create 4 separate Lambda functions for -

  1. Sign Up,
  2. Sign In,
  3. Refresh Token and
  4. Private API that requires authentication token.

Let start our journey to create these 4 functions. First we need to create a custom IAM role for our lambda functions to access cloudwatch logs and cognito. Go to Services > Security, Identity, & Compliance> IAM. Click Roles > Create role > AWS Services > Lambda > Next:Permissions > Create policy

Click JSON tab on new page and…

Modern applications are running on top of several managed cloud micro-services to achieve real time scalability and high availability without paying for idle resources which was an issue with traditional architecture behind an application where we needed to consider sudden traffic and other factors before provisioning servers that sometimes leads to over-provisioning or under-provisioning. Scalability is a real challenge in traditional architecture.

What about an application where our user and authentication module will be taken care of by a service whole sole purpose is user profiling and authentication only and can scales to support millions of users, REST API endpoints…

Mahfuzul Alam

Software Analyst | AWS Certified Solutions Architect

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store