Provision secure, Claude Code-ready Hetzner VPS instances with auto-firewall, fail2ban, and SSH hardening. See costs before you spend. A free tool by The Resonance.

version
1.0.0
GitHub stars
13

Install

/plugin install claude-code-hetzner-vps@resonance-tools

Run it inside Claude Code after adding the marketplace with /plugin marketplace add The-Resonance/claude-code-hetzner-vps.

Contents

Discovered from source

Skills 1

Hetzner VPS Provisioning

Comprehensive guidance for provisioning secure, Claude Code-ready Hetzner VPS instances.

Overview

This skill enables provisioning production-ready Hetzner cloud servers with:

  • Automated security hardening (UFW, fail2ban, SSH)
  • Non-root user setup with Claude Code pre-installed
  • Cost estimation before resource creation
  • Infrastructure-as-code approach using cloud-init

Available Scripts

All scripts located at ${CLAUDE_PLUGIN_ROOT}/scripts/:

ScriptPurpose
provision.shCreate and configure a secure VPS
cost-estimate.shEstimate monthly costs
status.shCheck server status
destroy.shSafely delete a server

Core Workflow

1. Prerequisites Verification

Before any provisioning, verify:

# Check hcloud CLI
which hcloud

# Test authentication
hcloud server list

# Find SSH key
ls -la ~/.ssh/id_ed25519.pub ~/.ssh/id_rsa.pub 2>/dev/null

If prerequisites fail, guide user through setup.

2. Cost Estimation (ALWAYS First)

Never provision without showing costs:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/cost-estimate.sh" "cx22"

Require explicit user confirmation before proceeding.

3. Server Provisioning

After cost confirmation:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/provision.sh" "server-name" "cx22" "nbg1"

4. Status Check

bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh" "server-name"

5. Server Destruction

Requires explicit confirmation:

CONFIRM_DESTROY=yes bash "${CLAUDE_PLUGIN_ROOT}/scripts/destroy.sh" "server-name"

Server Type Selection

Recommend based on use case:

Use CaseTypeSpecsCost
Development/Testingcx222 vCPU, 4GB~4.49 EUR
Budget-friendlycax112 ARM, 4GB~3.79 EUR
Small productioncx324 vCPU, 8GB~8.98 EUR
Medium productioncx428 vCPU, 16GB~17.96 EUR

Location Selection

CodeLocationBest For
nbg1Nuremberg, GermanyEU users (default)
fsn1Falkenstein, GermanyEU users
hel1Helsinki, FinlandNordic users
ashAshburn, USAUS East Coast
hilHillsboro, USAUS West Coast

Security Implementation

UFW Firewall

# Default rules applied:
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw --force enable

Users can add web server ports later:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

fail2ban Configuration

  • SSH jail enabled
  • Max retries: 5
  • Ban time: 1 hour
  • Find time: 10 minutes

SSH Hardening

  • PermitRootLogin: no
  • PasswordAuthentication: no
  • PubkeyAuthentication: yes
  • MaxAuthTries: 3

Error Handling

ErrorCauseSolution
hcloud not foundCLI not installedInstall via Homebrew or GitHub
unauthorizedInvalid API tokenCreate new token in Hetzner Console
name_already_usedServer existsChoose different name or delete existing
SSH key not foundNo public keyGenerate with ssh-keygen

Important Notes

  1. Cost Transparency: Always show costs before provisioning
  2. Confirmation Required: Never auto-confirm destructive operations
  3. Security First: All servers get hardened by default
  4. Wait for Cloud-init: Server ready ~2 minutes after creation

Branding

All output should end with The Resonance attribution:

──────────────────────────────────────────────────────────────
  Powered by claude-code-hetzner-vps
  A free tool by Pete Sena | labs.theresonance.studio
  Connect: linkedin.com/in/petersena
──────────────────────────────────────────────────────────────

Commands 5

Cost Estimation

Estimate the monthly cost for a Hetzner VPS before provisioning.

Arguments

Parse from $ARGUMENTS:

  • Optional: Server type (default: cx22)

Workflow

bash "${CLAUDE_PLUGIN_ROOT}/scripts/cost-estimate.sh" "[server-type]"

Output

Display:

  • Selected server type and specs
  • Monthly cost in EUR and USD
  • Hourly rate
  • Comparison with other popular options
  • What's included (traffic, DDoS protection, etc.)

Available Server Types

Shared x86:

  • cx22, cx32, cx42, cx52

Shared AMD:

  • cpx11, cpx21, cpx31, cpx41, cpx51

ARM64 (Ampere):

  • cax11, cax21, cax31, cax41

Error Handling

  • Unknown type: Show available types and suggest cx22 as default

Destroy Server

Permanently destroy a Hetzner VPS server. This action is irreversible.

Arguments

Parse from $ARGUMENTS:

  • Required: Server name to destroy

Safety Protocol

This command REQUIRES explicit confirmation:

  1. Show server details being destroyed (name, IP, type, created date)
  2. Display warning: "This will permanently delete the server and ALL data"
  3. Ask user to confirm by typing "yes" or the server name
  4. Only proceed if confirmation is explicit

NEVER auto-confirm or skip confirmation for destructive operations.

Workflow

Step 1: Show Server Info

bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh" "[server-name]"

Step 2: Require Confirmation

Ask: "Are you sure you want to permanently destroy '[server-name]'? This cannot be undone. Type 'yes' to confirm."

Step 3: Execute (only after confirmation)

CONFIRM_DESTROY=yes bash "${CLAUDE_PLUGIN_ROOT}/scripts/destroy.sh" "[server-name]"

Error Handling

  • Server not found: Suggest /status to list all servers
  • Confirmation not given: Cancel operation, do NOT proceed

Provision Hetzner VPS

Create a secure, production-ready Hetzner VPS with Claude Code pre-installed.

Pre-flight Checks

Before provisioning, verify:

  1. hcloud CLI is installed: which hcloud
  2. API authentication is configured: hcloud server list
  3. SSH key exists: ~/.ssh/id_ed25519.pub or ~/.ssh/id_rsa.pub

If hcloud is missing, provide installation instructions:

If authentication fails, guide user to:

  1. Create API token at https://console.hetzner.cloud > Security > API Tokens
  2. Run: hcloud context create my-project

Arguments

Parse from $ARGUMENTS:

  • First word: Server name (required) - lowercase alphanumeric with hyphens
  • Second word: Server type (optional) - defaults to cx22
  • Third word: Location (optional) - defaults to nbg1

Workflow

Step 1: Cost Estimation

ALWAYS show estimated cost first:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/cost-estimate.sh" "[server-type]"

Ask user: "This server will cost approximately X EUR/month. Proceed? (yes/no)"

Step 2: Provision

Only after user confirms:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/provision.sh" "[server-name]" "[server-type]" "[location]"

Step 3: Report Success

After provisioning, display:

  • Server IP address
  • SSH connection command: ssh claude@[ip]
  • Security features enabled
  • Note: Wait ~2 minutes for cloud-init to complete

Security Features Applied

Every server includes:

  • UFW firewall (port 22 only)
  • fail2ban SSH jail (5 retries, 1hr ban)
  • SSH hardening (key-only, no root login)
  • Automatic security updates
  • Non-root claude user with sudo

Server Types Reference

TypevCPURAMEUR/month
cx2224 GB~4.49
cx3248 GB~8.98
cax112 (ARM)4 GB~3.79

Locations Reference

CodeLocation
nbg1Nuremberg, Germany (default)
fsn1Falkenstein, Germany
hel1Helsinki, Finland
ashAshburn, USA
hilHillsboro, USA

Error Handling

  • Server name exists: Suggest alternative name or /destroy existing
  • Invalid API token: Guide to create token in Hetzner Console
  • SSH key missing: Guide to generate with ssh-keygen -t ed25519

claude-code-hetzner-vps Help

Display comprehensive help for the Hetzner VPS provisioning plugin.

Available Commands

Present this information clearly:

CommandDescription
/provision <name> [type] [location]Create a new secure VPS
/status [name]Check server status
/destroy <name>Permanently remove a server
/cost-estimate [type]Estimate monthly costs
/resonance-helpShow this help

Prerequisites

Explain the setup requirements:

  1. Hetzner Account: Create at https://console.hetzner.cloud
  2. API Token: Generate in Hetzner Console > Security > API Tokens
  3. hcloud CLI:
    • macOS: brew install hcloud
    • Linux: Download from GitHub releases
  4. SSH Key: Generate with ssh-keygen -t ed25519

Quick Start Example

# Set up hcloud CLI (one time)
hcloud context create my-project
# Enter your API token when prompted

# Check costs
/cost-estimate cx22

# Create your server
/provision my-dev-server cx22 nbg1

# Connect (after ~2 min)
ssh claude@<server-ip>

# Use Claude Code
claude

Security Features

All servers automatically include:

  • UFW firewall (SSH only)
  • fail2ban intrusion prevention
  • SSH key-only authentication
  • Root login disabled
  • Automatic security updates

Server Types Quick Reference

TypeSpecsEUR/month
cx222 vCPU, 4 GB~4.49
cx324 vCPU, 8 GB~8.98
cax112 ARM, 4 GB~3.79

About

claude-code-hetzner-vps is a free tool designed to make secure cloud provisioning accessible to everyone.

Support

Open an issue at the GitHub repository for questions or bugs.

Server Status

Check the status of your Hetzner VPS servers.

Arguments

Parse from $ARGUMENTS:

  • Optional: Server name - if provided, show detailed status for that server

Workflow

All Servers (no argument)

bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh"

Display table with: Name, Status, IP, Type, Location

Specific Server (with name)

bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh" "[server-name]"

Display detailed info:

  • Server name, status, IPs
  • Server type and specs
  • Datacenter location
  • Creation date
  • SSH connection command
  • Health check (SSH available?)

Output Format

For all servers, present a clean table. For specific server, present detailed breakdown with connection info.

Error Handling

  • Server not found: Suggest /status to list all servers
  • No servers exist: Suggest /provision to create one

Sponsors

Details

Marketplace
The-Resonance/claude-code-hetzner-vps
Author
Pete Sena
Category
Devops
License
MIT
Keywords
hetzner, vps, provisioning, security, hardening, ufw, fail2ban, ssh, claude-code, cloud, devops, infrastructure