Azure Cosmos DB for PostgreSQL w/ React Quickstart
Azure Cosmos DB for PostgreSQL and React
Introduction
I’m so excited to ‘introduce’ you to a new addition to Azure Cosmos DB service. At Ignite 2022, Microsoft made an announcement for PostgreSQL in Azure CosmosDB!
In this blog we will show you how to connect your Front end app to the Azure Cosmos DB for PostgreSQL service in Azure.
This is the beginning of a larger series so not all the features you see on the app are complete. We will walk this journey together as we add more production level of deployment into the repo. (Aka. Key-Vault for secrets, Managed Identity and Infrastructure As Code. :))
What is Azure Cosmos DB for PostgreSQL?
Azure Cosmos DB - is a fast, distributed NoSQL database. Scalable with 99.999% availability! (Get started)
PostgreSQL - Here are some reasons why you might want to use PostgreSQL –
- Free and Open-Source
- Runs on wide range of Operating Systems (But this could be a moot point Azure Cosmos DB for PostgreSQL will be hosted on the cloud)
- Many data types (eg. Boolean, range)
- More info here
Azure Cosmos DB for PostgreSQL has combined these two technologies and extended with Citus extension to bring distributed tables for PostgreSQL. Combining Azure Cosmos DB’s high scalability and Citus’s distributed tables allows for maximum performance with PostgreSQL.
Let’s Get Started!
Azure
Let's go to the Azure Portal and click ‘+ Create a resource’. Then search for ‘Azure Cosmos DB’
Once you select Azure Cosmos DB you will see these options:
Select ‘Azure Cosmos DB for PostgreSQL’
Choose your ‘Cluster name’ and ‘Password’. (You will use these values in the next step.)
Code
Go and clone/fork this repo: GitHub - i-am-dan/CosmosDb-PostgreSQL-Quickstart - Repo contains both the front-end and the back-end.
Once you clone the repo, go to ‘Server/db/citus.js’
Please replace ‘<cluster>’ and ‘<password>’ with the values you put in from the previous step.
Go to your favorite cli tool then go to the React folder and run:
You will see:
Now go to the Server folder and run:
‘Reset’ will create the table of Pharmacy in the Citus Database with seed data.
‘Load’ will load the dataset into the view.
‘Delete All’ will drop the table.
(I haven’t worked on the ‘Add Pharmacy’ and ‘Delete Selected’, YET, so they are disabled… lol)
It’s easy as that! You’ve created your first React app with Azure Cosmos DB for PostgreSQL.
I hope this set a good foundation for anyone to go start making something awesome!
Side note: Please be advised that Azure Cosmos DB’s cost could go up fast if you want to really leverage the full power of it’s scalability and multi-region support. (We always recommend using the Azure Pricing Calculator to get a transparent estimate) |
Published on:
Learn moreRelated posts
The Impact of RedHat Linux 7 Extended Life Cycle Support on Azure Guest Patching Customers
The article discusses the impact of RedHat's Extended Life Cycle Support (ELS) phase announcement on Linux 7 versions. According to RedHat, Li...
Terraform on Azure May 2024 Update
Welcome to our April 2024 update! These blogposts will be covering everything we've gotten up to recently with Terraform on Azu...
Azure DevOps Server 2022 Update 2 RC now available
The release candidate (RC) of Azure DevOps Server 2022.2 is now available for download. This release includes new features that have already b...
Azure Verified Modules - Monthly Update [April]
In the April edition of the Azure Verified Modules update, the AVM team announces their upcoming quarterly community call scheduled for 21st M...
Microsoft Purview compliance portal: Information Protection – Sensitivity labels protection policy support for Azure SQL, Azure Storage, and Amazon S3
Microsoft Purview Information Protection now supports label-based protection for Azure SQL, Azure Data Lake Storage, and Amazon S3 buckets. Wi...
Centralized private resolver architecture implementation using Azure private DNS resolver
This article walks you through the steps to setup a centralized architecture to resolve DNS names, including private DNS zones across your Azu...
Azure VMware Solution - Using Log Analytics With NSX-T Firewall Logs
Azure VMware Solution How To Series: Monitoring Azure VMware Solution Overview Requirements Lab Environment Tagging & Groups Kusto ...
Troubleshoot your apps faster with App Service using Microsoft Copilot for Azure | Azure Friday
This video provides you with a comprehensive overview of how to troubleshoot your apps faster with App Service utilizing Microsoft Copilot for...
Looking to optimize and manage your cloud resources? Join our Azure optimization skills challenge!
If you're looking for an effective way to optimize and manage your cloud resources, then join the Azure Optimization Cloud Skills Challenge or...