Cloud-init is a tool that automates the initial setup of a cloud instance, allowing you to configure network settings, set up users and permissions, install packages, and run scripts. Cloud-config is a format for writing configuration files that can be used with cloud-init.
Supported Operating Systems
Cloud-init is supported on all distributions provided by Tilaa, including:
- Alma linux
- Debian
- Rocky Linux
- Ubuntu
- Arch Linux
- CentOS
Example Cloud-config File
Here is an example of a cloud-config file that sets up a user, installs some packages, and runs a script:
#cloud-config
users:
- name: myuser
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6...
packages:
- apache2
- mysql-server
runcmd:
- [ bash, -c, "echo 'Hello World!'" ]
Using Cloud-init
To use cloud-init, simply create a cloud-config file and pass it to the cloud-init tool when you launch your instance. You can also specify user data in the metadata service.
Example Use Cases
Here are some example use cases for cloud-init:
- Automating the initial setup of a web server
- Configuring network settings and firewall rules
- Installing packages and running scripts
Cloud-init Documentation
For more information on cloud-init, including documentation and examples, please see the official cloud-init documentation.