-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"TimeoutError: [Errno 110] Connection timed out" from Google Colab Notebook #368
Comments
By default the Python Connector tries to connect with private IP. Unless the VM that runs your notebook code is within the same VPC as your PSA attachment, you'll need to update your instance to have a public IP and update your connector code to be: # https://github.com/GoogleCloudPlatform/alloydb-python-connector/tree/main
conn = connector.connect(
"projects/dynamic-branch-380821/locations/us-central1/clusters/tmp-trial-alloydb-cluster/instances/primary-instance",
"pg8000",
user="analyst",
password=db_password,
db="verse-db",
ip_type="PUBLIC",
) The reason you're seeing a timeout error is there's no network path between the machine running your notebook and your private IP address. |
You can assign a public IP with:
|
Cool, that worked! Maybe that detail above can be added to the top-level README? I noticed for the |
Glad to hear it and good idea. I've sent a PR to update the README to make this clear. |
Bug Description
I am trying to connect to a trial AlloyDB instance from a Google Colab Notebook. Both the my Notebook / GDrive are managed under the same GCP organization as the DB instance. Unfortunately I observe a timeout (already have my ADC with correct database user credentials, password hidden). The code I'm evaluating is available here: https://colab.research.google.com/drive/1_Xd4rfncFBfxbgQwYu_ZL4Tu76VApcn2#scrollTo=MA7sOm6qF2b0
The timeout occurs in the
connecter.connect()
method.Example code (or command)
No response
Stacktrace
Steps to reproduce?
To reproduce, just copy the notebook and execute within your GCP+Gdrive/Colab environment
Environment
This is already documented in the notebook
Additional Details
No response
The text was updated successfully, but these errors were encountered: