LinuxCommandLibrary

gcloud-compute

Google Compute Engine resource management

TLDR

List VM instances

$ gcloud compute instances list
copy
Create instance
$ gcloud compute instances create [name] --zone=[zone]
copy
SSH to instance
$ gcloud compute ssh [instance] --zone=[zone]
copy
Stop instance
$ gcloud compute instances stop [name] --zone=[zone]
copy
List disks
$ gcloud compute disks list
copy

SYNOPSIS

gcloud compute resource command [options]

DESCRIPTION

gcloud compute is the command-line interface for Google Compute Engine, Google's Infrastructure-as-a-Service offering. It provides complete control over virtual machines, persistent disks, networks, load balancers, and other infrastructure primitives.
The instances subcommand handles VM lifecycle operations including creation with customizable machine types, starting and stopping instances, and deletion. Network resources like VPCs, subnets, firewall rules, and routes are managed through their respective subcommands.
Special convenience features include built-in SSH access via gcloud compute ssh, which automatically manages SSH keys and connection details, and gcloud compute scp for secure file transfers. The command group supports advanced features like custom images, snapshots, instance groups, and managed instance groups for autoscaling. All operations respect zones and regions, which must be specified either per-command or via configuration defaults.

PARAMETERS

RESOURCE

Resource type: instances, disks, networks, etc.
instances CMD
VM instance management.
disks CMD
Persistent disk operations.
ssh INSTANCE
SSH into instance.
scp SRC DEST
Copy files to/from instance.
--zone ZONE
Compute zone.
--help
Display help information.

CAVEATS

Resources incur costs. Zone selection affects availability. Some operations take time.

HISTORY

gcloud compute is part of the Google Cloud SDK for managing Compute Engine, Google's Infrastructure-as-a-Service offering for running virtual machines.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community