Running a low-cost, scalable app with Azure Cosmos DB free tier

Nikisha Reyes-Grange

Technology enables developers to quickly create apps that simplify our lives. But when building an app, the challenge is to identify the right combination of services or tools from the vast options available that will enable you to run low-cost, scalable apps. Prototyping a solution can be expensive depending on the services used. Azure offers a collection of services, for free, that enable developers to test out combinations without the risk of cost. Now with the release of a free tier for Azure Cosmos DB, developers have access to a whole new set of possibilities to power their apps with real-time, always-on NoSQL database anywhere in the world.

With free tier from Azure Cosmos DB, developers will receive 400 RU/s throughput and 5 GB storage each month for free for the life of their account. What does that get you? We asked members of our developer community for examples of apps with databases that can run at zero cost with free tier.

theurlist is a web app developed by Microsoft Cloud Advocates Burke Holland (@BurkeHolland) and Cecil Phillip (@CecilPhillip) to make sharing links at events and presentations easier. Burke and Cecil shared details of their app and how free tier will save them money as their app scales.

 

Tell us about your app, theurlist. What does it do and why did you develop it?

Burke: As regular presenters at conferences, we had a problem giving attendees links to all the resources we highlighted in our sessions. There was no easy way to do it – we were just listing out a bunch of links on a slide and nobody could really use that information. What we wanted was to give people one easy-to-remember URL to get the complete list of resources.

theurlist app allows you to do exactly this. You create a list of URLs by entering them into the app. The app automatically pulls in the image, title and description for each URL. You can customize these values as well. You can then save the list, and theurlist will generate a unique URL for you – kind of like bit.ly. Alternatively, you can select your own “vanity” URL to get a custom theurlist.com link. For instance, you could have theurlist.com/my-awesome-links that points to…your awesome links!

You can keep and manage your lists of links. This is great because we would frequently forget a resource that we wanted to add later. With theurlist, you can view all of your existing lists and add or remove links at any time.

Recently we added the ability to display a giant QR code instead of just the list of links. That way attendees can simply point their phone at a slide and get a tab open in their browser with all the links they need.

Image theurlist screenshot
theURList.com

Which Azure services did you use to build it?

We built theurlist with a variety of Azure services, including:

Why did you choose those services?

When you look at the characteristics of the data that we’re storing, it made sense for us to go with the option of using a document database, which is why we chose Azure Cosmos DB. We didn’t have need for creating relationships or a formalized schema. Early on in development, being able to quickly add and remove properties was a huge time saver. All our data was very self-contained which makes sense for the types of queries we’re running against the data. We also knew we were going to be using Azure Functions, so any solution that integrates with that would be a huge win. With all of that considered, Cosmos DB made sense for us.

One of our goals was to build an entirely serverless application. We knew our front-end was going to be a rich JavaScript application and not server-side rendered. We also didn’t want to manage a web server. Based on that we decided to go with the static website option with Azure Blob Storage. It’s very cost efficient, we get tons of storage, and it was very easy to setup.

For us to have a serverless backend in Azure there are really two options: Azure Functions or Logic Apps. Even though Logic Apps have tons of amazing connectors, we didn’t need most of them and we really wanted the flexibility that comes with writing our operations in code. That’s what drove our decision to use Azure Functions, which is also very cost effective for us.

We chose Application Insights (a feature of Azure Monitor) because need to know what’s happening in the application, both when things are going well and when they go wrong. Being able to look at the usage data around what types of devices are being used to access the app and what errors were through have been very helping in us improving the usability.

We need some way to stitch our application together and specify routing. We wanted the app URL’s to be clean in structure. Instead of sending people to a different URL for the api, we wanted it to be theurlist.com/api/. To pull that off, we used Azure Front Door and it’s concept of page routes. This also allows us to specify routes for authentication and do things like forcing https. Front Door gives us some additional niceties, such as health checks on our services and automatic SSL and custom domain setup.

How much throughput and storage are you using?

Burke: Right now, we are running at about 60K requests per month. That’s not a lot. Our app is simple and only has one container. Cecil partitioned the data well, so that 60K comes out to 2 RU/s! That leaves us a ton of room for growth.

Cecil: We created a new Azure Cosmos DB account and migrated our existing data to it once free tier was released. Azure Data Factory made migrating our live data to the new account relatively painless – we even created a blog post and video about it. We’re now running at zero cost for our database and knocked off over $30 per month for database service and storage. When you couple that with the compute power of Azure Functions, we ended up with an extremely cost-effective backend for the Urlist UI.

What are your plans for scaling?

Burke: Given the current traffic, we could scale up to 12 MILLION requests per month before we hit the 400 RU/s mark. That’s so much room for growth, that we haven’t really thought about scaling. If we did have to scale (which would be a great problem to have), I would hope to use autopilot mode for throughput so that we only pay for the RUs that we use above and beyond the 400 that we get with the free tier. Pairing autopilot with free tier is nice because you get the automatic throughput management plus if you don’t go above the 400, you don’t pay. You only pay for what you use.

 

Start using Azure Cosmos DB free tier

Want to get started with Azure Cosmos DB free tier? Create a new Azure Cosmos DB account in the Azure portal and enable free tier. There is a limit of one free tier enabled Azure Cosmos DB account per Azure subscription.

For a step-by-step guide, watch as Burke and Cecil move their data from their existing account into a new free tier account:

0 comments

Discussion is closed.

Feedback usabilla icon