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, descriptionfrom hcloud_networkorder by id;
select id, name, descriptionfrom hcloud_networkorder 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, labelsfrom hcloud_networkwhere labels ->> 'env' = 'prod';
select id, name, labelsfrom hcloud_networkwhere 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_typefrom hcloud_network as n, jsonb_array_elements(n.server_ids) as sid, hcloud_server as swhere s.id = sid :: int;
select n.name as network_name, s.name as server_name, s.server_typefrom hcloud_network as n, json_each(n.server_ids) as sid, hcloud_server as swhere s.id = CAST(sid.value as INTEGER);
Schema for hcloud_network
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
created | timestamp with time zone | Point in time when the Network was created. | |
id | bigint | = | ID of the Data Center. |
ip_range | jsonb | IPv4 prefix of the whole Network. | |
labels | jsonb | User-defined labels (key-value pairs). | |
name | text | = | Unique identifier of the Data Center. |
protection | jsonb | Protection configuration for the Network. | |
raw | jsonb | ||
routes | jsonb | Array of routes set in this Network. | |
server_ids | jsonb | Array of IDs of Servers attached to this Network. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
subnets | jsonb | Array 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