Cloud-init

Ready-made operating system images that support cloud-init technology are auto-configured using the Cloud-init software.

In addition to standard actions such as network configuration, disk setup, and SSH keys, it allows for initial system configuration using metadata passed to the virtual machine through the metadata API, specifically the user-data field.


Setting up user-data for the server

The user-data field can be set in three ways:

  • When creating a virtual machine using the EC2 API (RunInstances method)
  • When creating a virtual machine using the form in the panel
  • By editing in the panel, for an existing virtual machine

User-data format for cloud-init

The configuration data passed to cloud-init is in YAML file format, starting with the line #cloud-config. This is followed by directives specifying actions to be performed by cloud-init. The full list of directives can be found on the project page.


Examples of cloud-init applications

Automatic update after installation

#cloud-config
package_upgrade: true

Setting the hostname

#cloud-config
hostname: mynewhostname123
fqdn: mynewhostname123.e24cloud.com
manage_etc_hosts: true

Automatic update, package installation, and configuration files

#cloud-config
package_upgrade: true

packages:
 - rng-tools

write_files:
  - content: |
      HRNGDEVICE=/dev/hwrng
    path: /etc/default/rng-tools
    permissions: '0644'