GCP Connectivity to Managed Services: A Comprehensive Exam Guide

This guide delves into the various methods Google Cloud Platform provides for connecting your workloads to Google-managed services (like Cloud SQL, Cloud Memorystore, Dataflow, etc.) and even to other private services, ensuring secure, high-performance, and private communication. Understanding these connectivity options is crucial for designing robust and compliant cloud architectures.

1. Introduction: Why Private Connectivity?

When you deploy applications on GCP, they often need to interact with platform-managed services. While many services offer public endpoints, connecting privately offers significant advantages:

GCP offers several distinct methods to achieve this private connectivity, each designed for different scenarios and service types.

2. Private Services Access (PSA)

2.1. What is Private Services Access?

Private Services Access (PSA), also known as "VPC Service Networking," is the traditional and common way for your Google Cloud resources (VMs, GKE clusters, etc.) within your Virtual Private Cloud (VPC) network to connect privately to Google's managed services.

2.2. How it Works

PSA creates a dedicated, private connection between your VPC network and a Google-owned network, called the Service Producer VPC Network . This connection is established using a VPC Network Peering connection.

  1. Allocate an IP Range: You must first allocate an IP address range (e.g., /20 or larger) within your VPC network that Google can use for its managed services. This range is reserved and cannot overlap with any other ranges in your VPC or peered networks.
  2. Create a Peering Connection: You perform a one-time API call (`services vpc-peerings connect`) to establish a VPC Network Peering connection between your designated IP range and the Service Producer VPC Network.
  3. Provision Managed Services: When you provision a managed service (e.g., Cloud SQL instance), it gets an internal IP address within the allocated Service Networking IP range.
  4. Private Communication: Your VMs can then communicate with these managed service instances using their internal IP addresses, with traffic flowing securely and privately over the peering connection, entirely within Google's network.
Mermaid Diagram 1

2.3. Key Characteristics & Considerations

2.4. Use Cases

3. Private Service Connect (PSC)

3.1. What is Private Service Connect?

Private Service Connect is a more modern and flexible connectivity method introduced by Google. It offers two main modes of operation:

PSC primarily uses internal IP addresses and doesn't require allocating a dedicated IP range for Google's services or direct VPC peering with the Service Producer VPC.

3.2. Private Service Connect (Consumer-side for Google APIs)

This allows VMs in your VPC to access most Google APIs (e.g., Cloud Storage, Pub/Sub, BigQuery) without requiring internet access or proxy VMs, and without consuming a dedicated IP range from your VPC for Google's services.

How it Works:

  1. Create a Private Service Connect Endpoint: In your VPC, you create a dedicated forwarding rule or `gve` endpoint in a specific subnet and region. This endpoint is configured to point to a specific Google API service (e.g., `all-apis`, `pubsub.googleapis.com`).
  2. Internal IP Access: The endpoint is assigned an internal IP address from your subnet. Traffic destined for Google APIs is routed to this internal IP.
  3. Secure Routing: Google's network handles the secure and private routing from this internal IP to the actual Google API infrastructure.
Mermaid Diagram 2

Key Characteristics & Use Cases:

3.3. Private Service Connect (Consumer-side for Managed Services like Apigee X)

Similar to Google APIs, this allows your VPC to connect to specific Google-managed services (e.g., Apigee X, Dataproc Serverless) that are deployed within a Google-managed VPC.

How it Works:

  1. Provision Service: You provision a managed service instance (e.g., Apigee X) which exists in a Google-managed VPC.
  2. Create PSC Endpoint: You create a forwarding rule in your VPC that points to the service instance. This forwarding rule receives an internal IP address from your VPC subnet.
  3. Bi-directional Communication: Traffic flows privately between an internal IP in your VPC and the internal IP of the managed service in the Google-managed VPC, all facilitated by PSC.
Mermaid Diagram 3

Key Characteristics & Use Cases:

3.4. Private Service Connect (Producer-side)

This allows you to expose your own services (like a custom SaaS or an internal API running on VMs behind an Internal Load Balancer in your VPC) to other consumers (other projects, other organizations) using internal IPs, without VPC Peering, VPNs, or Shared VPC.

