David
David

Reputation: 332

Access google storage from compute instance with no external IP

I need to read and write to a google storage from my vm with no public IP. It has a disk with a custom image with everything I need: python etc.

I create an instance with a script like this one. In the config dictionary you can see the section networkInterfaces where I specify that I don't want a public IP for my machine.

I paste the section here with my configuration:

# Specify a network interface with NAT to access the public
# internet.
'networkInterfaces': [            
        {
        "kind": "compute#networkInterface",
        "subnetwork": "projects/PROJECT-NAME/regions/europe-west3/subnetworks/default",
        "aliasIpRanges": []
        }
],

The problem is that this setup doesn't even allow me to write neither read from google storage within the same project. Just fyi a ping www.google.com does not work either.

Upvotes: 0

Views: 131

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75715

To achieve this, you need to activate the private Google access on the subnet where is deployed your VM.

Go to VPC menu, select your VPC and the subnet on which your VM is deployed. Then edit it and activate the private Google access

enter image description here

Upvotes: 2

Related Questions