Back to all blogposts

We’ve cracked these 6 key serverless use cases with AWS/GCP in real projects

Bartosz Łuczak

Bartosz Łuczak

PHP Developer

Serverless is a great solution, isn’t it? Not having to think about server configuration and paying for code execution time? Dream! And these are only a couple of abundant serverless advantages. Considering that every software project is unique like a snowflake and requires an individual approach, the question arises: when should you consider using serverless anyway? So I created a list of the most popular serverless use cases that you will probably stumble across sooner or later. But when it happens, you’ll be ready!

There are so many cloud solutions that describing them all would increase this article’s volume so much that nobody would want to read it. So in order to make it more consistent, I decided to focus on two main cloud providers: Amazon Web Services and Google Cloud Platform.

These two are among the most popular cloud providers and they also happen to be important technologies for The Software House. AWS in particular is a key technology with TSH’s position as AWS Advanced Partner. If you are interested in learning more about this, read about how we help our clients use the AWS cloud efficiently in weeks.

Serverless technology & AWS

AWS is great for serverless – a cloud-native development model that makes it possible to build and run apps without having to deal with servers.

In fact, a lot of AWS services are purpose-built to support serverless application:

  • AWS Lambda is a serverless computing platform, which allows you to run pretty much any type of application or backend – no server management required.
  • AWS Fargate is another computing platofrm, which is great for dockerized apps. It is compatible with Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS
  • AWS SQS works in tandem with Lambda in order to process asynchronous tasks – this is perfect for distributed serverless architectures.
  • AWS Step Functions lets you organize multiple services into serverless workflows – great for more complex serverless architectures.

Regardless of whether you use AWS or not, you should take a look at the use cases below. They will allow you to better understand what serverless is and how you can use it in practical ways to enrich your systems.

💡 Before we begin, some serverless resources from my colleagues. Original content only!

Serverless and static page hosting

Yes, you can have a website without running a server by yourself! How cool is that? 

Modern websites are mostly built using static assets -– these are HTML, CSS, and JavaScript files. No code run on a server-side during page rendering makes the site more responsive, faster, and even cheaper to maintain. Considering that trend, cloud solutions are an attractive option for hosting a static website. 

Both cloud providers allow you to host a static website with their data storage service:

  • Amazon Web Services – Simple Storage Service (S3), 
  • Google Cloud Platform – Cloud Storage.

Think about the storage service as a disc in your personal computer.

Amazon’s S3 provides many features and configuration options. All you need to do in AWS is create a bucket and configure it with a few clicks. After that, you can put your website files into that bucket. Remember that these can be only static assets. If you need to use backend API, you can also rely on serverless technologies – I’ll explain that later. 

Useful resource alert! 

AWS has created a really thorough step-by-step tutorial on how to configure a static website on Amazon S3. Similarly, the Cloud Storage service has similar content on hosting a static website here. I highly recommend them.

If you are interested in such a website, you should definitely check out our SRR vs SSG in Next.js overview, which also goes over tools for static site generation including Gatsby.

micro frontends react
Gatsby-based Static Site Generation in tandem with Storyblok was one of the many technologies used in our work for Furgonetka. Read the whole case study, which involved the development of micro frontend.

Serverless functions

Serverless functions are single-purpose functions written by developers, maintained, and executed on a cloud-provider infrastructure. Using serverless functions can reduce costs and improve the efficiency of your solution. Here are a few short case studies proving my case.

Processing and manipulating images

In one of The Software House’s projects, we needed to create thumbnails and add watermarks to every picture in the system. The team resolved that by using serverless components provided by AWS. Files were stored in S3. The solution looked more or less like that:

serverless use cases Processing and manipulating images
AWS
  1. The user uploads an image via an application to S3.
  2. S3 triggers a lambda function whenever a new object is created in a specified bucket.
  3. Lambda function operates on the uploaded image, creates a thumbnail, adds a watermark, and uploads images to the S3 bucket.

Pretty simple, right? You could also transform images to another format, resize them, upload to another FTP or anything that comes to your mind. 

Triggering actions based on document changes

Serverless functions are handy when you need to do something when something else happens.  Sounds super “scientific”, I know, but the aforementioned case was a very simple example – after uploading a file the serverless function is triggered. The end, applause. 

