← sources

How we structure a production-ready GCP setup for startups (GKE Autopilot + Private Cloud SQL + Zero Exposed Public IPs)

source: reddit (reddit:googlecloud)published 2026-09-30 15:21ingested 2026-10-01 02:43

retained text

Hi everyone,

When setting up infrastructure for early-stage startups or SaaS projects on GCP, one of the most common mistakes is exposing database instances or cluster nodes directly to the public internet to save setup time.

Over time, I’ve refined a minimal, highly secure Terraform architecture designed to bootstrap new projects without technical debt or security vulnerabilities. Here is the architectural breakdown of what a proper setup should include:

**1. Networking & Egress (VPC & Cloud NAT)**

* Custom VPC without auto-created subnets to maintain full control over CIDR blocks.
* Private Google Access enabled on internal subnets.
* Cloud NAT configured for outbound internet traffic so private instances/pods can fetch packages or external APIs without requiring public IP addresses.

**2. Managed Compute (GKE Autopilot)**

* Using GKE Autopilot reduces day-2 operations and node maintenance overhead.
* Secondary IP ranges dedicated specifically for Pods and Services to prevent IP exhaustion.
* Private cluster configuration with private nodes and master authorized networks.

**3. Database Layer (Cloud SQL PostgreSQL)**

* Private Service Networking (VPC Peering) between the custom VPC and Google's service producer framework.
* `ipv4_enabled = false` to enforce internal-only connectivity from GKE pods to PostgreSQL.
* Automated daily backup windows and regional high-availability (HA) configured out of the box.

**Want the complete, production-ready Terraform code?**

If you are currently building a project on GCP and want to save \~15-20 hours of writing, modularizing, and debugging Terraform code, I packaged this entire architecture into a clean, well-documented starter template:

**Want the complete, production-ready Terraform code?**

If you want to save \~15-20 hours of setup time, I packaged this entire architecture into a modular template. **I'll leave the direct link in the comments below!**

It includes fully modularized Terraform scripts (`vpc`, `gke`, `database`), parameter files, and a step-by-step deployment README.

Happy to answer any questions in the comments about GCP networking, VPC peering, or GKE configuration!

document fetched 2026-10-01 00:41 · canonical https://reddit.com/r/googlecloud/comments/1wu7rcr/how_we_structure_a_productionready_gcp_setup_for