← Back to CLIs
Melvynx

gcloud

Google Cloud CLI - manage Compute Engine, Cloud Run, Cloud Functions, Cloud SQL, Storage. Use when user mentions 'gcloud', 'google cloud', 'gcp', or wants to interact with Google Cloud Platform.

Install

$ npx api2cli install gcloud

Details

Skill type: Official CLI
Auth type: bearer
Version: 1.0.0
Author: Melvynx
Views: 0

README

gcloud

Setup

brew install google-cloud-sdk

Verify installation:

gcloud --version

Use --format=json for machine-readable output.

Authentication

gcloud auth login

For application default credentials:

gcloud auth application-default login

Resources

Configuration

CommandDescription
gcloud config set project <project-id>Set the active project
gcloud config get projectGet the active project
gcloud config set compute/region <region>Set default compute region
gcloud config set compute/zone <zone>Set default compute zone
gcloud config listList all active configuration properties
gcloud config configurations listList all named configurations
gcloud config configurations activate <name>Switch to a named configuration

Projects

CommandDescription
gcloud projects listList all accessible projects
gcloud projects describe <project-id>Show project details
gcloud projects create <project-id>Create a new project

Compute Engine

CommandDescription
gcloud compute instances listList all VM instances
gcloud compute instances create <name> --machine-type=e2-mediumCreate a VM instance
gcloud compute instances start <name>Start an instance
gcloud compute instances stop <name>Stop an instance
gcloud compute instances delete <name>Delete an instance
gcloud compute ssh <name>SSH into an instance

Cloud Run

CommandDescription
gcloud run deploy <service> --source .Deploy from source code
gcloud run deploy <service> --image <image>Deploy a container image
gcloud run deploy <service> --source . --allow-unauthenticatedDeploy with public access
gcloud run services listList all Cloud Run services
gcloud run services describe <service>Show service details
gcloud run services delete <service>Delete a service

Cloud Functions

CommandDescription
gcloud functions deploy <name> --runtime nodejs20 --trigger-httpDeploy an HTTP function
gcloud functions deploy <name> --trigger-topic <topic>Deploy with Pub/Sub trigger
gcloud functions listList all functions
gcloud functions describe <name>Show function details
gcloud functions delete <name>Delete a function
gcloud functions logs read <name>Read function logs

Cloud SQL

CommandDescription
gcloud sql instances listList all Cloud SQL instances
gcloud sql instances describe <name>Show instance details
gcloud sql instances create <name> --database-version=POSTGRES_15Create a PostgreSQL instance
gcloud sql databases list --instance=<name>List databases in an instance
gcloud sql connect <name> --user=postgresConnect to an instance

Cloud Storage

CommandDescription
gcloud storage lsList all buckets
gcloud storage ls gs://<bucket>List objects in a bucket
gcloud storage cp <file> gs://<bucket>/Upload a file
gcloud storage cp gs://<bucket>/<object> .Download a file
gcloud storage buckets create gs://<bucket>Create a bucket

App Engine

CommandDescription
gcloud app deployDeploy application to App Engine
gcloud app browseOpen deployed app in browser
gcloud app logs tailTail application logs

Global Flags

FlagDescription
--format=jsonOutput as JSON
--format=tableOutput as table
--project <id>Override active project
--quietSuppress interactive prompts
--verbosity <level>Set log verbosity (debug, info, warning, error)
Sponsors