Optimize development and testing cost in Azure Cosmos DB


This article describes the different options to use Azure Cosmos DB for development and testing for free of cost, as well as techniques to optimize cost in development or test accounts.

Azure Cosmos DB emulator (locally downloadable version)

Azure Cosmos DB emulator is a local downloadable version that mimics the Azure Cosmos DB cloud service. You can write and test code that uses the Azure Cosmos DB APIs even if you have no network connection and without incurring any costs. Azure Cosmos DB emulator provides a local environment for development purposes with high fidelity to the cloud service. You can develop and test your application locally, without creating an Azure subscription. When you're ready to deploy your application to the cloud, update the connection string to connect to the Azure Cosmos DB endpoint in the cloud, no other modifications are needed. You can also set up a CI/CD pipeline with the Azure Cosmos DB emulator build task in Azure DevOps to run tests. You can get started by visiting the Azure Cosmos DB emulator article.

Azure Cosmos DB free tier

Azure Cosmos DB free tier makes it easy to get started, develop and test your applications, or even run small production workloads for free. When free tier is enabled on an account, you'll get the first 1000 RU/s and 25 GB of storage in the account free.

Free tier lasts indefinitely for the lifetime of the account and comes with all the benefits and features of a regular Azure Cosmos DB account, including unlimited storage and throughput (RU/s), SLAs, high availability, turnkey multiple-regional distribution in all Azure China regions, and more. You can create a free tier account using Azure portal, CLI, PowerShell, and a Resource Manager template. To learn more, see how to create a free tier account article and the pricing page.

Azure Trial

Azure Cosmos DB is included in the Azure trial subscription, which offers Azure credits and resources for free for a certain time period. Specifically for Azure Cosmos DB, this trial subscription offers 25-GB storage and 400 RUs of provisioned throughput for the entire year. This experience enables any developer to easily test the features of Azure Cosmos DB or integrate it with other Azure services at zero cost. With Azure trial subscription, you get a CNY 3500 credit to spend in the first 30 days. You won't be charged, even if you start using the services until you choose to upgrade. To get started, visit Azure trial subscription page.

Azure Cosmos DB serverless

Azure Cosmos DB serverless lets you use your Azure Cosmos DB account in a consumption-based fashion where you are only charged for the Request Units consumed by your database operations and the storage consumed by your data. There is no minimum charge involved when using Azure Cosmos DB in serverless mode. Because it eliminates the concept of provisioned capacity, it is best suited for development or testing activities specifically when your database is idle most of the time.

Use shared throughput databases

In a shared throughput database, all containers inside the database share the provisioned throughput (RU/s) of the database. For example, if you provision a database with 400 RU/s and have four containers, all four containers will share the 400 RU/s. In a development or testing environment, where each container may be be accessed less frequently and thus require lower than the minimum of 400 RU/s, putting containers in a shared throughput database can help optimize cost.

For example, suppose your development or test account has four containers. If you create four containers with dedicated throughput (minimum of 400 RU/s), your total RU/s will be 1600 RU/s. In contrast, if you create a shared throughput database (minimum 400 RU/s) and put your containers there, your total RU/s will be just 400 RU/s. In general, shared throughput databases are great for scenarios where you don't need guaranteed throughput on any individual container. Learn more about shared throughput databases.

Next steps

You can get started with using the emulator or the free Azure Cosmos DB accounts with the following articles: