with gcp vpn, can resources be accessed using interal ip addresses? - google-cloud-platform

On connecting my on-prem network with GCP VPC using GCP VPN. From the on-prem network can i access the resources in GCP VPC using the internal ip address of resources.
If the answer is yes, does this apply to all VPN's in general.
I have searched this page for "internal" but found no clue - Cloud VPN overview

Yes, it's the principle of a VPN: bridge 2 networks, through the public internet, but with encrypted communication to keep the traffic secret.
Of course, there are limits and constraints: IP range overlap, routing, network announcement (BGE protocol if supported), firewalls,...

Yes you can access the GCP resources with internal IP addresses from on-premises network.
There are 4 types of private access options. These private access options can be used to allow VM instances with internal IP addresses to communicate with certain API’s and services. To choose an option that supports the APIs and services that you need to access refer to the documentation private-access-options. You can configure one or all of these options. They operate independently of each other.
4 types of private access options are:
Private google access
Private google access for on-prem hosts
Private service access
Serverless VPC access
Private google access for on-prem hosts:
Private google access for on-prem hosts used with on-prem hosts. Private Google Access for on-premises hosts is an alternative to connecting to Google APIs and services over the internet by routing traffic through a Cloud VPN tunnel or a Cloud Interconnect attachment (VLAN). Such on-prem hosts may or may not be configured with external IP addresses.You can use this option when you want to connect to Google API’s and services through VPC network. When using private google access for on-prem hosts your on-prem hosts do not need to have external IP addresses assigned to them.
For more information refer to the documentation private google access for on-premises hosts.

Related

Can I use the standard http.get library to access an API served on a GCP compute instance using the internal IP?

I have a GCP Workflows accessing an API served on a GCP Compute Instance using the public IP and it is working fine.
Now I want to use the same Workflows but accessing by private IP and I get a ConnectionError.
Is there any limitation of the GCP Workflows to access by private IP to the GCP Compute Instance?
Workflows are not part of your VPC, therefore no access is possible to private IP addresses. Workflows do not yet support VPC access connectors, which would allow for VPC access.

Why AWS recommends to avoid the use of public/internet gateways in favor of AWS PrivateLink and VPC endpoints?

A VPC endpoint enables connections between a virtual private cloud (VPC) and supported services, without requiring that you use an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Therefore, your VPC is not exposed to the public internet.
AWS PrivateLink is a highly available, scalable technology that enables you to privately connect your VPC to supported AWS services, services hosted by other AWS accounts (VPC endpoint services), and supported AWS Marketplace partner services. You do not need to use an internet gateway, NAT device, public IP address, AWS Direct Connect connection, or AWS Site-to-Site VPN connection to communicate with the service. Therefore, your VPC is not exposed to the public internet.
What's so insecure of using public internet if all my incoming(to AWS)/outgoing(from AWS) connections use https? Could this still be decrypted?
I'm not very knowledgeable in networking/security that's why I'm asking.
I think you are confusing two architectures.
Public applications - available over the internet. They require direct or peroxided internet access. One way to secure them is through HTTPS as you do. For them to work your VPC needs internet gateway and/or NAT as well.
Private applications - those applications are meant to be only accessible from within a AWS. Thus internet access to these applications is not required, and is bad practice. This is where AWS PrivateLink can be used. It allows you to expose your application to other AWS users, without them needing internet access or even access to your VPC. They can access your private applications from their own accounts and VPCs.

Compute Engine in VPC can't connect to Internet & Cloud Storage after establishing Cloud VPN

Assuming I have a custom VPC with IP ranges 10.148.0.0/20
This custom VPC has firewall rules to allow-internal so the service inside those IP ranges can communicate to each other.
After the system grows I need to connect to some on-premises network by using Classic Cloud VPN, already create Cloud VPN (the on-premises side configuration already configured by someone) and the VPN Tunnel already established (with green checkmarks).
I also can ping to on-premises IP right now (let's say ping to 10.xxx.xxx.xxx where this is not GCP internal/private IP but on-premises private IP) using compute engine created on custom VPC network.
The problem is all the compute engine instance spawn in custom VPC network can't communicate to the internet now (like doing sudo apt update) or even communicate to google cloud storage (using gsutil), but they can communicate using private IP.
I also can't spawn dataproc cluster on that custom VPC (I guess because it can't connect to GCS, since dataproc needs GCS for staging buckets).
Since I do not really know about networking stuff and relatively new to GCP, how to be able to connect to the internet on instances that I created inside custom VPC?
After checking more in-depth about my custom VPC and Cloud VPN I realize there's misconfiguration when I establish the Cloud VPN, I've chosen route-based in routing option and input 0.0.0.0/0 in Remote network IP ranges. I guess this routes sending all traffic to VPN as #John Hanley said.
Solved it by using policy-based in routing option and only add specific IP in Remote network IP ranges.
Thank you #John Hanley and
#guillaume blaquiere for pointing this out

Connecting to a private subnet from a GCP service

I am trying to reach a server in a private subnet that only has an internal IP from GCP cloud build. Is there something I need to do in order to allow traffic to be routed from google services to my private subnets or see my private DNS zones? Thanks in advance for the help!
Additional Details
I am trying to hit it via HTTP through an internal load balancer: Step #1 - "Auth to Vault": Error authenticating: Put http://10.16.6.33:8200/v1/auth/gcp/login: dial tcp 10.16.6.33:8200: i/o timeout
Google Cloud Build is a Google service located in Google controlled VPCs. Your internal load balancer is located in your VPC which Google Cloud Build cannot access.
At this time, Google Cloud does not offer a "VPC Connector" supporting Cloud Build accessing resources in your VPC using RFC 1918 private addresses.
you would have to allow your subnet to talk internal Google resources-
Go to VPC > networks > subnet > Enbale Private Google Access

Is Private Google Access also used for instances that have a public IP or where Cloud NAT is used?

On Google Cloud Platform (GCP): Is Private Google Access also used for instances that have a public IP or where a Cloud NAT is used?
If this is not so, then it probably does not increase latency (because Google will route the traffic internally, even when a public IP for googleapis.com is used) but it likely incurs egress charges.
Private Google Access has no effect on instances that have external IP addresses. Instances with external IP addresses can access the internet, according to the internet access requirements1.
PGA grants a privilege to the VM instances that only have internal IP addresses (no external IP addresses) can use Private Google Access and this way they can reach the external IP addresses of Google APIs and services.
Cloud NAT never performs NAT for traffic sent to the select external IP addresses for Google APIs and services. Instead, Google Cloud automatically enables Private Google Access for a subnet when you configure a Cloud NAT gateway to apply to that subnet's primary IP address range.