Generating Sequence Numbers in Serverless via API Gateway

Sheen Brisals
8 min readJun 4, 2019
Photo by Kolleen Gladden on Unsplash

For many of us moving to serverless from traditional applications, finding an easy way to generate sequence numbers may be puzzling.

Traditionally, relational database systems (RDBMS) such as Oracle provided this out of the box, or custom applications written in favorable languages supplied them in abundance. So, it was never an issue that made us worry.

However, when we land on serverless shores, things aren’t easily visible unless we know the right approach and tools. In serverless, using RDBMS for this purpose is rare, especially when the functions are outside of the VPC (virtual private cloud) boundaries. In addition, we have the statelessness of the functions to deal with.

In this brief write-up, we will explore a common approach to generate sequence numbers while working with serverless applications on AWS.

Use of sequence numbers

If you are new to sequence numbering, let us start with a quick introduction. If you have seen all this before, please skip to the sections below.

In an e-commerce application, we generate order numbers, which are mainly in a sequence. In a college candidate registration system, application numbers can be arranged in ascending order. Another use case is a website's visitor…

--

--

Sheen Brisals

Co-author of Serverless Development on AWS (O'Reilly, 2024) | Engineer. Architect. Leader. Writer. Speaker. AWS Serverless Hero.