![Forrest logo](/images/logo.png)
hcloud:tldr:ca53b
The hcloud context
command is used in the Hetzner Cloud CLI (Command Line Interface) tool to manage different API access contexts.
An API access context contains the authentication details required to communicate with the Hetzner Cloud API. By using different contexts, you can easily switch between different API access configurations for different projects or accounts without manually specifying the authentication details each time.
When you execute the hcloud context
command without any additional parameters, it will display the current active context along with its details, including the name, token, and endpoint.
The command also provides several subcommands to manage and manipulate API access contexts. Some of the common subcommands include:
-
hcloud context create
: This subcommand is used to create a new API access context. It prompts you to enter a name for the context and the authentication token required to access the Hetzner Cloud API. Once a context is created, it can be activated using thehcloud context use
subcommand. -
hcloud context use
: This subcommand is used to activate a particular API access context. It takes the name of a context as an argument and sets it as the active context, allowing subsequent API requests to use the specified access configuration. -
hcloud context list
: This subcommand lists all the available API access contexts, displaying their names and associated details such as the token and endpoint. -
hcloud context delete
: This subcommand is used to delete a specific API access context. It takes the name of a context as an argument and permanently removes it from the list of available contexts.
By utilizing the hcloud context
command and its subcommands, you can easily manage your API access configurations and switch between them as needed, simplifying the process of interacting with the Hetzner Cloud API.