Using cloud-init on Digital Ocean

August 01, 2019

You may have noticed that Digital Ocean has a spot for Cloud Config files. This is great if you want your new droplets to come up with user accounts already setup for you. I’ve been doing this for a long time in order to add my user and SSH key to that user. Here’s a quick excerpt to get you going.

  - name: livearchivist
    groups: sudo
    shell: /bin/bash
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
      - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAlJ53sS9cmQb9x9tENuOiuNCt4F1Of+C3ig4/U9NtSQ

That’s all it takes to automatically have a user created for you!