
claude-code-hetzner-vps
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-toolsRun it inside Claude Code after adding the marketplace with /plugin marketplace add The-Resonance/claude-code-hetzner-vps.
Contents
Discovered from sourceSkills 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/:
| Script | Purpose |
|---|---|
provision.sh | Create and configure a secure VPS |
cost-estimate.sh | Estimate monthly costs |
status.sh | Check server status |
destroy.sh | Safely 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 Case | Type | Specs | Cost |
|---|---|---|---|
| Development/Testing | cx22 | 2 vCPU, 4GB | ~4.49 EUR |
| Budget-friendly | cax11 | 2 ARM, 4GB | ~3.79 EUR |
| Small production | cx32 | 4 vCPU, 8GB | ~8.98 EUR |
| Medium production | cx42 | 8 vCPU, 16GB | ~17.96 EUR |
Location Selection
| Code | Location | Best For |
|---|---|---|
| nbg1 | Nuremberg, Germany | EU users (default) |
| fsn1 | Falkenstein, Germany | EU users |
| hel1 | Helsinki, Finland | Nordic users |
| ash | Ashburn, USA | US East Coast |
| hil | Hillsboro, USA | US 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
| Error | Cause | Solution |
|---|---|---|
hcloud not found | CLI not installed | Install via Homebrew or GitHub |
unauthorized | Invalid API token | Create new token in Hetzner Console |
name_already_used | Server exists | Choose different name or delete existing |
SSH key not found | No public key | Generate with ssh-keygen |
Important Notes
- Cost Transparency: Always show costs before provisioning
- Confirmation Required: Never auto-confirm destructive operations
- Security First: All servers get hardened by default
- 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:
- Show server details being destroyed (name, IP, type, created date)
- Display warning: "This will permanently delete the server and ALL data"
- Ask user to confirm by typing "yes" or the server name
- 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
/statusto 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:
hcloudCLI is installed:which hcloud- API authentication is configured:
hcloud server list - SSH key exists:
~/.ssh/id_ed25519.pubor~/.ssh/id_rsa.pub
If hcloud is missing, provide installation instructions:
- macOS:
brew install hcloud - Linux: Download from https://github.com/hetznercloud/cli/releases
If authentication fails, guide user to:
- Create API token at https://console.hetzner.cloud > Security > API Tokens
- 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
claudeuser with sudo
Server Types Reference
| Type | vCPU | RAM | EUR/month |
|---|---|---|---|
| cx22 | 2 | 4 GB | ~4.49 |
| cx32 | 4 | 8 GB | ~8.98 |
| cax11 | 2 (ARM) | 4 GB | ~3.79 |
Locations Reference
| Code | Location |
|---|---|
| nbg1 | Nuremberg, Germany (default) |
| fsn1 | Falkenstein, Germany |
| hel1 | Helsinki, Finland |
| ash | Ashburn, USA |
| hil | Hillsboro, USA |
Error Handling
- Server name exists: Suggest alternative name or
/destroyexisting - 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:
| Command | Description |
|---|---|
/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-help | Show this help |
Prerequisites
Explain the setup requirements:
- Hetzner Account: Create at https://console.hetzner.cloud
- API Token: Generate in Hetzner Console > Security > API Tokens
- hcloud CLI:
- macOS:
brew install hcloud - Linux: Download from GitHub releases
- macOS:
- 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
| Type | Specs | EUR/month |
|---|---|---|
| cx22 | 2 vCPU, 4 GB | ~4.49 |
| cx32 | 4 vCPU, 8 GB | ~8.98 |
| cax11 | 2 ARM, 4 GB | ~3.79 |
About
claude-code-hetzner-vps is a free tool designed to make secure cloud provisioning accessible to everyone.
- Website: https://labs.theresonance.studio
- Author: Pete Sena (https://linkedin.com/in/petersena)
- Repository: https://github.com/The-Resonance/claude-code-hetzner-vps
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
/statusto list all servers - No servers exist: Suggest
/provisionto 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