However, there are more advanced use cases of serverless functions. 

In another software project, one team used Firestore as a database for a few services. It’s a cloud-hosted, NoSQL database by Google. There was a need to take action in one service when another happened in a different service. Google Cloud Functions came to the rescue because it allowed us to integrate your serverless functions with other services, including Firestore.

The solution provided by the developers worked like this:

serverless use cases Triggering actions based on document changes
GCP
  1. The document in the Firestore database is changed due to action in the first service.
  2. Firestore triggers an event that Google Cloud Function subscribes.
  3. Google Cloud Function updates the user roles in another service. 

This is only a single serverless use case for Firestore and Google Cloud Function subscriptions, but bear in mind that the possibilities are huge in a variety of ways. Not to look far – we also used Google Cloud Functions to change a user’s online status or update unread messages on chat.

Our work for XTRF, the provider of productivity tools for translation service companies, involved the development of a serverless architecture with Node.js and React Native.

Serverless and backend API

After creating a serverless website, it’s usually time to add some backend. There are a few ways of doing it. One way is to use previously mentioned serverless functions and API Gateway. Cloud providers supply powerful consoles to create RESTful API with just a few clicks. Here are some real-life use cases.

CRUD

If you want to create a basic application, there is no need to provision a dedicated server or worry about auto-scaling. A cloud provider will do it for you. Hence why serverless functions are a great solution for CRUD backend API. 

Imagine you are creating a fully serverless shopping list app. You already have your frontend as a static website on the Amazon S3 bucket. Now you need an API for it. 

For AWS you can use Amazon API Gateway and Lambda functions. You will need the database to store data. I recommend DynamoDB –  a fully managed and serverless NoSQL solution. In the picture below, you can find an example request route.

serverless use cases CRUD
AWS

After triggering a request, API Gateway routes it to a serverless function. Lambda makes necessary operations using the database and returns the result.  

It’s worth mentioning, you don’t need to configure an application’s architecture with the console by yourself. There is a dedicated solution that helps to deploy serverless applications – Serverless Framework.

Triggering asynchronous jobs

Sometimes you need to execute a task that lasts longer than a standard API request. In this case, asynchronous processing with serverless functions is a great choice. 

Last month we organized an internal hackathon. One of the projects was to automate our bootcamp launch for new developers. You know how it is – new people come to work with us and we need to onboard them quickly but qualitatively. Every bootcamp starts with creating a Slack channel, Jira board, Bitbucket repository, etc. It’s a great case for practicing automatization. And so we did it using asynchronous jobs. Communicating with external services for data exchange is a great case for serverless functions. 

More or less it goes like this:

serverless use cases backend api
AWS
  1. The team leader starts a process via the Slack command. Slack makes a request to the API.
  2. API Gateway routes request to first Lambda function.
  3. Lambda function accepts the request and passes the request load to the second Lambda.
  4. The first Lambda is returning a response with the message “Task accepted to process”. 
  5. The second Lambda is making requests asynchronously. It creates a Slack channel, Bitbucket repository, Jira project, etc. 

Serverless functions are great for such cases, however, remember serverless functions cannot run code forever. Lambda functions have a maximum time of 15 minutes execution, while Google Cloud Functions can last a maximum of 9 minutes. For longer tasks, use an alternative serverless approach – a serverless computing engine for containers. For Amazon, it’s AWS Fargate, for Google Cloud Platform – Cloud Run. Both provide a similar range of features and allow you to deploy your containerized applications on a fully managed serverless platform. 

If you’re not crazy about serverless computing engines for containers, the other option is to divide some larger processes into smaller pieces and combine them in one workflow. But no spoilers, we’ll move on to that later.

One interesting alternative to API Gateway is Backend For Frontend – a pattern in which each individual frontend has its own dedicated API that communicates with external APIs. We used this pattern in a project for Qiwa, a commerce platform for businesses in Saudi Arabia. It also involved Node.js and React.

digital transformation software, business software development, custom software development
A story on Qiwa from Arab News online, a recognized medium with 5M monthly visits.

🚦Test your company's observability mastery

