blog image
Blog Articles

Crafting a Database on Google Cloud Platform: Guide

In today’s digital age, businesses and organizations are continually striving to scale, innovate, and streamline their operations. Google Cloud Platform (GCP), a dominant force in cloud computing, offers a comprehensive suite of services tailored to meet the diverse requirements of modern enterprises. In this blog post, we’ll delve into what GCP is, its key features, and how it can benefit your business, whether you’re involved in custom financial software development, software development for financial services, custom enterprise software development, or seeking an iOS mobile app development company.

What is Google Cloud Platform (GCP)?

Google Cloud Platform, often referred to as GCP, is a suite of cloud computing services that provide a scalable and flexible infrastructure for software application development. It’s one of the major players in the cloud industry, competing with other giants like Amazon Web Services (AWS) and Microsoft Azure. GCP offers a wide range of services, including computing, storage, databases, machine learning, and analytics, all hosted on Google’s highly reliable and secure global network.

Key Features of GCP:

Global Network: Google Cloud Platform leverages Google’s extensive global network infrastructure, ensuring high availability and low-latency access to services across the globe.

Compute Services: Google Cloud Platform provides a variety of virtual machine options, including Google Compute Engine, which allows you to run workloads at scale.

Storage Services: With Google Cloud Storage and Cloud SQL, GCP offers secure, durable, and highly available storage solutions for your data.

Big Data and Analytics: Google’s BigQuery and Dataflow services enable you to process and analyze large datasets with ease.

Machine Learning: GCP’s AI and machine learning services, like AI Platform and AutoML, empower you to build and deploy ML models without specialized expertise.

Security and Compliance: Google Cloud Platform prioritizes security, with features like Identity and Access Management (IAM) and encryption to protect your data.

Serverless Computing: GCP’s serverless offerings, such as Cloud Functions and App Engine, simplify application deployment and management.

Benefits of Using GCP:

Scalability: GCP allows you to scale your resources up or down as needed, so you pay only for what you use, making it cost-effective for businesses of all sizes.

Reliability: Google’s infrastructure is known for its high uptime, ensuring that your applications and data are available when you need them.

Innovation: GCP provides access to cutting-edge technologies, such as AI and machine learning, enabling you to stay ahead of the competition.

Global Reach: With data centers in multiple regions, GCP offers global coverage, allowing you to reach your customers wherever they are.

Ease of Use: GCP’s user-friendly interface and extensive documentation make it accessible to both seasoned developers and newcomers to cloud computing.In this vast ocean of services, we are going to create a Cloud SQL Database and connect to it. We are going to see the connection with the created DB, both by the package provided by GCP and also simply by Prisma. Whether you choose to work with dedicated offshore developers or an in-house team, understanding the process of setting up and connecting to a Cloud SQL Database is essential for successful application development.

To create Cloud SQL DB follow this step by step guide.

1. Log in to Google Cloud Console:

Sign in with your Google account credentials.
If you don’t have a Google account, you’ll need to create one.

2. Select or Create a Project:

If you’re working on an existing project, select it from the dropdown in the top navigation bar.

If you need to create a new project, click on the project name and then click “New Project.”

Step 1.

Step 2.

Step 3.
Enter the details and create project

3. Enable Billing:

Before you can create Cloud SQL instances, you need to enable billing for your project. If you haven’t already done this, you’ll see a notification prompting you to enable billing.

4. Open the Cloud SQL Page:

In the Cloud Console, click on the navigation menu (the three horizontal lines) and go to “SQL” under the “Databases” section.

5. Click “Create Instance”:

On the Cloud SQL page, click the “Create instance” button.

Now choose the instance you want to create for –

6. Configure Instance Details:

In the “Instance ID” field, enter a unique name for your Cloud SQL instance.

Choose the database engine you want to use (e.g., MySQL, PostgreSQL, SQL Server).

Select your preferred location (region) for the instance.

Choose the database version.

Set the machine type and storage capacity.

Configure your database instance with a password for the master user.

Optionally, enable automatic backups and maintenance.
The below is a screenshot for Configuration page –

Click “Create” to create the instance.

7. Wait for Instance Creation:

Google Cloud will take a few moments to create your Cloud SQL instance. You can monitor the progress on the “SQL instances” page. It can take upto few minutes.

8. Configure Access Control:

Once the instance is created, you’ll want to configure access control. You can set up authorized networks, create users, and manage access to your database from the “Users” and “Authorized networks” tabs under your instance’s details.
To create Authorized networks :
Go to connection, and In the authorized networks add the IP address of your device. If you want to allow all traffic just enter “”. Give the IP address a name and click DONE.

If You want to create user –

Go to Users, then click on Add User Account –

Now set up the authorization setting, and click ADD

9. Connect to Your Cloud SQL Database:
You can connect to your Cloud SQL database using various methods, including using the Google Cloud SDK, Cloud Shell, or third-party database tools like pgAdmin or prisma and many more.
We will discuss two ways for how to connect to this instance and fire queries.
By Using “sql-connector” package by GCP –
GCP provides a “sql-connector” package which can we leveraged for establishing connection and firing SQL query. In this example we are using the “node-sql-connector” package.
More information regarding this package will be available at – LINK.
Firstly compose your GCP creds in a JSON file and store it in your project.
In ‘.env’ file give the path of that JSON file with key as “GOOGLE_APPLICATION_CREDENTIALS”.

Below is a sample code to form the connection “pool” using which we can fire sql query.


As you can see we can fire a query and the expected response is fetched.

Now that your Cloud SQL instance is up and running, you can create databases, tables, and manage your data using SQL commands or database management tools.

Sign Up Now
Get a Fast Estimate on Your Software Development Project

We are committed to delivering high-quality IT solutions tailored to meet the unique needs of our clients. As part of our commitment to transparency and excellence, we provide detailed project estimations to help our clients understand the scope, timeline, and budget associated with their IT initiatives.

Related Blog Posts

Exploring Lightning Web Components (LWC) Fundamentals in Salesforce Development

Introduction If you're looking to enhance your Salesforce skills, then mastering Lightning Web Component (LWC) Salesforce is a must. LWC is a modern web development technology that allows developers to…

View Article
Creating a Child Theme in WordPress: The Ultimate Guide

Introduction: WordPress stands out as a versatile and widely embraced content management system (CMS), catering to the needs of countless websites globally. Its appeal lies in the robust feature set…

View Article
Laravel vs Symfony: Navigating the PHP Frameworks

The world of PHP web development is rife with choices, and among the standout options are Laravel and Symfony. As two heavyweight contenders, they each bring their own set of…

View Article
Demystifying WordPress Plugins Guide

Introduction WordPress plugins serve as the dynamic catalysts that propel your website beyond its basic structure, transforming it into a versatile powerhouse. With an overwhelming array of choices at your…

View Article
Streamlining Deployments with Azure CI/CD Pipelines

Introduction: In today's software development landscape, the integration of Continuous Integration and Continuous Deployment (CI/CD) has evolved from a good practice to an essential component for ensuring software quality, stability,…

View Article
Expert QA Automation Company for Business Efficiency

Welcome to our expert QA automation company, where we understand the importance of streamlining your business processes. We believe that efficiency is the key to success, and we are committed…

View Article