We continue our article series dedicated Microsoft Azure. In previous articles, we’ve talked about Azure SQL Database, SQL Server on Azure VMs, Azure Advisor, etc. In this article, we will talk about what Azure Cosmos DB is, as well as see a simple step by step example on how to enable it and access it from the Microsoft Azure Portal.
What is Azure Cosmos DB?
As defined on MS Docs, Cosmos DB is a “is Microsoft’s globally distributed, multi-model database“. As described on Wikipedia, the Greek philosopher Pythagoras first used the term “cosmos“ for the order of the universe. In Greek, the word is written “κόσμος“. It is not random that this word is used in Azure Cosmos DB. Cosmos DB enables you to store and access data/documents across any number of Azure’s geographic regions. You can easily set your data to easily replicate across data centers all over the world (wherever there is an Azure data center) thus having them globally distributed. This guarantees high throughput, latency, availability, and consistency, based of course on the agreed SLA.
Learn more about Azure SQL Database: Enroll to our Online Course!
Check our online course on Udemy titled “Introduction to Azure SQL Database for Beginners”
(special limited-time discount included in link).Our course, will help you get started with Azure SQL Database and SQL Server on Azure Virtual Machines fast and easy. Many live demos included.
Main Technical Characteristics
The main technical characteristics of Azure Cosmos DB are:
- Ability to globally distribute your data
- Multiple data models and APIs for working with your data
- You can elastically and independently scale throughput and storage on demand and on a worldwide basis
- Ability to build highly responsive and mission-critical applications
- Ensure “always on” availability
How you can Set Up Azure Cosmos DB – A Simple Example
Let’s see a simple example of setting up Cosmos DB in Azure Portal.
Step 1: Create a resource
You create a new resource along with searching for cosmos. As you can see, the “Azure Cosmos DB” resource appeared in the search results.
Step 2: Click on the “Create” Button
Step 3: Create an Azure Cosmos DB Account
On this page, you enter the basic settings.
Next, you specify the network settings.
Then, if you you like, you can set tags for categorizing resources (i.e. for billing view purposes).
Then, the summary page is presented, where a validation of your settings takes place. In my example, validation was successful.
Step 4: Wait for Deployment to Complete
…and right after deployment is completed, you can now access your Azure Cosmos DB accounts.
Learn all about MySQL on Azure – Enroll to our Online Course!
Enroll to our online course on Udemy titled “Introduction to Azure Database for MySQL” and get lifetime access to high-quality lessons and hands-on guides about all the aspects of MySQL database service on the Azure cloud platform!
Step 5: Access your Azure Cosmos DB Account
The next step is to access your Azure Cosmos DB account and see the overview. In the overview page, it is important to see the status of the service. In my example, you can see that the status is “Active”.
That means that the service is ready to be used.
Note: In order to have Portal access to your Azure Cosmos DB account and perform certain actions, you might need to update your firewall rules accordingly.
Step 6: Working with your Data on Azure Cosmos DB
As mentioned in the “Main Technical Characteristics” section of this article, Azure Cosmos provides multiple data models and APIs for working with your data. For example, currently you can use the below APIs (more APIs are coming soon):
- SQL API
- MongoDB API
- Cassandra API
- Gremlin API
- Table API
Similarly, there is a variety of platforms via which you can work with your Azure Cosmos DB account.
A Simple To-Do App
In this example, I navigated to “Quick Start” and I chose the .NET platform via which I will work with data on my Azure Cosmos DB account:
After choosing the “.NET” platform, I click on the “Create ‘items’ collection” button, and a download appears containing a quick start .NET project which will help me to easily work with data.
I compiled and ran the sample .NET project and a local webpage came up, allowing me to create a simple document on my Azure Cosmos DB account. This project is just a simple example (i.e. a to-do app) for just illustrating how easy is to access your Azure Cosmos DB account from a client, in this case, a .NET program.
Here’s the first page of the sample program:
Now, let’s add an entry:
Entry added:
Checking your Data with Azure Cosmos DB Data Explorer
Now, I navigated back to the Azure Portal, and via my Cosmos DB account, I clicked on the “Data Explorer” link.
Then, via a simple SQL statement, I can see that the data (1 record) I previously added using the .NET app, is there and available:
High Availability – Replicate Data Globally
Now here’s the cool stuff!
When you click on the “Replicate data globally” link, the World map is presented (remember the explanation of the word “cosmos”? 🙂
On this map, you can see the regions (that is the available Azure data centers) in which my data is currently located. The regions are categorized as “Write” and “Read” regions.
Currently, my data is only available on one data center, that is “West Europe” (Write Region).
Now, see how easy is to replicate your data to another region!
I have just clicked on the “North Europe” data center and clicked on the “Save” button.
After you click “Save”, your Azure Cosmos DB data starts replicated to the newly added region. In my example below, you can see that North Europe is being set as a Read Region.
A few minutes later, replication is completed, and as you can see, my data is now available on two regions/data centers:
Conclusion
Azure Cosmos DB is a globally distributed, powerful multi-model database. Along with the proper SLA, this guarantees high throughput, low latency, as well as high availability and consistency.
In this article, we talked about what Azure Cosmos DB is and discussed its main characteristics. We also went throughout the process of create and accessing and Azure Cosmos DB account via a comprehensive step-by-step example with screenshots. Moreover, we saw how easy it is set global replication for your data.
In subsequent articles, we will explore more Cosmos DB as well as other cool Azure/Cloud data technologies.
Stay tuned!
See More! Enroll to the Online Course!
Learn more about Azure SQL Database and get started fast and easy! Through our online course, you will get lifetime access to a comprehensive set of lectures and live demonstrations that will get you started with Azure SQL Database in no time! The course is regularly updated with additional educational material!
Watch the Video Preview of our Online Course “Introduction to Azure SQL Database for Beginners”:
Featured Online Courses:
- Introduction to Azure SQL Database for Beginners
- SQL Server 2019: What’s New – New and Enhanced Features
- SQL Server Fundamentals – SQL Database for Beginners
- Essential SQL Server Administration Tips
- Boost SQL Server Database Performance with In-Memory OLTP
- Essential SQL Server Development Tips for SQL Developers
- Working with Python on Windows and SQL Server Databases
- Introduction to Computer Programming for Beginners
- .NET Programming for Beginners – Windows Forms with C#
- Entity Framework: Getting Started – Complete Beginners Guide
- A Guide on How to Start and Monetize a Successful Blog
- Introduction to Azure Database for MySQL
Read Also
- Main Benefits of Using Azure Cloud Services
- Comparison of SQL Server Deployment Options on the Azure Cloud Platform
- The Three Categories of Cloud Services (IaaS, PaaS, SaaS)
- Available MySQL Deployment Options in Azure
- Azure Database for MySQL Server Management Components
- Introduction to Azure Database for MySQL (Course Preview)
- Learn Azure SQL Database: Creating your First Database
- How to Create an Azure SQL Server Virtual Machine
- How to Backup a SQL Server Database from On-Premises to Azure Storage
- What is Azure Advisor?
- Tip of the Week No.11 – Capital Expenditure (CapEx) vs. Operational Expenditure (OpEx)
- Tip of the Week No.12 – Data Service Offerings on Azure
- … all our Azure-related articles
Check our latest software releases!
Easily generate SQL code snippets with Snippets Generator!
Convert static T-SQL to dynamic and vice versa with Dynamic SQL Generator.
Secure your SQL Server instances with DBA Security Advisor.
Benchmark SQL Server memory-optimized tables with In-Memory OLTP Simulator.
Rate this article:
Reference: SQLNetHub.com (https://www.sqlnethub.com)
© SQLNetHub
Artemakis Artemiou, a distinguished Senior Database and Software Architect, brings over 20 years of expertise to the IT industry. A Certified Database, Cloud, and AI professional, he earned the Microsoft Data Platform MVP title for nine consecutive years (2009-2018). As the founder of SQLNetHub and GnoelixiAI Hub, Artemakis is dedicated to sharing his knowledge and democratizing education on various fields such as: Databases, Cloud, AI, and Software Development. His commitment to simplicity and knowledge sharing defines his impactful presence in the tech community.