Serverless is powerful, but it can rack up costs when used irresponsibly. This test is an easy way to learn how well your organization uses data to avoid needless spending and more. 5-10 minutes & no registration needed. 👇

Serverless and scheduled tasks 

Serverless computing can be useful for planned tasks execution. There are cloud-based solutions that execute serverless functions according to a given schedule. In AWS it’s done via CloudWatch Events. Google Cloud Platform uses Cloud Scheduler. 

Executing serverless functions works as typical CRON job schedulers and can be used to:

  • create daily reports,
  • make automated backups,
  • trigger business logic (e.g. deactivating subscriptions), 
  • send emails and notifications.
As part of our project for Reservix, which involved the development of an improved events platform with enhanced scalability and smart chat solutions, we made use of services such as CloudWatch as well as other AWS products, including Chime. We were able to deliver highly customized implementations with these services.

Serverless and notifications

Notifications are an important serverless use case, especially in mobile applications. It’s another job for serverless functions. These notifications can be sent in real-time or be scheduled. In Google Cloud Platform you can use the Firebase Cloud Messaging mechanism together with Cloud Functions. Amazon Web Services provides the SNS – Simple Notification Service

Check out this graph for simple mobile notifications:

serverless use cases notifications
GCP
  1. After getting a new like in a social media app, the information is saved in a database. 
  2. Database triggers an event that is subscribed by a serverless function. 
  3. The serverless function uses a notification service.
  4. The notification service sends notifications to the end-user.

In the AWS environment, it looks practically the same. Just replace Cloud Function with AWS Lambda and FCM with SNS:

serverless use cases graph
AWS example
Firebase Cloud Messaging is part of Google’s Firebase platform, a cloud service for the automation of backend development. It’s a cross-platform technology that we used in the implementation of a React/React Native chat solution.

Serverless and workflows

Sometimes you need to break down large business processes into smaller parts. If tasks must be executed one by one, you can orchestrate the whole process. And guess what, there are cloud services doing just that. In AWS it’s the aformentioned AWS Step Functions. Google Cloud Platform introduced a similar mechanism at the beginning of 2021, called Workflows

You can use different services while executing workflows. For example, in the AWS solution, you can use DynamoDB in an on-demand mode for keeping transaction data between the step functions.

In the data migration project for GOconnectIT, we were able to use Step Functions as well as Lambda and SQS in order to deliver a scalable and efficient architecture. It also uses DynamoDB – a fully serverless database designed for the processing of large amounts of data (ETL).

💡 Learn more about workflows from our head of Node.js. In this article, he describes our internal app – TSH Challenge – that uses AWS Step Function for creating and calculating stats from sports activities.

Serverless use cases – endless possibilities your next cloud- and AWS-based project

As you can see, there are so many use cases for serverless computing that you will surely find something to benefit your next project.

Possibilities of the pay-as-you-go model, zero server management, auto-scaling should only encourage you to try it. Ten years ago it was even unthinkable to create such systems without running your own server. 

serverless use cases meme

Let’s wrap up the most popular use cases for serverless architecture:

  • static website hosting,
  • processing images,
  • triggering actions based on various events,
  • backend API,
  • asynchronous jobs,
  • scheduled tasks,
  • notifications,
  • advanced business workflows.

With skilled developers and serverless, you can create scalable, efficient, and easy-to-manage solutions that will keep your apps competitive!

Would you like to work with developers that have deep and practical experience in implementing serverless-based solutions?

Work with an AWS Advanced Partner that made serverless and serverless-related technologies a centerpiece of its technology stack!

Interviews
CTO vs Status Quo

Find the exact rules Tech Managers used to organize IT & deliver solutions the Board praised.

Read here

The Software House is promoting EU projects and driving innovation with the support of EU funds

What would you like to do?

    Your personal data will be processed in order to handle your question, and their administrator will be The Software House sp. z o.o. with its registered office in Gliwice. Other information regarding the processing of personal data, including information on your rights, can be found in our Privacy Policy.

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

    We regard the TSH team as co-founders in our business. The entire team from The Software House has invested an incredible amount of time to truly understand our business, our users and their needs.

    Eyass Shakrah

    Co-Founder of Pet Media Group

    Thanks

    Thank you for your inquiry!

    We'll be back to you shortly to discuss your needs in more detail.