I am doing a mongoexport and then a BigQuery load of a 50 million record collection All of my cloud functions and app engine instances connect fine to Mongo Atlas via the VPC peering connection setup via Serverless VPC Access to our Atlas hosted in GCP
However, I have not been able to get Compute Engine instances to connect via our VPC. When I add the Compute Engine instance external IP, it connects fine. When I remove that and add in the internal IP for the Compute Engine instance I get timeouts, but it does show:
2021-01-10T18:09:44.531+0000 could not connect to server: server selection error: server selection timeout, curr
ent topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: ***.mongodb.net:27017, Type: Unkn
own, State: Connected, Average RTT: 0, Last error: connection() : dial tcp *.*.*.*:27017: i/o timeout }, { Ad
dr: ***.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connec
tion() : dial tcp *.*.*.*:27017: i/o timeout }, { Addr: ***.mongodb.net:27017, Type: Unkn
own, State: Connected, Average RTT: 0, Last error: connection() : dial tcp *.*.*.*:27017: i/o timeout }, ] }
So my best guess is I'm not putting in the right IP range, or the right specific IP to allow compute engine instances to connect internally, it seems like it's Mongo Atlas firewall blocking.
What are the proper steps to setup connection between compute engine and mongo atlas over VPC so that there is no ingress/egress and connections are direct.