Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.42 KB

01_hetzner.md

File metadata and controls

54 lines (36 loc) · 1.42 KB

CloudInit with Hetzner

based on this tutorial

Create A Server

  • create server A simple instance is enough for this tutorial (2gb RAM, ARM)
  • debian as image choose a debian based distro as image -Alt text paste your cloud config and finish the setup

Create SSH Key Pair

  • create ssh key pair ssh-keygen -b 4096
  • copy pub key to file config see Config File
    MacOS: cat ~/.ssh/my_pub_key | pbcopy
    Linux: cat ~/.ssh/my_pub_key | xclip -selection clipboard

Config from URL

  • public file
#include
https://URLtoCode/config.yaml
  • example usage for this repo
#include
https://raw.githubusercontent.com/EricKrg/cloudinit-breakout-un-deRSE23/main/hetzner_cloudinit_example.yml
  • private file with JWT, will also work with basic HTTP Auth
curl \
	-X POST \
	-H "Authorization: Bearer $API_TOKEN" \
	-H "Content-Type: application/json" \
	-d '{"image":"ubuntu-22.04","location":"nbg1","name":"my-server","server_type":"cx11","user_data":"#include\nhttps://URLtoCode/config.yaml"}' \
  	'https://api.hetzner.cloud/v1/servers'

Test the setup

  • test the setup by trying to connect to the created instance via ssh ssh <ssh-user>@<server-ip>

example usage: ssh ci@65.108.253.152