GCP: Serverless VPC connector stopped flowing data - google-cloud-platform

I have one VPC Serverless connector which helps Cloud Functions to access the default VPC and then transit to another peered VPC from another project.
The setup was working fine until yesterday.
No change happened.
Now my functions are timing out because the call to internal IPs do not return anything.
I activated the Flow logs for the VPC subnet on which the cloud functions are deployed (us-central1) and they do not show any activity at all, which points me at the Serverless VPC connector.
However it does not have any option to enable log.
I cannot try the network intelligence connectivity test since serverless infra has no IP.
I tried creating another VPC Connector with a different internal IP range, still no flow.
Any idea how I could debug this?

Related

Unable to access cloud function from GKE Cluster

We want to secure our cloud function ( Http ) so added ingress setting to allow internal traffic
after adding we unable to communicate from Service in GKE cluster to this cloud function
Getting 403 error
I am not able to understand because they are under same project
what are the things i need to configure to access my cloud function from microservice in GKE cluster
Can you please suggest what are the configurations needs to be taken care to secure the cloud function and successful connection between the microservice in GKE and cloud function?
Only traffic from VPC networks in the same project or the same VPC SC perimeter is allowed.
check that you cluster and could function are in the VPC by selecting the right VPC connector.

Creating Beanstalk without an internet connection

I'm trying to make beanstalk instances not connect outside the VPC to public internet.
The problem is that, when I clear the outbound security group and actually block the internet access, it makes the instances not start properly and throw error "502 Bad Gateway", also the health status in beanstalk change to "unknown".
When I checked the system log I saw that the instance is trying to connect outside the VPC in the user data script.
How can I solve this problem?
Using EB environment in a private subnet (no internet) is not that straight forward. The general consideration of how to do this are described in the AWS docs:
Using Elastic Beanstalk with Amazon VPC
For example, EB uses Network Time Protocol (NTP) thus you have to have internet connectivity. Without that, as docs describe, there are issues with Elastic Beanstalk health reporting.
You also need to setup VPC endpoints for Elastic Beanstalk as well as the endpoints for other services (e.g. S3):
Using Elastic Beanstalk with VPC endpoints
If you .ebextenstions install any packages from the internet, you need to ensure that you have properly setup NAT gateway or NAT instance.
The docs also provide example in CloudFormation vpc-private.yaml with exemplary setup for Internet gateway, NAT gateway, and route table.

Does Cloud Run with a VPC Connector send all original outbound traffic through the connector?

With fully managed Cloud Run connected to a VPC with a Serverless VPC Accessor, does all outbound traffic from Cloud Run go through that connector, or only traffic destined for RFC 1918 addresses?
If only for private IPs, how can I configure Cloud Run to send all of its outbound requests into the VPC?
(Note - with Cloud Functions there is an option to route all traffic or only private IPs through the connector - reference )
For now the Serverless VPC Connector for Cloud Run is still on Beta and some Network features will be added in the future, including Egress control.
The goal right now is to develop an identical implementation as the one Cloud Functions has so it makes sense to quote that doc. Unfortunately there is no ETA for it to be implemented. We encourage you to follow up the release notes
When reading this particular doc keep in mind: The Cloud Run service is the one fully managed, not the VPC Access connector. With that said, we could tell that all the traffic without would go through the VPC for now.
Hope this is helpful! :)

Is there a way to access a cloud function using peered VPC

I am trying to connect to a cloud function with HTTP trigger. It has an ingress rule to allow only internal traffic, I want to access this from another function running in a different project.
I tried creating VPCs in both the projects and have also peered them. In the cloud functions I am using a vpc connector in the egress but I still am not able to access.
Is there a direct way to access a cloud function running in say project-A from a cloud function running in say project-B using the network setting?
P.S Due to some constraints I cannot use shared VPC.
You can't achieve this today. Indeed, when you perform a VPC Peering, you define a special hop in the routes to go to the other VPC.
The problem is: When you call your Cloud Function, you don't call it by its IP but by its DNS.
Thereby, you won't use your VPC peering to reach the right VPC and, through it, the cloud function. You will use the public DNS, as any external system can do this, and thus you are blocked.

How to connect AppEngine Standard Gen2 to local resource using Serverless VPC and Cloud VPN?

I have a project setup where I can connect to a local resource through AppEngine Flexible instances launching on a VPC network that is setup with a Cloud VPN connection to my local firewall.
With the release of Serverless VPC for the us-east1 region, I wanted to replace my setup to use AppEngine Standard Gen2 instances vs Flexible for the cost savings. I setup a Serverless VPC for the region/network my AppEngine app is hosted on and my Cloud VPN connection is configured for, updated my app.yaml accordingly, and pushed a new version.
I keep getting timeout errors for the new version that is trying to use Serverless VPC to connect to my local resource.
Some context:
The VPC Network is named "portal" and setup to "Auto" mode (auto creation of subnets for each region)
Cloud VPN is setup as a Classic VPN in the "portal" network with Route-based routing in the us-east1 region, connecting to my remote local 192.168.11.0/24 subnet.
A route exists on the VPC network for destinations 192.168.11.0/24 to use the Cloud VPN I have setup as the next hop (automatically created)
With the above, AppEngine Flexible deployments on the "portal" network can connect to my local resource as can any other Compute Engine VM on the "portal" network
I setup the Serverless VPC connector on the us-east1 region with the subnet 10.8.0.0/28
I'm not too clear how Serverless VPC works so I'm not sure how to even begin troubleshooting. When I click on the route rule for the 192.168.11.0/24 destination, I can see the AppEngine Flexible instances listed along with some "serverless-vpc-access" tagged instances that appear to be on a different subnetwork but using 10.8.0.0/28 IPs.
Should this configuration be working? If not, what changes do I need to make in order to support this?
Your problem (most likely) is caused by static routing. Do you have a route for return traffic coming from your VPN going to the VPC connector? Look at the routes defined for the VPN.
The purpose of a Serverless VPC connector is to allow the connection from the App Engine Standard to your VPC Network since the App Engine Standard environment is hosted and managed by Google and is not part of your VPC Network.
More details can be found here: [https://cloud.google.com/vpc/docs/configure-serverless-vpc-access].
That being said, you should verify the following:
Make sure that you’ve added the new subnet (/28) to your local on premise routes, with your VPN Gateway as the next hop. Since you’re using route-based routing, there is nothing to do regarding the Traffic Selectors on the VPN.
Make sure your local firewall is configured to accept the connection back and forth with the new configuration (/28).
While this probably won't apply to you, I just wanted to point out that communication through the Serverless VPC connector to the App Engine Standard environment is not possible unless it’s done on the same original tcp connection that originated from that same App Engine (TCP Established).
Your configuration, as you described is definitely possible to achieve. As mentioned, there are only a few things you need to verify to make sure it works.