Cloud-init scripts
A cloud-init script configures a new cloud server during its first startup. Coolify can send one as provider user data when creating a Hetzner, DigitalOcean, or Vultr server.
Use a script to perform repeatable initialization such as creating files, installing packages, or applying operating-system settings before Coolify validates the server.
A broken cloud-init script can leave a new server incomplete or unreachable. Test with a temporary server and avoid changing the SSH access Coolify requires.
Only team administrators and owners can create, update, or delete cloud-init scripts. Scripts belong to the active team.
Create a reusable script
Open Cloud-Init Scripts
Open Keys & Tokens in the Coolify sidebar, then select Cloud-Init Scripts.
Add the script
- Select + Add.
- Enter a descriptive Script Name.
- Enter the cloud-config YAML under Script Content.
- Select Create Script.
The name and script content are required. Coolify validates that the content is valid cloud-init YAML before saving it.
For example:
#cloud-config
package_update: true
packages:
- curl
write_files:
- path: /etc/motd
content: |
Managed by CoolifyCloud-init features vary by Linux image and provider. Check the image's cloud-init support before relying on a module.
Use a script while provisioning
- Open Servers and select + Add.
- Choose Hetzner, DigitalOcean, or Vultr.
- Complete the provider's server settings.
- Open the advanced options.
- Select the saved cloud-init script.
- Review the remaining options, then select Buy & Create Server.
You can also enter a script directly in the provisioning form. Enable Save this script for later use if it should be added to the team's reusable scripts.
The script is sent only when the provider creates the server. It does not run when you validate a server or add an existing server manually.
Editing a saved script changes future provisioning requests that use it. It does not rerun cloud-init or modify servers that were already created.
Edit or delete a script
Open Keys & Tokens > Cloud-Init Scripts, then select a script.
- Change Script Name or Script Content, then select Save.
- Select Delete, enter the requested confirmation, then select Delete Script to remove it permanently.
Deleting a saved script does not affect servers that were already provisioned with it.
Troubleshooting
If a new server is not configured as expected:
-
Check the provider console to confirm the server was created and is running.
-
Open the server console and inspect the cloud-init status:
cloud-init status --long -
Review the cloud-init logs:
sudo less /var/log/cloud-init.log sudo less /var/log/cloud-init-output.log -
Correct the saved script and provision a temporary server to test it again.
Cloud-init normally runs during the machine's first boot. Changing the saved template does not repair an existing machine.