How it Works:

  1. Internal Load Balancer (ILB): Your service must be exposed via an Internal Load Balancer in your VPC.
  2. Service Attachment: You create a "Service Attachment" resource in your VPC, which references your ILB. This attachment is what consumers connect to. You can control which projects/organizations can access it.
  3. Consumer Endpoint: Consumers create a Private Service Connect endpoint (a forwarding rule) in their VPC that points to your service attachment. They get an internal IP in their VPC.
  4. Private Flow: Traffic from the consumer's internal IP routes through Google's network to your service attachment, then to your ILB and finally to your service.
Mermaid Diagram 4

Key Characteristics & Use Cases:

4. Serverless VPC Access

4.1. What is Serverless VPC Access?

Serverless VPC Access is specifically designed to allow serverless environments (Cloud Functions, Cloud Run, App Engine standard environment) to connect to resources that have internal IP addresses within your VPC network. Without this, serverless services can only reach public internet endpoints.

4.2. How it Works

When you configure Serverless VPC Access for a region, Google deploys a small, managed set of connector VMs into a designated subnet within your specified VPC network.

  1. Connector Deployment: You create a Serverless VPC Access connector in a specific region and subnet in your VPC. This connector uses a `/28` IP range from that subnet.
  2. Outbound Routing: Your Cloud Functions, Cloud Run services, or App Engine standard services are configured to use this connector for VPC egress. Any outbound requests with internal IP destinations are routed through the connector.
  3. Access VPC Resources: The connector acts as a proxy, forwarding traffic into your VPC, allowing your serverless services to reach resources like Compute Engine VMs, internal load balancers, or Cloud SQL instances that are configured with Private IP within your VPC.
Mermaid Diagram 5

4.3. Key Characteristics & Considerations

4.4. Use Cases

5. Comparison and Summary

Choosing the right connectivity method depends on the services involved and your architectural requirements.

Feature Private Services Access (PSA) Private Service Connect (PSC Consumers) Private Service Connect (PSC Producers) Serverless VPC Access
Primary Use Connect your VPC to specific Google Managed Services. Connect your VPC to Google APIs or a selection of Google Managed Services. Expose your service (in your VPC) to consumers via private IPs. Serverless services (Run, Functions, App Engine) connect to your VPC resources.
Mechanism VPC Network Peering to Google's Service Producer VPC. Private forwarding rule (endpoint) in your VPC, managed by Google. Service Attachment (references ILB) in producer VPC, PSC endpoint in consumer VPC. Managed connector VMs in a subnet of your VPC.
IPs Consumed (Your VPC) Allocated IP range (e.g., /20) for Google's services. Internal IP for the PSC endpoint (from a subnet). Internal IP for your ILB. /28 IP range for the connector.
IP Overlap Mgmt. Critical: Allocated range must not overlap with your VPC or peered networks. No issue for Google's side; Consumer VPC subnets are managed as usual. No issue between producer and consumer VPCs. Connector subnet range must be unique within your VPC.
Transitivity Non-transitive peering applies. Does not use peering; effectively transitive across the consumer's VPC for supported APIs. Direct connection between consumer endpoint and producer attachment; no peering. Outbound connectivity only to resources *within* the connected VPC.
Bi-directional? Yes (for allowed traffic). Mostly one-way (your services to API); some services support inbound (e.g., webhook). For managed services like Apigee X, yes. Yes (bi-directional communication for the service). Outbound from serverless to VPC. No direct inbound to serverless via connector.
Common Services Cloud SQL, Memorystore, Cloud Spanner, Vertex AI Workbench. Google APIs (Storage, Pub/Sub, BigQuery), Apigee X, Dataproc Serverless. Your own microservices, SaaS, internal APIs. Connects Cloud Functions, Cloud Run, App Engine standard to any internal VPC resource.

6. Advanced Concepts & Best Practices

6.1. DNS Resolution (Cloud DNS)

6.2. Shared VPC Integration

6.3. Firewall Rules

6.4. Security and Least Privilege

6.5. Network Topography

7. GCP Exam Tips