How to create a PostgreSQL server on Google Cloud Platform SQL

A translation of the article was prepared ahead of the start of the PostgreSQL course .




Introduction


In this article I will introduce you to GCP SQL and show how to create a PostgreSQL server in this service.

How to create PostgreSQL in GCP SQL


Let's start by creating a PostgreSQL server in GCP SQL.

Before you begin, log in to your GCP account. To create a PostgreSQL database server -> Select SQL in the Google Services panel.



To create an instance of SQL -> Click CREATE INSTANCE.



Select the database you need → Click PostgreSQL.



Fill in the configuration details:

Instance ID: - Name your instance,

Set a password - Password,

Choose the region closest to you - Region,

Select the version of the database server - Database version.

Click Show Configuration options to configure additional information.



Expand Configuration details



Click Connectivity → By default, the instance cannot be accessed from external networks; To grant access to an instance, allow a specific IP or sharing. Click + Add network.



By entering 0.0.0.0/0 into the Network, you will allow all IPv4 IPs and you can access the instance from anywhere.



Next, we are waiting for the settings to be saved.



To communicate with additional resources and the API → enable Private IP and select the Associated network (the VPC network you created, or default).



We are waiting for the save again.



You can also check Private service connections by clicking VPC → VPC Peering.



Select Machine type and storage: number of cores and memory.



If you intend to use the instance for test purposes, select a single zone.



If you have a production environment, select High availability, but this will increase the cost.



Click Add item to add the database flags.



Select the flag you need.


.
GCP will update the database every few months, so we are asked to set a date and time in advance to restart your database, which does not take much time. So, choose a date and time if you have a production database.



Specify key and value for clarity in the Labels tab.



Click Create to create the database.



GCP Creates PostgreSQL Server:



Success! The PostgreSQL server has been successfully created.



You will see information and an overview of the newly created PostgreSQL.



By clicking Connections, you can see the details of the connection, and also see that the database has been allowed to communicate with the GCP App Engine.



To access the created PostgreSQL server, we need to create a user in the USERS tab.



You can also create a database on the DATABASES tab.



You can manage backups in BACKUPS.



Create a replica for this instance in REPLICAS:



You can also look here to see the tasks that were completed:



I hope this article was useful to you. If you liked this article, like and repost you.

Thank you for your attention, have a nice day!



.



All Articles