{"id":26761704,"url":"https://github.com/edosrecki/google-cloud-sql-cli","last_synced_at":"2025-09-25T21:18:15.553Z","repository":{"id":40247417,"uuid":"451051110","full_name":"edosrecki/google-cloud-sql-cli","owner":"edosrecki","description":"Connect to private Google Cloud SQL instance from local machine through Cloud SQL Auth Proxy running in Kubernetes.","archived":false,"fork":false,"pushed_at":"2025-09-16T14:05:41.000Z","size":1257,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-16T16:34:16.156Z","etag":null,"topics":["cli","cloud-sql-proxy","gcloud","gcloud-cli","google","google-cloud","google-cloud-platform","javascript","kubectl","kubernetes","nodejs","proxy","sql","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edosrecki.png","metadata":{"files":{"readme":"README.adoc","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-23T08:56:31.000Z","updated_at":"2025-09-16T14:05:38.000Z","dependencies_parsed_at":"2023-02-09T03:31:38.090Z","dependency_job_id":"a92d7a6f-450c-4fc4-86d2-577654f06715","html_url":"https://github.com/edosrecki/google-cloud-sql-cli","commit_stats":{"total_commits":230,"total_committers":3,"mean_commits":76.66666666666667,"dds":"0.32173913043478264","last_synced_commit":"9456fb3b21e38920b7ac3c750dd2020f971fd04e"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/edosrecki/google-cloud-sql-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edosrecki%2Fgoogle-cloud-sql-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edosrecki%2Fgoogle-cloud-sql-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edosrecki%2Fgoogle-cloud-sql-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edosrecki%2Fgoogle-cloud-sql-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edosrecki","download_url":"https://codeload.github.com/edosrecki/google-cloud-sql-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edosrecki%2Fgoogle-cloud-sql-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276983450,"owners_count":25739928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cloud-sql-proxy","gcloud","gcloud-cli","google","google-cloud","google-cloud-platform","javascript","kubectl","kubernetes","nodejs","proxy","sql","typescript"],"created_at":"2025-03-28T18:26:49.962Z","updated_at":"2025-09-25T21:18:15.522Z","avatar_url":"https://github.com/edosrecki.png","language":"TypeScript","readme":":toc: macro\n:toc-title:\n:toclevels: 10\n\n= ⛅ google-cloud-sql\n\nimage:https://img.shields.io/github/package-json/v/edosrecki/google-cloud-sql-cli/master?color=blue\u0026label=google-cloud-sql[\"google-cloud-sql CLI Version\"]\nimage:https://img.shields.io/github/actions/workflow/status/edosrecki/google-cloud-sql-cli/continuous-integration.yml[\"Build Status\", link=\"https://github.com/edosrecki/google-cloud-sql-cli/actions\"]\n\nA CLI app which establishes a connection to a private Google Cloud SQL instance and port-forwards it to a local machine.\n\nConnection is established by running a Google Cloud SQL Auth Proxy pod in a Google Kubernetes Engine cluster which runs in the same VPC network as the private Cloud SQL instance. Connection is then port-forwarded to the local machine, where a user can connect to the instance on localhost. **Corresponding workload identity has to be configured in the cluster, with service account which has Cloud SQL Client role on the given SQL instance.** Configurations in the app can be saved for practical future usage.\n\nThe app relies on local `gcloud` and `kubectl` commands which have to be configured and authenticated with the proper Google Cloud user and GKE Kubernetes cluster.\n\nimage::screenshot.png[]\n\n---\n\ntoc::[]\n\n== Install\n=== Homebrew\n[source,bash]\n----\nbrew install edosrecki/tools/google-cloud-sql\n\n# Update\nbrew upgrade google-cloud-sql\n----\n\n=== Releases\nDownload a corresponding distribution from https://github.com/edosrecki/google-cloud-sql-cli/releases[Releases] and add\nthe executable to your `PATH`.\n\n=== Build from source\nBuild the app from source by building and packaging it manually: see _Build_ and\n_Package_ sections.\n\n== Use\n=== Prerequisites\n* Install https://cloud.google.com/sdk/docs/install[`gcloud`] tool\n* Install https://kubernetes.io/docs/tasks/tools/#kubectl[`kubectl`] tool\n* Authenticate to Google Cloud: `gcloud auth login`\n* Get GKE cluster credentials: `gcloud container clusters get-credentials`\n* https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity[Configure workload identity] in GKE namespace(s) and assign _Cloud SQL Client_ role in IAM for Cloud SQL instances that you want to use\n* Enable Cloud SQL Admin API for project(s) that host Cloud SQL instances that you want to use: `gcloud services enable sqladmin.googleapis.com --project=$PROJECT`\n\n=== Run\n[source,bash]\n----\n# Help\ngoogle-cloud-sql help\n\n# Create (or override existing) configuration\ngoogle-cloud-sql configurations create\n\n# Run configuration (interactive mode)\ngoogle-cloud-sql configurations run\n# Run configuration (non-interactive mode)\ngoogle-cloud-sql configurations run $NAME\n# HINT: Add alias\nalias myDbProd=\"google-cloud-sql configurations run $NAME\"\n\n## Connect to the instance on localhost\npsql -h localhost -p $LOCAL_PORT -U $USER\n\n# Export configurations (and share :-])\ncat $(google-cloud-sql configurations path)\n----\n\n== Build\n[source,bash]\n----\nnpm run clean\nnpm run build\n----\n\n== Package\n=== Pre-configured\nPackage the app for Node.JS 18 on MacOS, Linux, and Windows.\n\n[source,bash]\n----\nnpm run bundle\n----\n\n=== Manual\nSee https://www.npmjs.com/package/pkg#targets[pkg] for details.\n\n[source,bash]\n----\nnpx pkg \u003cNODE_RANGE\u003e-\u003cPLATFORM\u003e-\u003cARCH\u003e\n----\n\n== Deploy\nTo deploy a new version of `google-cloud-sql` app, manually run a https://github.com/edosrecki/google-cloud-sql-cli/actions/workflows/continuous-deployment.yml[\"Continuous Deployment\"] worklow in GitHub Actions.\n\n== Todo\n* Add snap for Linux\n* Add completions\n* Cache user's running pods, and alert user on next startup if they were not cleaned up on previous app exit.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedosrecki%2Fgoogle-cloud-sql-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedosrecki%2Fgoogle-cloud-sql-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedosrecki%2Fgoogle-cloud-sql-cli/lists"}