Using Cloud-init Scripts¶
When ordering a new server or reinstalling an operating system, you can use Cloud-init scripts for automatic server configuration. This feature allows you to automate initial system setup immediately after OS installation.
The Cloud init script field is located in the Advanced options section when:
- Ordering a new server;
- Reinstalling the operating system.
Attention
The field appears only after selecting an operating system.
Script Format¶
The Cloud-init script must be written in YAML format, adhering to the following requirements:
- Strict indentation (use spaces, not tabs);
- Start with the directive
#cloud-config
; - Follow YAML syntaxю
Example Script¶
#cloud-config
users:
- name: demo
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCv60WjxoM39LgPDbiW7ne3gu18q0NIVv0RE6rDLNal1quXZ3nqAlANpl5qmhDQ+GS/sOtygSG4/9aiOA4vXO54k1mHWL2irjuB9XbXr00+44vSd2q/vtXdGXhdSMTf4/XK17fjKSG/9y3yD6nml6q9XgQxx9Vf/IkaKdlK0hbC1ds0+8h83PTb9dF3L7hf3Ch/ghvj5++tWJFdFeG+VI7EDuKNA4zL8C5FdYYWFA88YAmM8ndjA5qCjZXIIeZvZ/z9Kpy6DL0QZ8T3NsxRKapEU3nyiIuEAmn8fbnosWcsovw0IS1Hz6HsjYo4bu/gA82LWt3sdRUBZ/7ZsVD3ELip [email protected]
How to Use¶
- Select the operating system;
- Expand the Advanced options section;
- Insert your YAML script in the Cloud init script field;
- Ensure proper indentation and syntax;
- Continue with the ordering or reinstallation process.
Attention
It is critically important to maintain correct indentation in YAML format! Without proper indentation, the script will not work correctly.
Cloud-init Capabilities¶
Using Cloud-init scripts allows you to: - Create users and groups; - Configure SSH keys; - Install packages; - Configure network interfaces; - Execute arbitrary commands at first boot; - Mount additional disks.
Information
Detailed documentation on Cloud-init can be found on the official website.
Some of the content on this page was created or translated using AI.