Connectivity Tests is a diagnostics tool that lets you check connectivity between network endpoints. It analyzes your configuration and, in some cases, performs live data plane analysis between the endpoints. An endpoint is a source or destination of network traffic, such as a Cloud SQL instance.
Use the Connectivity Tests tool for any of the following purposes:
- To verify connectivity between a Cloud SQL instance and another resource, such as a Virtual Machine (VM), or between a read replica instance and a primary instance.
- To troubleshoot any connectivity issues associated with different types of source and destination settings.
- To determine whether there's an issue in your VPC network that's used for the Cloud SQL-related resources.
Configuration errors that the tool can diagnose include connectivity to a Cloud SQL instance blocked by:
- VPC firewall rules, hierarchical firewall policies, and global network firewall policies
- A routing issue (for example, an incorrect route to a destination network is used or no dynamic routes are available)
- An issue associated with VPC peering between your VPC network and the Google-managed service network
- The instance not running
- An incorrect port or protocol being used by the Cloud SQL Auth Proxy to access the instance
- A failure occurring with authorized networks set up for the instance
For more information about the Connectivity Tests tool, see Connectivity Tests overview.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
- Enable the Network Management API. You must enable this API so that you can run connectivity tests.
- Make sure you assign the Network Management Admin role and associated permissions to your user account.
Create a connectivity test
To create a connectivity test, follow these steps:
-
In the Google Cloud console, go to the Cloud SQL Instances page.
Click the Cloud SQL instance for which you want to create a connectivity test.
- From the side navigation menu, click Connections.
- Click the Connectivity tests tab, and then click Create.
In the Test name field, enter a name for the test.
- From the Protocol list, select a protocol for the test.
- If this Cloud SQL instance is the source for the test, do the following:
- In the Source region, click the Current Cloud SQL instance option.
- In the Destination region, click Other, and then specify information about the endpoint for the destination.
- If the instance is the destination for the test, do the following:
- In the Source region, click Other, and then specify information about the source's endpoint.
- In the Destination region, click the Current Cloud SQL instance option.
- In the Destination port field, enter a port for the destination.
- Click Create.
After the test finishes, the Connectivity tests tab loads and displays a list of configured tests.
View information about a connectivity test
High-level information about a connectivity test that you can view includes the following information:
- Name, protocol, source, and destination for the test.
- Google Cloud projects associated with the source and destination.
- Port reserved for the destination.
- Last date and time that the test was run.
- Result of the data plane analysis check that signifies how many packets of data were transmitted from the source to the destination.
- Result of the configuration analysis check that signifies whether a connection can be established between the source and destination so that packets of data can be transferred to the destination.
- Details about the test.
In addition to viewing high-level information about a connectivity test, you can click a test to see additional information about the results of the test, including the following information:
- One-way latency values associated with the live data plane analysis check.
- Detailed information about the configuration analysis check. This information includes the status of the check, Cloud SQL instance, and so on.
- REST API response for the connectivity test being run.
View high-level and detailed information
To view high-level and detailed information a connectivity test, follow these steps:
-
In the Google Cloud console, go to the Cloud SQL Instances page.
Click the Cloud SQL instance for which you want to view information about a connectivity test.
- From the side navigation menu, click Connections.
- Click the Connectivity tests tab. High-level information about all tests associated with the instance appears.
Click a test about which you want to view detailed information.
The Connectivity test details page appears. On this page, you can view the overall result and result cards for each Google Cloud resource in the testing path. You can click a link to the details page for some Google Cloud resources, such as VM instances or routes. If the test contains multiple traces, you can select a trace from the Trace result list.
If the test is eligible for data plane analysis, you can view the packet loss and latency metrics.
To interpret the test results, see Configuration analysis states.
- To view detailed information about the configuration analysis check, in the Last configuration analysis result section, click View.
- To view the REST API response for the test, scroll to the bottom of the page, and then click Equivalent REST.
Modify a connectivity test
To modify a connectivity test, follow these steps:
-
In the Google Cloud console, go to the Cloud SQL Instances page.
- Click the Cloud SQL instance for which you want to modify a connectivity test.
- From the side navigation menu, click Connections.
- Click the Connectivity tests tab.
- Click the test that you want to modify.
- On the Connectivity test details page, click Edit.
- Modify the test. You can modify the protocol, source and destination endpoints, and destination port.
- Click Save.
Test connectivity
You can test connectivity to a Cloud SQL instance with Private Service Connect enabled. To test inbound connectivity to the instance, set the IP address of the Private Service Connect endpoint that's used to connect to the instance to be the destination IP address.
gcloud
Use the gcloud network-management connectivity-tests create
command to create a connectivity test for a Cloud SQL instance with Private Service Connect enabled.
gcloud network-management connectivity-tests create CONNECTIVITY_TEST_NAME \ --source-instance=SOURCE_INSTANCE \ --destination-cloud-sql-instance=DESTINATION_CLOUD_SQL_INSTANCE \ --destination-network=DESTINATION_NETWORK \ --destination-port=DESTINATION_PORT \ --protocol=tcp
Make the following replacements:
- CONNECTIVITY_TEST_NAME: the name of the connectivity test.
- SOURCE_INSTANCE: the URI for the Compute Engine instance where the source IP address is located (for example,
projects/myproject/zones/myzone/instances/myinstance
). - DESTINATION_CLOUD_SQL_INSTANCE: the URL for the Cloud SQL instance (for example,
projects/myproject/instances/myinstance
). - DESTINATION_NETWORK: the URI for the VPC network where the destination IP address is located (for example,
projects/myproject/global/networks/mynetwork
). - DESTINATION_PORT: the port number reserved for the instance. For Cloud SQL for MySQL instances, the port number is
3306
.
Run connectivity tests again
If you change the network configuration of resources associated with a connectivity test and want to see the results for the latest configuration, you can run a test again. You can rerun one or more tests at the same time.
A connectivity test is based on a snapshot of the network configuration at the time that the test is run. Running a test again overwrites the previous test's results. If you want to keep older results, create a new test.
To run one or more connectivity tests again, follow these steps:
-
In the Google Cloud console, go to the Cloud SQL Instances page.
- Click the Cloud SQL instance for which you want to run connectivity tests again.
- From the side navigation menu, click Connections.
- Click the Connectivity tests tab.
- Select the check box next to each test that you want to run again.
- Click Rerun.
- In the dialog box, click Rerun.
Delete connectivity tests
If you no longer need a connectivity test, delete it. You can delete one or more tests at the same time.
To delete connectivity tests, follow these steps:
-
In the Google Cloud console, go to the Cloud SQL Instances page.
- Click the Cloud SQL instance for which you want to delete connectivity tests.
- From the side navigation menu, click Connections.
- Click the Connectivity tests tab.
- Select the check box next to each test that you want to delete.
- Click Delete.
- In the dialog box, click Delete.
Troubleshoot
For more information about troubleshooting common issues with connectivity tests, see Troubleshoot Connectivity Tests.
What's next
- Connectivity Tests overview
- Cloud SQL connectivity insights
- Create and run Connectivity Tests
- Network Analyzer overview