More about Google Cloud Database
- Google Cloud PostgreSQL: Managed or Self-Managed?
- Google Cloud Data Lake: 4 Phases of the Data Lake Lifecycle
- Google Cloud NoSQL: Firestore, Datastore, and Bigtable
- Google Cloud Big Data: Build a Big Data Architecture on GCP
- Google Cloud Database: The Right Service for Your Workloads
- Google Cloud MySQL: The Complete Guide
- Understanding Google Cloud High Availability
- 8 Types of Google Cloud Analytics: How to Choose?
- Cloud Firestore: An In-Depth Look
- Google Cloud BigQuery: How to Use Google Cloud BigQuery
- Oracle on Google Cloud: Two Deployment Options
- Google Cloud SQL Pricing and Limits: A Cheat Sheet
- SQL Server on Google Cloud: Two Deployment Options
- Google Cloud SQL: MySQL, Postgres and MS SQL on Google Cloud
How Can You Run PostgreSQL on Google Cloud?
PostgreSQL is a popular open-source relational database management system. It is battle tested in large enterprises and provides high reliability and scalability.
Google Cloud PostgreSQL is a fully managed Google Cloud database service, which allows you to automatically provision and manage PostgreSQL database instances.
In this article, you will learn:
- Understanding Google Cloud SQL for PostgreSQL
- Fully Managed vs. Self Managed Deployment of PostgreSQL on Google Cloud
- NetApp Cloud Volumes ONTAP: The Best of Both Worlds
Understanding Google Cloud SQL for PostgreSQL
Below we’ll cover key aspects of the Google Cloud SQL for PostgreSQL managed service.
For a broader look at the Google Cloud SQL service, including MySQL, Postgres and SQL Server capabilities, read our guide to Google Cloud SQL.
Here are the key features provided by Google Cloud PostgreSQL:
- Runs on custom virtual machines (VMs) with up to 624 GB of RAM and up to 96 processors
- Provides up to 30 TB of usable storage, which automatically expands as needed
- Built-in encryption for database tables, temporary files, backups, and any data transferred over Google’s internal networks
- Secure connections via SSL/TLS or the Cloud SQL Proxy
- Data replication with automated failover across multiple availability zones
- Import and export of databases using SQL dump files
- Automated (scheduled) and on-demand backups
- One-click database instance cloning
- Support for PostgreSQL versions 9.6, 10, 11, 12, and 13 (subject to change, see current versions supported)
PostgreSQL Cloud SQL pricing is made up of the following components. For up-to-date pricing for each component, see the pricing page.
- Instance price—applies to shared-core instances. You pay a fixed rate per second, which varies according to the region the instance is deployed in.
- Processor and memory cost—applies to dedicated-core instances. You can select the required CPU and memory capacity (up to 96 processors and 624 GB of memory). Price per second is determined according to the capacity selected and your region.
- Storage—cost per GB/month, with two storage tiers—standard and high availability (HA). Backups are also billed per GB/month, but at a lower price.
- Networking—network ingress is generally free, with some exceptions. Egress is free for data transfer within a continent in Google Cloud, and otherwise charged per GB, with cost depending on the destination of the traffic.
Related content: read our complete guide to Google Cloud SQL pricing
Cloud SQL for PostgreSQL provides fully managed backup capabilities for PostgreSQL databases. Cloud SQL backups are incremental—only data that has changed since the last backup is included, to reduce storage costs.
Cloud SQL supports two types of backups:
This lets you back up the database whenever you need. It is useful before performing a destructive operation and gives you the option of reverting to a previous version of the database. On-demand backups are not automatically deleted, and you should periodically delete backups when no longer needed, to avoid incurring long-term storage costs.
Automatic backups are performed with a 4-hour backup window. The backup starts at some point during this period. It is advised to schedule the window for when the PostgreSQL database has minimal use.
Automatic backups are stopped if the database was not active in the last 36 hours. By default, you can save the last 7 backups. It is possible to reconfigure backup retention to save up to 365 automated backups.
Fully Managed vs. Self-Managed Deployment of PostgreSQL on Google Cloud
In the previous section we described Google Cloud SQL, a fully managed option for deploying PostgreSQL to Google Cloud. The fully managed option is convenient, but is mainly suitable for cloud-native applications, or applications rebuilt for the cloud.
There is another way to deploy PostgreSQL on Google Cloud, more suitable for larger, enterprise-grade database deployments. You can manage PostgreSQL directly on Google Compute Engine, by running a virtual machine and installing PostgreSQL on it. This gives you full control over your PostgreSQL database on GCP, letting you to fine-tune server parameters, modify database configuration, and tune performance, just like in a local deployment.
We’ll discuss how migration works for each of these scenarios, and then list pros and cons of each of the deployment options: managed vs. self-managed.
Each deployment option has different migration features.
Fully managed — migrating to Google Cloud SQL
- Import/export migration—works by extracting data from your database using pg_dump, then importing it into the hosted PostgreSQL instance. To ensure consistency, you will need to shut down the database during migration.
- External replica promotion and migration—creates a replica of the on-premises database and synchronizes it with the existing data. This can be done without downtime for production databases. Google Cloud SQL provides an automated migration workflow, supporting both migration from on-premises databases or from other cloud providers.
Self-managed — migrating to Compute Engine instance
Google provides tools that can help you move an on-premises PostgreSQL database to a Google compute instance:
- Migrate for Compute Engine—performs fully automated migration of workloads from on-premises machines or VMs to Google Cloud.
- Transfer Appliance—a hardware appliance that can help you transfer large data volumes from your data center to Google Cloud, by physically shipping it to Google.
Related content: Google Cloud Migration Tools: Copying 1GB or 500TB? Learn How
Pros and Cons of Fully Managed Deployment—PostgreSQL on Google Cloud SQL
Pros of managed option—PostgreSQL with Google Cloud SQL
If the team managing the database are not database experts, or you do not have enterprise requirements, Google Cloud SQL is a good choice. It can simplify day-to-day operations and database administration tasks like upgrades, configuration, and backups.
Cons of managed option—PostgreSQL with Google Cloud SQL
- Limit on number of instances—Google Cloud SQL allows up to 40 database instances per project. You may be able to increase this limit by contacting support.
- Storage limits—you can run databases up to 30.7TB in size.
- Connection limits—up to 250, 1000, or 4000 concurrent connections to the database, depending on instance size.
- No access to the server—you cannot gain direct access to the database server, change operating system, storage settings, or database configuration.
- Difficult to migrate—you can run the PostgreSQL database in a region of your choice, but it can be challenging to move to another region, and you cannot easily migrate to another cloud provider.
- Version limitations—the service only supports PostgreSQL versions 9.6, 10, 11, 12, and 13.
- Instance type limitations—you can run PostgreSQL on two types of instances, dedicated core and shared core. The former is limited to 96 vCPUs and 624 GB of memory. The latter is available in only four instance types—db-f1-micro, db-g1-small, HA db-f1-micro and HA db-g1-small, with a maximum of only 1.7GB RAM.
- Cost of managed service—with Google Cloud SQL, you pay a higher hourly rate compared to the same computing resources delivered via Google Compute Engine VMs, due to the added value services provided.
Pros and Cons of Self-Managed Option—PostgreSQL on Google Compute Engine
Google Compute Engine instances let you build custom infrastructure that is flexible and highly reliable. You can use virtual machines on GKE to run enterprise-grade PostgreSQL databases.
It is important to consider how to manage data storage. It is common to use Google Persistent Disks, alongside an enterprise-grade storage management solution like NetApp Cloud Volumes ONTAP.
Pros of self-managed option—PostgreSQL on Compute Engine instance
This option is ideal if you need complete control over your database instance. The advantages are:
- No limit on the number of instances— run as many database instances as you need, simply by starting more Compute Engine instances.
- No storage limits—you are only limited by the attached storage service. Leverage third party services for larger databases.
- No connection limits—there are no hard limits on the number of connections, but of course you will need to ensure your instance size and database configuration can support the required number of concurrent connections.
- No version limitations—you can run any version of PostgreSQL on Compute Engine, including those that are not supported by Google Cloud SQL.
- Maximum flexibility—you can customize everything from database settings to the server and the environment.
- Hybrid data—it is much easier to integrate the PostgreSQL database with on-premises resources or other clouds.
- Advanced database features—you can fine-tune database configuration to improve performance, use RAID for large-scale storage, and customize data replication.
- Instance type limitations—in a self-managed model, you can run PostgreSQL on any Google Cloud instance you choose, including large instances.
- Cost savings—when running on Compute Engine you only pay for cloud resources you directly use, with no additional charges for database management services.
Cons of self-managed option—PostgreSQL on Compute Engine instance
- Setup—setting up and maintaining PostgreSQL can be time consuming.
- Expertise—you’ll need expertise in PostgreSQL and Google Cloud to manage the database on Compute Engine.
- Maintenance—your team will be responsible for backups, monitoring, logging, replication, high availability, and everything else needed for an enterprise database deployment.
However, for large or mission critical databases, these can actually be advantages. Experienced database administration teams prefer a high level of control over their deployment and can still benefit from the advanced capabilities of the cloud.
NetApp Cloud Volumes ONTAP: The Best of Both Worlds
For complex use cases and enterprise customers that require full control over their database Cloud SQL is not a viable option. The Compute Engine option provides much more flexibility and control, as well as lower cost, but is more challenging.
NetApp Cloud Volumes ONTAP, the leading enterprise-grade storage management solution, delivers secure, proven storage management services on AWS, Azure and Google Cloud. Cloud Volumes ONTAP supports up to a capacity of 368TB, and supports various use cases such as file services, databases, DevOps, or any other enterprise workload, with a strong set of features including high availability, data protection, storage efficiencies, Kubernetes integration, and more.
NetApp Cloud Volumes ONTAP can help customers meet the performance, availability, and agility requirements of PostgreSQL in a self-managed environment.
Cloud Volumes ONTAP allows you to leverage self-managed PostgreSQL in Google Cloud with enterprise capabilities, achieving the following benefits:
- Run any version of PostgreSQL and database engine
- No limitations on instances configuration, scalability or storage volume
- No vendor lock-in
- No SLA limitations
- Pay only for actual resources used
- Full control over database configuration
- Full control over disaster recovery and data protection
In addition, NetApp Cloud Volumes ONTAP acts as a management layer on top of the Google Cloud deployment, achieving the following benefits:
- Intelligent caching capabilities to reduce latency whenever and wherever the data needs to be accessed.
- Data protection via instant, quiescent NetApp Snapshot™ copies which can enable point-in-time consistent backups and disaster recovery.
- Cost cutting storage efficiencies that can cut down storage footprint and cost by as much as 70%.
- Fast, seamless migration to Google Cloud from any repository with NetApp Cloud Sync or from NetApp appliances with SnapMirror®.
- Added IaC capabilities and management ease via the NetApp Cloud Manager console or API calls.
- FlexClone® data cloning technology makes it possible to create entire database writable clone volumes instantly and without cost penalties.
- Support hybrid and multicloud architectures