Skip to content

weiland/hetzner-cloud-init

Repository files navigation

cloud-init for a quick bachelor project server on Hetzner Cloud

Run following command to create a new server using the hcloud cli:

hcloud server create --name bp --location nbg1 --image ubuntu-20.04 --type cpx31 \
  --ssh-key 2754649,2765746 --user-data-from-file ./config_minimal.yml

or with curl (and jq):

curl \
  -X POST -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"name": "bp", "location": "nbg1", "image": "ubuntu-20.04", "server_type": "cx21", "ssh_keys": ["pw@fruitbook_for_server", "fb_rsa"], "user_data": "#include\nhttps://raw.githubusercontent.com/weiland/hetzner-cloud-init-bp/main/config_minimal.yml"}' \
  https://api.hetzner.cloud/v1/servers | \
  jq .server.public_net.ipv4.ip

Make sure to have an API Token with write access at $TOKEN ( set TOKEN '...').

Local:

scp internal.sh bp:./internal.sh

On server:

sh internal.sh

If working with the packed tar:

tar xf lb.tar.gz lecturebox

After work is done, the server can be deleted:

hcloud server delete bp