hcloud
Manage Hetzner Cloud resources
TLDR
Show available commands and flags
Display help
Show available commands and flags for hcloud contexts
SYNOPSIS
hcloud [GLOBAL-OPTIONS] COMMAND [SUBCOMMAND] [FLAGS]
PARAMETERS
GLOBAL-OPTIONS
Options that apply to the hcloud command itself, regardless of the subcommand. These are typically placed immediately after hcloud.
--token <TOKEN>
Explicitly specifies the Hetzner Cloud API token for authentication. This overrides tokens from configuration files or environment variables.
--output <FORMAT>
Defines the output format for the command's results. Common formats include columns (default, human-readable table), json, and yaml. Useful for scripting and programmatic parsing.
--no-headers
Suppresses column headers when using the columns output format, resulting in raw data only.
--api-url <URL>
Specifies a custom API endpoint URL, typically used for testing or specific regional endpoints if applicable.
--debug
Enables verbose debug output, showing detailed information about API requests and responses, useful for troubleshooting.
--verbose
Increases verbosity of output, providing more detailed information about command execution and progress.
--help, -h
Displays help information for the specified command or subcommand, detailing available options and usage examples.
--version
Prints the current version of the hcloud CLI tool.
COMMAND
Refers to a top-level resource or service within Hetzner Cloud that you wish to interact with, such as server, volume, network, firewall, load-balancer, ssh-key, image, etc. Each command has its own set of subcommands and flags.
SUBCOMMAND
Refers to a specific action to be performed on the designated COMMAND (resource). Examples include list (to view resources), create (to provision a new resource), delete (to remove a resource), update (to modify resource properties), attach, detach, poweron, rebuild, etc.
FLAGS
Options specific to a COMMAND or SUBCOMMAND, used to specify parameters for an action. Common examples include --name <RESOURCE_NAME>, --type <RESOURCE_TYPE>, --id <RESOURCE_ID>, --location <DATACENTER>, --image <IMAGE_NAME_OR_ID>, --label <KEY=VALUE>, and --protection <enable|disable>.
DESCRIPTION
The hcloud command-line interface (CLI) is the official tool for interacting with the Hetzner Cloud API. It provides a powerful and flexible way to manage all your Hetzner Cloud resources directly from your terminal, without needing to access the web interface. Users can provision, configure, and monitor servers, networks, volumes, firewalls, load balancers, and more. It is particularly useful for scripting, automation, and integrating Hetzner Cloud operations into CI/CD pipelines, enabling infrastructure as code practices. The CLI supports various output formats, including human-readable tables, JSON, and YAML, making it easy to parse and integrate its output with other tools.
CAVEATS
Authentication with the Hetzner Cloud API requires a valid API token. This token should be kept secure and can be provided via a configuration file (~/.config/hcloud/cli.toml), an environment variable (HCLOUD_TOKEN), or directly using the --token flag.
Users should be mindful of Hetzner Cloud's API rate limits, as excessive requests in a short period can lead to temporary blocking of requests.
Commands that delete resources are irreversible; extreme caution is advised, especially when integrating deletion tasks into automated scripts.
Many commands operate on resource IDs (e.g., server ID, volume ID), which typically need to be retrieved first using a list subcommand.
CONFIGURATION & AUTHENTICATION
The hcloud CLI can be configured through a TOML file located at ~/.config/hcloud/cli.toml (or $XDG_CONFIG_HOME/hcloud/cli.toml). This file is typically used to store the default API token and other global settings. The API token can also be passed via the HCLOUD_TOKEN environment variable or directly using the --token global flag. The precedence for API token lookup is: --token flag > HCLOUD_TOKEN environment variable > configuration file.
AUTOMATION & SCRIPTING
Given its command-line nature and robust support for structured output formats like JSON and YAML, hcloud is an exceptional tool for automating cloud infrastructure management. It can be seamlessly integrated into shell scripts, CI/CD pipelines, and configuration management tools (like Ansible or Terraform via their respective Hetzner Cloud providers). This capability facilitates programmatic control over cloud resources, enabling infrastructure as code practices, repeatable deployments, and dynamic scaling operations.
HISTORY
The hcloud CLI tool was developed by Hetzner Online GmbH as the official command-line interface for their Hetzner Cloud platform. Written in Go, it leverages the Hetzner Cloud API to provide a comprehensive management tool. Since its initial release (around 2017-2018), it has been actively maintained and continuously updated to support new Hetzner Cloud features, resources, and API versions, reflecting the platform's ongoing development and expansion.