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 password – Password,
Choose the region closest to you – Region,
Select the database server version – 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 wait 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 (VPC Peering)
Select the machine type and storage: the 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 a 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 on 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 has been helpful to you. If you liked this article, like and repost you.
Thank you for your attention, have a nice day!