This page describes how to view information about a Cloud SQL instance.
View instance summary informationYou can view summary information about Cloud SQL instances by using the Google Cloud console, gcloud CLI, or the API.
Important: Cloud SQL generates a write endpoint automatically for your Cloud SQL Enterprise Plus edition instance. For more information about viewing this endpoint, see View the write endpoint. ConsoleIn the Google Cloud console, go to the Cloud SQL Instances page.
The following information appears about Cloud SQL instances that have Private Service Connect enabled for them:
To see the current instance state, hold the pointer over the status icon next to an instance name.
If the instance is in a FAILED
or MAINTENANCE
state, then you can recover the instance by selecting a time from the past and restoring the instance to its state at that time.
To open the Overview page of an instance, click the instance name.
In the Connect to this instance card, the following additional information appears about Cloud SQL instances with Private Service Connect enabled:
To see connectivity information about the instance, including whether an internal or external IP address is added to the instance, any authorized networks associated with the instance, and whether other Google Cloud services, such as BigQuery, can access data in Cloud SQL and make queries against this data over an internal connection, click the Connections tab.
For more information about this tab, see About connection options.
Click the Networking tab. The following information appears about instances that have Private Service Connect enabled for them:
For information about installing and getting started with the gcloud CLI, see Install the gcloud CLI. For information about starting Cloud Shell, see Use Cloud Shell.
To view summary information about an instance, use the gcloud sql instances describe
command:
gcloud sql instances describe INSTANCE_NAME \ --project=PROJECT_ID
Make the following replacements:
Here's an example of the output for running this command:
gcloud sql instances describe myinstance \ --project=12345 ... dnsName: mydnsname ... pscServiceAttachmentLink: projects/myproject/regions/myregion/serviceAttachments/myserviceattachment ... settings: ... ipConfiguration: ipv4Enabled: false pscConfig: allowedConsumerProjects: - projects/23456 - projects/34567 pscEnabled: true
dnsName
The DNS name for the instance. We recommend that you create a DNS record with this name and point it to the IP address of the Private Service Connect endpoint. We also recommend that you use this name to connect to the instance. Service attachment pscServiceAttachmentLink
The URI that points to the service attachment of the instance. Use this URI to create the Private Service Connect endpoint. Allowed consumer projects allowedConsumerProjects
A list of the allowed projects for the instance. You can create Private Service Connect endpoints from any VPC networks in these projects to the service attachment of the instance. Enabling Private Service Connect pscEnabled
Whether an instance has Private Service Connect enabled for it.
Note: To obtain the write endpoint for your Cloud SQL instance, use the gcloud sql instances describe
command. This endpoint is the value that's associated with the psaWriteEndpoint
parameter.
To create an instance, use a Terraform resource.
Apply the changesTo apply your Terraform configuration in a Google Cloud project, complete the steps in the following sections.
Prepare Cloud ShellSet the default Google Cloud project where you want to apply your Terraform configurations.
You only need to run this command once per project, and you can run it in any directory.
export GOOGLE_CLOUD_PROJECT=PROJECT_ID
Environment variables are overridden if you set explicit values in the Terraform configuration file.
Each Terraform configuration file must have its own directory (also called a root module).
.tf
extension—for example main.tf
. In this tutorial, the file is referred to as main.tf
.
mkdir DIRECTORY && cd DIRECTORY && touch main.tf
If you are following a tutorial, you can copy the sample code in each section or step.
Copy the sample code into the newly created main.tf
.
Optionally, copy the code from GitHub. This is recommended when the Terraform snippet is part of an end-to-end solution.
terraform init
Optionally, to use the latest Google provider version, include the -upgrade
option:
terraform init -upgrade
terraform plan
Make corrections to the configuration as necessary.
yes
at the prompt:
terraform apply
Wait until Terraform displays the "Apply complete!" message.
To delete your changes, do the following:
deletion_protection
argument to false
.
deletion_protection = "false"
yes
at the prompt:
terraform apply
Remove resources previously applied with your Terraform configuration by running the following command and entering yes
at the prompt:
terraform destroy
Before using any of the request data, make the following replacements:
HTTP method and URL:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X GET \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "kind": "sql#instance", "state": "RUNNABLE", "databaseVersion": "POSTGRES_13", "settings": { "authorizedGaeApplications": [], "tier": "db-custom-2-7680", "kind": "sql#settings", "availabilityType": "REGIONAL", "pricingPlan": "PER_USE", "replicationType": "SYNCHRONOUS", "activationPolicy": "ALWAYS", "ipConfiguration": { "authorizedNetworks": [], "pscConfig": { "allowedConsumerProjects": [ "ALLOWED_PROJECTS" ], "pscEnabled": true }, "ipv4Enabled": false }, ... "createTime": "2023-06-14T18:48:34.975Z", "sqlNetworkArchitecture": "NEW_NETWORK_ARCHITECTURE", "pscServiceAttachmentLink": "projects/PROJECT_ID/regions/REGION_NAME/serviceAttachments/SERVICE_ATTACHMENT_ID", "dnsName": "DNS_NAME" }
The following fields exist for instances that have Private Service Connect enabled for them:
allowedConsumerProjects
: a list of the allowed projects for the instance. You can create Private Service Connect endpoints from any VPC networks in these projects to the service attachment of the instance.pscEnabled
: whether an instance has Private Service Connect enabled for it.pscServiceAttachmentLink
: the URI that points to the service attachment of the instance. Use this URI to create the Private Service Connect endpoint.dnsName
: the DNS name for the instance. We recommend that you create a DNS record with this name and point it to the IP address of the Private Service Connect endpoint. We also recommend that you use this name to connect to the instance.To see how to construct the underlying REST API request for this task, see the instances:get page.
Note: To obtain the write endpoint for your Cloud SQL instance, use the instances:get
method. This endpoint is the value that's associated with the psaWriteEndpoint
parameter.
Before using any of the request data, make the following replacements:
HTTP method and URL:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X GET \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "kind": "sql#instance", "state": "RUNNABLE", "databaseVersion": "POSTGRES_13", "settings": { "authorizedGaeApplications": [], "tier": "db-custom-2-7680", "kind": "sql#settings", "availabilityType": "REGIONAL", "pricingPlan": "PER_USE", "replicationType": "SYNCHRONOUS", "activationPolicy": "ALWAYS", "ipConfiguration": { "authorizedNetworks": [], "pscConfig": { "allowedConsumerProjects": [ "ALLOWED_PROJECTS" ], "pscEnabled": true }, "ipv4Enabled": false }, ... "createTime": "2023-06-14T18:48:34.975Z", "sqlNetworkArchitecture": "NEW_NETWORK_ARCHITECTURE", "pscServiceAttachmentLink": "projects/PROJECT_ID/regions/REGION_NAME/serviceAttachments/SERVICE_ATTACHMENT_ID", "dnsName": "DNS_NAME" }
The following fields exist for instances that have Private Service Connect enabled for them:
allowedConsumerProjects
: a list of the allowed projects for the instance. You can create Private Service Connect endpoints from any VPC networks in these projects to the service attachment of the instance.pscEnabled
: whether an instance has Private Service Connect enabled for it.pscServiceAttachmentLink
: the URI that points to the service attachment of the instance. Use this URI to create the Private Service Connect endpoint.dnsName
: the DNS name for the instance. We recommend that you create a DNS record with this name and point it to the IP address of the Private Service Connect endpoint. We also recommend that you use this name to connect to the instance.Note: To obtain the write endpoint for your Cloud SQL instance, use the instances:get
method. This endpoint is the value that's associated with the psaWriteEndpoint
parameter.
You might see some banners at the top suggesting actions that you might want to take.
View the write endpointA write endpoint is a global domain name service (DNS) name that resolves to the IP address of the current primary instance automatically. This endpoint redirects incoming connections to the new primary instance automatically in case of a replica failover or switchover operation. You can use the write endpoint in a SQL connection string instead of an IP address. By using a write endpoint, you can avoid having to make application connection changes when a region outage occurs.
For more information about using a write endpoint to connect to an instance, see Connect to an instance using a write endpoint.
MetricsThis section provides usage charts of key instance metrics that you can use to monitor your instances. When working with metric data, keep the following facts in mind:
For more information about the metrics shown in the chart, see Monitoring Cloud SQL instances.
For a complete list of Cloud SQL metrics provided by Cloud Monitoring, see the Cloud SQL metrics list.
For more information about using Cloud Monitoring with Google Cloud, see the Cloud Monitoring documentation.
Connect to this instanceIn the Connect to this instance section, you can find your instance's IP addresses, VPC network, and connection name.
To open a terminal and connect to your instance, click Connect using Cloud Shell.
To open a related tutorial in the right pane, click Connect from a Compute Engine VM instance.
To go to Connection options, click See all connection methods.
For more information about connecting to an instance, see Connecting overview.
Service accountThis section shows the instance's service account email address.
For more information, see the IAM service accounts documentation.
ConfigurationThis section shows current configuration settings of the instance.
To change configuration settings, click Edit configuration.
For more information about editing the instance configuration, see editing an instance.
Operations and logsThis section lists recent instance operations, such as creating backups.
To see recent operations, click View all operations.
To see logging information, click View PostgreSQL Error Logs.
For more information about the Operations and the Logs Explorer pages, see Cloud SQL logging.
For generic information about logging, see Viewing logs and Exporting logs.
MaintenanceThis section shows the current maintenance update settings and schedule.
To change preferences, click Edit maintenance preferences.
To change notification settings, click Edit notification preferences.
For more information about maintenance in Cloud SQL, see Maintenance overview.
What's nextRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4