Azure Database for PostgreSQL Deployment [Step-By-Step]


Azure

Author: Sahil Hulage
Reviewer: Deepak Prasad

Getting started with Azure Database for PostgreSQL Deployment

PostgreSQL is a powerful, open-source object-relational database system. PostgreSQL (pronounced as post-gress-Q-L) is an open-source relational database management system (DBMS) developed by a worldwide team of volunteers.

Azure offers PostgreSQL PaaS service with a Single Server and Flexible server. Azure Database for PostgreSQL has managed service provided use to run, manage and scale as per need. Its managed database service provided by azure to focuses on business and less administration for databases.

 

Prerequisite

  • Azure Subscription
  • Basic understanding of PostgreSQL
  • PSQL installed on the machine

 

Step 01: - Azure Databases for PostgreSQL

Azure offers multiple options for PostgreSQL according to customer requirements. Currently, we have a Flexible server, a Single server, and a Hyperscale (Citus) server group. In this article, we will understand Flexible Server as it fits most of the requirements before that will just have a quick overview on all options.

Flexible server

Best for production workloads that require zone resilient HA, predictable performance, maximum control, custom maintenance window, cost optimization controls, and simplified developer experience. Enterprise-ready fully managed community PostgreSQL service.

Single server

Best for existing applications already leveraging a Single Server. Enterprise-ready fully managed community PostgreSQL service with zonal high availability.

Hyperscale (Citus) server group

Best for ultra-high performance and data needs beyond 100GB.

Ideal for multi-tenant applications and real-time analytical workloads that need a sub-second response. Supports both transactional/operational workloads and hybrid transactional analytics workloads.

 

Step 02: - Deployment of Azure PostgreSQL Flexi Server

Search in the portal for Azure Database for PostgreSQL as per the below image you can see results.

Azure Database for PostgreSQL

 

Select the first option Azure Database for PostgreSQL flexible servers. As per the below image you can see estimated costs on the right side of the configuration.

Azure Database for PostgreSQL

 

Next, provide Server name for the Database Server and the Region. An interesting option here is you have the option to choose instances based on your workload, you can see in the image Production and Development.

Accordingly that you can select Compute + Storage likewise we do for VM creation.

Azure Database for PostgreSQL

 

If you click on Compute + Storage you can select it more granular level. also, you have the option to select storage and it can go up to 4TB.

Azure Database for PostgreSQL

 

As part of managed PaaS, you can get other benefits like selecting the latest available version for DB and then High availability. you can set this up later also but setting up the Admin username and Password is mandatory.

Azure Database for PostgreSQL

 

Next, tab we have to select the network connectivity and its recommended to keep database connectivity Private with VNet Integration.

The trade-off here is once you select the Networking method you can’t change it later. For easy accessibility we will make it Public and will show you how to access it.

Azure Database for PostgreSQL

 

You can add your public IP in the firewall to whitelist. It's easy for organizations to add VPN IPs to a firewall and give access to users.

Last review the changes and click on create.

Azure Database for PostgreSQL

 

Step 02: - Overview of the feature of Azure Database for PostgreSQL

Once your Database is deployed you can see the Overview page as per the below image.

The best option here is you can Start and Stop your PaaS DB Server. It's really cost-effective when you want to use it in Development or in a test environment.

Azure Database for PostgreSQL

 

Next, will see about the networking pane. You can download an SSL certificate to connect DB programmatically but as earlier discussed you can’t change the connectivity method.

In firewall rules, you can Add IP to the whitelist.

Azure Database for PostgreSQL

 

It provides us with the built-in connections strings to use in our application. As per the below image you can see the connection strings.

Azure Database for PostgreSQL

 

You can list, show, and update configuration parameters for an Azure Database for PostgreSQL server through the Azure portal as per the below image.

Azure Database for PostgreSQL

 

Next, as mentioned in the overview PostgreSQL managed service supported Hight Availability for your database.

Azure Database for PostgreSQL

 

You can enable this with a single click. But you have to pay double the price of course as it will create another copy of DB.

Azure Database for PostgreSQL

 

Step 03: - Connect to Azure Database for PostgreSQL

Here we can use Azure Cloud Shell to connect our database. you can use the below command to connect DB.

before that, you must check to Allow public access from any azure service within Azure to this Server. this option will whitelist azure services in the firewall.

Azure Database for PostgreSQL

 

You have to run the below command with your PostgreSQL Server details. and you would be able to access it as per the below image.

psql --host=<servername> --port=<port> --username=<user> --dbname=<dbname>

Azure Database for PostgreSQL

 

Next method we can use to connect using local client here I am using DBeaver for this. Fill required details here Hostname, Database Name, Username and Password.

Azure Database for PostgreSQL

 

You can Test Connection and click on Ok to save the connection details. As per the below image you can see it's connected.

Azure Database for PostgreSQL

 

Step 04: - How to monitor Azure Database for PostgreSQL

Monitoring the database is the key responsibility of every Database Administrator and azure makes it easy to monitor and understand the behavior of the application.

In Monitoring Pane, you have multiple options to monitor performance.  We are using Metrics to understand the behavior of our Database.

Azure Database for PostgreSQL

 

You can check free storage with build-in metrics.  On the basis of these metrics, you can create alerts for Storage utilization.

Azure Database for PostgreSQL Deployment [Step-By-Step]

 

Summary

If you follow this article and the end of this, you would be able to successfully deploy and configure Azure Database for PostgreSQL Database. The Database PaaS is used to store volumes of data at a scale according to the server capacity chosen by the user company. Cost reduction is also the primary consideration for the company to move toward the managed database.

 

References

 

Sahil Hulage

Sahil Hulage

He possesses over 5+ years of experience as a Cloud Consultant, specializing in Azure DevOps and CloudLinux. With his expertise, he implements and optimizes cloud solutions, ensuring seamless operations and efficient resource management. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment