- NAME
-
- gcloud alpha alloydb connect - connect to an AlloyDB instance using the AlloyDB Auth Proxy
- SYNOPSIS
-
-
gcloud alpha alloydb connectINSTANCE--cluster=CLUSTER--region=REGION[--database=DATABASE,-dDATABASE] [--port=PORT; default=9471] [--auto-iam-authn|--user=USER,-uUSER] [--psc|--public-ip] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
(ALPHA)Connects to an AlloyDB instance using the AlloyDB Auth Proxy and psql. - EXAMPLES
-
To connect to an AlloyDB instance using the postgres user and database over
private IP, run:
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1To connect over public IP, run:
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1 --public-ipTo connect over Private Service Connect, run:
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1 --pscTo connect with a particular user and database, run:
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1 --user mydbuser --database mydatabaseTo connect with Auto IAM Authentication using your authenticated gcloud user, run
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1 --auto-iam-authnTo use an impersonated service account with the AlloyDB Auth Proxy, run:
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1 --impersonate-service-account impersonated@myproject.iam.gserviceaccount.comNOTE: the impersonated service account will be used by the Auth Proxy to retrieve connection info, but will not be used for authenticating to the database. To also authenticate to the database as the impersonated user, add the --auto-iam-authn flag.
To use an impersonated service account with the AlloyDB Auth Proxy and authenticate to your database with the same impersonated user, run:
gcloud alpha alloydb connect my-instance --cluster=my-cluster --region=us-central1 --impersonate-service-account impersonated@myproject.iam.gserviceaccount.com --auto-iam-authn - POSITIONAL ARGUMENTS
-
INSTANCE- AlloyDB instance ID
- REQUIRED FLAGS
-
--cluster=CLUSTER- AlloyDB cluster ID
--region=REGION-
Regional location (e.g.
asia-east1,us-east1). See the full list of regions at https://cloud.google.com/sql/docs/instance-locations.
- OPTIONAL FLAGS
-
--database=DATABASE,-dDATABASE- The AlloyDB database to connect to
--port=PORT; default=9471- Port number used by the AlloyDB Auth Proxy to start a localhost listener
-
At most one of these can be specified:
--auto-iam-authn- Enables Auto IAM authentication
--user=USER,-uUSER- Built-in database user to connect to the database as
-
At most one of these can be specified:
--psc- Connect to the AlloyDB instance using Private Service Connect.
--public-ip- Connect to the AlloyDB instance with Public IP
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - NOTES
-
This command is currently in alpha and might change without notice. If this
command fails with API permission errors despite specifying the correct project,
you might be trying to access an API with an invitation-only early access
allowlist. This variant is also available:
gcloud beta alloydb connect
gcloud alpha alloydb connect
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-03-31 UTC.