Create a Shared VPC in GCP
A shared VPC is used to create a shared network between your projects and between regions and multi-regional zones in GCP. Essentially is allow you to create a flat network which all resources can access.
There are TWO major gotchas:
- Your account must have the IAM Role “Compute Shared VPC Admin” and “Organizational Admin”
- You must have the default VPC already created – to do this just view the VPC for your project and Compute Engine will automatically create the default subnet
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image.png)
If you dont have the roles you can find them by looking in Compute Engine>
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-1.png)
Next goto the Google Compute Engine > Shared VPC
On the Set Up Shared VPC page click save and continue
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-2.png)
On the Select subnets page choose your sharing mode and add you pre-created subnets
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-3.png)
Next allocate the permissions to the projects
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-4.png)
Next press the Attach Project button and add you other projects. Make sure you check the subnets are attached too.
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-5.png)
It will take a few moments to process
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-6.png)
Then your cross-project Shared VPC is created
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-7.png)
Next test connectivity by creating a demo VM in your sub-project region. Make sure you attach it to the correct subnet at the point of creation called “Networks shared with me“
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-9.png)
Next test connectivity. Make sure you have enabled firewall rules for SSH and ICMP (ping)
You can see i have 2x VM. One in London(Master Project), One in Finland (Guest Project)
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-11.png)
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-10.png)
Note different regions and different IP subnet ranges.
![](http://www.turbogeek.co.uk/wp-content/uploads/2019/03/image-12-1024x306.png)
Recent Comments