Shared VPC (original) (raw)

This page provides an overview of Shared VPC in Google Cloud. Shared VPC allows anorganization to connect resources from multiple projects to a commonVirtual Private Cloud (VPC) network so that they can communicate with each other securely and efficiently by using internal IP addresses from that network.

When you use Shared VPC, you designate a project as a host project and attach one or more other_service projects_ to it. The VPC networks in the host project are called_Shared VPC networks_. Eligible resourcesfrom service projects can use subnets in the Shared VPC network.

Shared VPC lets organization administratorsdelegate administrative responsibilities, such as creating and managing instances, to Service Project Admins while maintaining centralized control over network resources like subnets, routes, and firewalls. This model allows organizations to do the following:

Concepts

Organizations, folders, and projects

Shared VPC connects projects within the sameorganization. Linked projects can be in the same or differentfolders, but if they are in different folders the admin must haveShared VPC Admin rights to both folders. Refer to the Google Cloud resource hierarchy for more information about organizations, folders, and projects.

Participating host and service projects cannot belong to different organizations. The only exception is during a migration of your projects from one organization to another. During the migration, service projects can be in a different organization than the host project temporarily. For more information about migrating projects, see Migrating projects.

A project that participates in Shared VPC is either a host project or a_service project_:

For clarity, a project that does not participate in Shared VPC is called a standalone project. This emphasizes that it is neither a host project nor a service project.

A standalone VPC network is an unshared VPC network that exists in either a standalone project or a service project.

Networks

A Shared VPC network is a VPC network defined in a host project and made available as a centrally shared network for eligible resources in service projects. Shared VPC networks can be either auto or custom mode, but legacy networks are not supported.

When a host project is enabled, you have two options for sharing networks:

Host and service projects are connected by attachments at the project level. Subnets of the Shared VPC networks in the host project are accessible by Service Project Admins as described in the next section, administrators and IAM.

Organization policy constraints

Organization policies and IAM permissions work together to provide different levels of access control. Organization policies enable you to set controls at the organization, folder, or project level.

If you are an organization policy administrator, you can specify the following Shared VPC constraints in an organization policy:

Shared VPC makes use of Identity and Access Management (IAM) roles for delegated administration. The following roles can be granted to IAM principals, such as users, Google groups, Google domains, or Google Cloud service accounts. If you need to contact any of these admins, you can look them up in your organization's or project's IAM policy. If you don't have the required permissions, you must contact a network or project administrator in your organization.

Required administrative roles

Administrator (IAM role) Purpose
Organization Admin (resourcemanager.organizationAdmin) • IAM principal in the organization Organization Admins have theresourcemanager.organizationAdmin role for your organization. They nominate Shared VPC Admins by granting themappropriate project creation and deletion roles, and the Shared VPC Admin role for the organization. These admins can define organization-level policies, but specific folder and project actions require additional folder and project roles.
Shared VPC Admin (compute.xpnAdmin and resourcemanager.projectIamAdmin) • IAM principal in the organization, or • IAM principal in a folder Shared VPC Admins have the Compute Shared VPC Admin (compute.xpnAdmin) and Project IAM Admin (resourcemanager.projectIamAdmin) roles for the organization or one or more folders. They perform various tasks necessary toset up Shared VPC, such as enabling host projects, attaching service projects to host projects, and delegating access to some or all of the subnets in Shared VPC networks to Service Project Admins. A Shared VPC Admin for a given host project is typically its project owner as well. A user assigned the Compute Shared VPC Admin role for the organization has that role for all folders in the organization. A user assigned the role for a folder has that role for the given folder and any folders nested underneath it. A Shared VPC Admin can link projects in two different folders only if the admin has the role for both folders.
Service Project Admin (compute.networkUser) • IAM principal in the organization, or • IAM principal in a host project, or • IAM principal in some subnets in the host project A Shared VPC Admin defines a Service Project Admin by granting an IAM principal the Network User (compute.networkUser) role toeither the whole host project or select subnets of its Shared VPC networks. Service Project Admins also maintain ownership and control over resources defined in the service projects, so they should have the Instance Admin (compute.instanceAdmin) role to the corresponding service projects. They may have additional IAM roles to the service projects, such as project owner.

Service Project Admins

When defining each Service Project Admin, a Shared VPC Admin can grant permission to use the whole host project or just some subnets:

Network and Security Admins

Shared VPC Admins have full control over the resources in the host project, including administration of the Shared VPC network. They can optionally delegate certain network administrative tasks to other IAM principals:

