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 philosopherPythagoras 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!
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!
(Lifetime Access, live guides, certificate of completion, downloadable resources and more!)
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!
(Lifetime Access/ Live Demos / Downloadable Resources and more!)
Artemakis Artemiou is a seasoned Senior Database and AI/Automation Architect with over 20 years of expertise in the IT industry. As a Certified Database, Cloud, and AI professional, he has been recognized as a thought leader, earning the prestigious Microsoft Data Platform MVP title for nine consecutive years (2009-2018). Driven by a passion for simplifying complex topics, Artemakis shares his expertise through articles, online courses, and speaking engagements. He empowers professionals around the globe to excel in Databases, Cloud, AI, Automation, and Software Development. Committed to innovation and education, Artemakis strives to make technology accessible and impactful for everyone.
Views:7,286
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. Read More
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.