gcloud CLI: use IPv4 only

39 Views Asked by At

Is there a way to configure or flag the gcloud CLI to connect via IPv4 only?

Trying to connect to a Cloud SQL v2 instance fails (gcloud sql connect), because they do not support IPv6:

$ gcloud sql connect # ... + DB details ...

WARNING: If you're connecting from an IPv6 address, or are constrained by certain organization policies (restrictPublicIP, restrictAuthorizedNetworks), consider running the beta version of this command by connecting through the Cloud SQL proxy: gcloud beta sql connect
ERROR: (gcloud.sql.connect) HTTPError 400: Invalid request: Invalid flag for instance role: CloudSQL Second Generation doesn't support IPv6 networks/subnets

I can connect to the instance (with the same command) after disabling IPv6 in my computer's network settings, but how can I specify this just for the gcloud CLI?

0

There are 0 best solutions below