Using Console
Using CLI
[INSTANCE_NAME]
with the name of the instance that has a public IP address.Using Python
google-cloud-sdk
command gcloud sql instances list
to list all the database instances in your project.ipAddresses
field of each instance to see if it has a public IP assigned to it.google-cloud-sdk
command gcloud sql instances patch
to update the network settings of the instance.authorized-networks
parameter to the list of CIDR blocks that are allowed to access the instance.require-ssl
parameter to enforce SSL connections to the instance.google-cloud-sdk
command gcloud sql instances describe
to check the network settings of the instance.ipAddresses
field does not contain a public IP address.google-cloud-sql
library to interact with the Cloud SQL API. You can install it using pip install google-cloud-sql
. Also, make sure that the service account used by the script has the necessary permissions to update the network settings of the database instances.