NAME
WWW::Hetzner::Cloud - Perl client for Hetzner Cloud API
VERSION
version 0.002
SYNOPSIS
use WWW::Hetzner::Cloud;
my $cloud = WWW::Hetzner::Cloud->new(
token => $ENV{HETZNER_API_TOKEN},
);
# List servers
my $servers = $cloud->servers->list;
# Create server
my $server = $cloud->servers->create(
name => 'my-server',
server_type => 'cx23',
image => 'debian-13',
location => 'fsn1',
ssh_keys => ['my-key'],
);
# Delete server
$cloud->servers->delete($server->{id});
DESCRIPTION
This module provides access to the Hetzner Cloud API for managing cloud servers, DNS zones, networks, volumes, and other resources.
RESOURCES
Compute
servers - Cloud servers (create, delete, power on/off, reboot, rebuild, rescue)
server_types - Available server types
images - OS images
ssh_keys - SSH keys
placement_groups - Placement groups for server distribution
Networking
networks - Private networks with subnets and routes
firewalls - Firewall rules and application
floating_ips - Reassignable public IPs
primary_ips - Primary IPs for servers
load_balancers - Load balancers with targets and services
Storage
volumes - Block storage volumes
DNS
zones - DNS zones and records
Security
certificates - TLS certificates (managed or uploaded)
Info
locations - Locations (fsn1, nbg1, hel1, ash, hil, sin)
datacenters - Datacenters
token
Hetzner Cloud API token. Defaults to HETZNER_API_TOKEN environment variable.
base_url
Base URL for the Cloud API. Defaults to https://api.hetzner.cloud/v1.
servers
Returns a WWW::Hetzner::Cloud::API::Servers instance for managing cloud servers.
server_types
Returns a WWW::Hetzner::Cloud::API::ServerTypes instance for listing server types.
images
Returns a WWW::Hetzner::Cloud::API::Images instance for listing OS images.
ssh_keys
Returns a WWW::Hetzner::Cloud::API::SSHKeys instance for managing SSH keys.
locations
Returns a WWW::Hetzner::Cloud::API::Locations instance for listing locations.
datacenters
Returns a WWW::Hetzner::Cloud::API::Datacenters instance for listing datacenters.
zones
Returns a WWW::Hetzner::Cloud::API::Zones instance for managing DNS zones.
volumes
Returns a WWW::Hetzner::Cloud::API::Volumes instance for managing block storage volumes.
networks
Returns a WWW::Hetzner::Cloud::API::Networks instance for managing private networks.
firewalls
Returns a WWW::Hetzner::Cloud::API::Firewalls instance for managing firewalls.
floating_ips
Returns a WWW::Hetzner::Cloud::API::FloatingIPs instance for managing floating IPs.
primary_ips
Returns a WWW::Hetzner::Cloud::API::PrimaryIPs instance for managing primary IPs.
load_balancers
Returns a WWW::Hetzner::Cloud::API::LoadBalancers instance for managing load balancers.
certificates
Returns a WWW::Hetzner::Cloud::API::Certificates instance for managing TLS certificates.
placement_groups
Returns a WWW::Hetzner::Cloud::API::PlacementGroups instance for managing placement groups.
DNS EXAMPLE
# List DNS zones
my $zones = $cloud->zones->list;
# Create a zone
my $zone = $cloud->zones->create(name => 'example.com');
# Add DNS records
my $rrsets = $zone->rrsets;
$rrsets->add_a('www', '203.0.113.10');
$rrsets->add_cname('blog', 'www.example.com.');
$rrsets->add_mx('@', 'mail.example.com.', 10);
LOGGING
WWW::Hetzner::Cloud uses Log::Any for logging via WWW::Hetzner::Role::HTTP. This allows you to integrate with any logging framework of your choice.
Log Levels Used
debug - Request URLs, bodies, response status
info - Successful API calls (method, path, status)
error - API errors before croak
Enabling Logging
By default, logs are discarded. To see them, configure a Log::Any adapter:
# Simple: output to STDERR
use Log::Any::Adapter ('Stderr');
# With minimum level
use Log::Any::Adapter ('Stderr', log_level => 'debug');
# To a file
use Log::Any::Adapter ('File', '/var/log/hetzner.log');
# Integration with Log::Log4perl
use Log::Log4perl;
Log::Log4perl->init('log4perl.conf');
use Log::Any::Adapter ('Log4perl');
# Integration with Log::Dispatch
use Log::Dispatch;
my $dispatcher = Log::Dispatch->new(...);
use Log::Any::Adapter ('Dispatch', dispatcher => $dispatcher);
See Log::Any::Adapter for all available adapters.
SEE ALSO
WWW::Hetzner, WWW::Hetzner::Role::HTTP
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-hetzner/issues.
IRC
Join #kubernetes on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.