steampipe plugin install hcloud

Table: hcloud_network - Query Hetzner Cloud Networks using SQL

Hetzner Cloud Networks is a service within Hetzner Cloud that allows users to manage and configure their network infrastructure. It provides a centralized way to set up and manage networks for various resources, such as virtual machines and databases. Hetzner Cloud Networks helps users to maintain the health and performance of their network resources, and take appropriate actions when predefined conditions are met.

Table Usage Guide

The hcloud_network table provides insights into networks within Hetzner Cloud. As a network administrator, explore network-specific details through this table, including network configurations, associated subnets, and IP ranges. Utilize it to uncover information about networks, such as their IP ranges, associated resources, and the overall structure of your network infrastructure.

Examples

List all networks

Explore all the networks available in your environment, ordered by their ID. This can assist in identifying and understanding the various networks in use, which is crucial for effective network management and security.

select
id,
name,
description
from
hcloud_network
order by
id;
select
id,
name,
description
from
hcloud_network
order by
id;

List all networks with the label env=prod

Explore which networks are labeled as 'production environment'. This is beneficial for managing and distinguishing your production systems from development or testing systems, ensuring the right resources are allocated and maintained.

select
id,
name,
labels
from
hcloud_network
where
labels ->> 'env' = 'prod';
select
id,
name,
labels
from
hcloud_network
where
json_extract(labels, '$.env') = 'prod';

List all servers in the network

Explore which servers are part of your network. This can help you manage and monitor your network infrastructure more effectively.

select
n.name as network_name,
s.name as server_name,
s.server_type
from
hcloud_network as n,
jsonb_array_elements(n.server_ids) as sid,
hcloud_server as s
where
s.id = sid :: int;
select
n.name as network_name,
s.name as server_name,
s.server_type
from
hcloud_network as n,
json_each(n.server_ids) as sid,
hcloud_server as s
where
s.id = CAST(sid.value as INTEGER);

Schema for hcloud_network

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
createdtimestamp with time zonePoint in time when the Network was created.
idbigint=ID of the Data Center.
ip_rangejsonbIPv4 prefix of the whole Network.
labelsjsonbUser-defined labels (key-value pairs).
nametext=Unique identifier of the Data Center.
protectionjsonbProtection configuration for the Network.
rawjsonb
routesjsonbArray of routes set in this Network.
server_idsjsonbArray of IDs of Servers attached to this Network.
subnetsjsonbArray subnets allocated in this Network.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- hcloud

You can pass the configuration to the command with the --config argument:

steampipe_export_hcloud --config '<your_config>' hcloud_network