← Back to tools

Hetzner Cloud CLI

Manage Hetzner Cloud resources from the command line

Cloud & Services linuxmacoswindows Go MIT

Description

hcloud is the official command-line interface for Hetzner Cloud. It lets you create and manage servers, volumes, networks, firewalls, load balancers, and other Hetzner Cloud resources directly from the terminal. It provides fast, scriptable access to the Hetzner Cloud API.

Install

homebrewbrew install hcloud

AI Summary

Official Hetzner Cloud CLI for managing servers, volumes, networks, firewalls, load balancers, and other cloud resources from the terminal.

Capabilities

  • + Create, list, and manage cloud servers
  • + Manage volumes, snapshots, and backups
  • + Configure networks, subnets, and firewalls
  • + Manage SSH keys and server access
  • + Create and manage load balancers
  • + Output in JSON or table format for scripting

Use When

  • Managing Hetzner Cloud infrastructure from the terminal
  • Scripting server provisioning and teardown workflows
  • Need quick server creation without the web console
  • Automating Hetzner Cloud operations in CI/CD

Avoid When

  • x Not using Hetzner Cloud as your provider
  • x Need multi-cloud infrastructure management (use Pulumi or Terraform)
  • x Want a graphical interface for cloud management

Usage Patterns

Create a new server

hcloud server create --name my-server --type cx22 --image ubuntu-24.04 --ssh-key my-key

Creates a CX22 server with Ubuntu 24.04 and an SSH key

List all servers with details

hcloud server list -o columns=id,name,status,ipv4

Lists servers showing only selected columns

SSH into a server

hcloud server ssh my-server

Opens an SSH connection to the named server

Create a snapshot

hcloud server create-image --type snapshot my-server

Creates a snapshot of the specified server

Input / Output

stdin: Accepts interactive input for context setup and confirmations
stdout: Resource listings, server details, and operation results
stderr: Error messages and API errors
Exit codes:
0 Success
1 General error

Typical Pipelines

hcloud server list -o json | jq '.[].public_net.ipv4.ip' to extract all server IPs
hcloud server create --name test --type cx22 --image ubuntu-24.04 && hcloud server ssh test to create and connect
hcloud server list -o noheader -o columns=name | xargs -I {} hcloud server delete {} to delete all servers

Related Tools

View AGENTS.md for Hetzner Cloud CLI