OneQode Documentation
FeedbackSupportStatus
  • 👋Welcome
  • Compute
    • SSH keys
      • Create an SSH key
      • Add your SSH key
    • Instances
      • Create an instance
      • Control an instance
      • Delete an instance
      • Configurations / Flavors
    • Cloud-init
  • Storage
    • Images
      • Create an image
      • Create a snapshot
    • Local storage
    • Volumes
      • Automatically mount a volume
  • Network
    • Floating IPs
    • BGP Communities
  • API
    • API overview
    • Get an API key
    • Install the CLI client
    • Server quick start
  • Dedicated Servers
    • Installing an OS remotely
Powered by GitBook
On this page
  • What is cloud-init?
  • What can you do with it?
  • Add new users and SSH keys
  • Configure networking
  • Run scripts or commands at launch
  • Where to learn more
  • Official documentation
  • Video overview

Was this helpful?

  1. Compute

Cloud-init

A brief overview of cloud-init in OCS

PreviousConfigurations / FlavorsNextImages

Last updated 2 years ago

Was this helpful?

What is cloud-init?

is a tool used to customize cloud instances at launch. It's widely used across cloud providers, including OneQode Cloud.

In , all default images support cloud-init — so if you enter data in the "cloud-init user data" field when you , it will execute on boot and preconfigure your instance with your specified settings.

What can you do with it?

Here are some examples of things you can configure at boot time with cloud-init:

Below is the cloud-init user data for each of the above examples.

Add new users and SSH keys

#cloud-config
users:
  - name: my-user
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYHNcYKL...

Configure networking

#cloud-config
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true

Run scripts or commands at launch

#cloud-config
runcmd:
  - echo "Hello World"
  - apt-get update
  - apt-get install -y apache2

Cloud-init user data requires valid YAML syntax

If a value you are entering contains colons or new lines in particular, you can run into problems.

Where to learn more

Official documentation

Cloud-init has many options available to customize your cloud instances.

Video overview

We recommend this excellent presentation by James Nugent:

Check out the to see how these are implemented in practise, and if you're dealing with multiline content, check out this resource on .

Check out the to learn more.

official cloud-init examples
YAML multiline syntax
official cloud-init documentation
Cloud-init
create an instance
Add new users and SSH keys
Configure networking
Run scripts or commands