Administrator Purpose
Network Admin • IAM principal in the host project, or • IAM principal in the organization Shared VPC Admin defines a Network Admin by granting an IAM principal the Network Admin (compute.networkAdmin) role to the host project. Network Admins have full control over all network resources except for firewall rules and SSL certificates.
Security Admin • IAM principal in the host project, or • IAM principal in the organization A Shared VPC Admin can define a Security Admin by granting an IAM principal the Security Admin (compute.securityAdmin) role to the host project. Security Admins manage firewall rules and SSL certificates.

Specifications

Quotas and limits

Shared VPC host projects are subject to standard per-project VPC quotas. Shared VPC networks are subject to the per-network limits andper-instance limits for VPC networks. Additionally, the relationships between host and service projects are governed by limits specific to Shared VPC.

Billing

Billing for resources that participate in a Shared VPC network is attributed to the service project where the resource is located, even though the resource uses the Shared VPC network in the host project.

Resources

Eligible resources

You can use most Google Cloud products and features in Shared VPC service projects.

The following limitations apply to resources that are eligible for participation in a Shared VPC scenario:

IP addresses

When you create an instance in a service project, the IP versions that you can configure depend on the host project's subnet configuration. For more information, seeCreate an instance.

Instances in service projects attached to a host project that uses the same Shared VPC network can communicate internally with one another by using either their internal IPv4 addresses or their internal or external IPv6 addresses, subject to applicable firewall rules.

Service Project Admins can assign any of the following IP address types to resources in a service project:

Internal DNS

VMs in the same service project can reach each other using the internal DNS names that Google Cloud creates automatically. These DNS names use the project ID of the service project where the VMs are created, even though the names point to internal IP addresses in the host project. For a complete explanation, see Internal DNS names and Shared VPCin the Internal DNS documentation.

Cloud DNS private zones

You can use Cloud DNS private zones in a Shared VPC network. You can create your private zone in the host project and authorize access to the zone for the Shared VPC network or set up the zone in a service project using cross-project binding.

Load balancing

Shared VPC can be used in conjunction withCloud Load Balancing. In most cases, you create the backend instances in a service project. In that case, all load balancer components are created in that project. While it's possible to create backend instances in the host project, such a setup is not well suited for typical Shared VPC deployments since it does not separate network administration and service development responsibilities.

Use the links in the following table to learn more about supported Shared VPC architectures for each type of load balancer.

Load balancer type Links
External Application Load Balancer Shared VPC architecture
Internal Application Load Balancer Shared VPC architecture
External proxy Network Load Balancer Shared VPC architecture
Internal proxy Network Load Balancer Shared VPC architecture
Internal passthrough Network Load Balancer Shared VPC architecture
External passthrough Network Load Balancer Shared VPC architecture

Examples and use cases

Basic concepts

Figure 1 shows a simple Shared VPC scenario:

Figure 1. A host project with a Shared VPC network provides internal connectivity for two service projects, while a standalone project doesn't use Shared VPC (click to enlarge).

Multiple host projects

Figure 2 shows how Shared VPC can be used to build separate testing and production environments. For this case, an organization has decided to use two separate host projects, a Test Environment and a Production Environment.

Figure 2. A Test environment host project and a Production environment host project use Shared VPC to create distinct production and test environments (click to enlarge).

Hybrid cloud scenario

Figure 3 shows how Shared VPC can be used in a hybrid environment.

Figure 3. A Shared VPC network is connected to an on-premises network and three service projects (click to enlarge).

For this example, an organization has a created a single host project with a single Shared VPC network. The Shared VPC network is connected by using Cloud VPN to an on-premises network. Some services and applications are hosted in Google Cloud while others are kept on-premises:

Two-tier web service

Figure 4 demonstrates how Shared VPC can be employed to delegate administrative responsibilities and maintain the principle of least privilege. For this case, an organization has a web service that is separated into two tiers, and different teams manage each tier. Tier 1 represents the externally facing component, behind an HTTP(S) load balancer. Tier 2 represents an internal service upon which Tier 1 relies, and it is balanced using an internal TCP/UDP load balancer.

Figure 4. In this two-tier web service, an externally facing component and an internal service are connected to a common Shared VPC network and managed by different teams (click to enlarge).

Shared VPC lets you map each tier of the web service to different projects so that they can be managed by different teams while sharing a common VPC network:

What's next