CoreWeave
Search
K

Cloud-init

Learn more about CloudInit for Virtual Servers.
Cloud-init is a tool used to configure aspects of Virtual Servers at the time of instance boot. At that time, cloud-init will identify where it is running (in this case, CoreWeave Cloud), will read any provided metadata from the cloud environment, and then initialize the system on which it is running according to that metadata.
Cloud-init is frequently used to do things like:
🔑
Automatically configure SSH access keys
🗄
Set up storage or network devices
🧑
Configure additional user accounts
📜
Run custom scripts on system initialization
Any parameters given to cloud-init through the implementation options below will use the standard cloud-init configurations.
Additional Resources
See the cloud-init website for examples of cloud-init, and for usage reference.
Cloud UI
CLI
Terraform

Deployment method: CoreWeave Cloud UI

Cloud-init configuration options must be configured in the YAML editor. All cloud-init configuration options are held within the cloudInit stanza:
cloudInit: |
write_files:
- content: |
#!/bin/bash
echo "Hello world!"
path: /home/myuser/script.sh
permissions: `0744`
owner: myuser:myuser
package_update: true
packages:
- curl
- git
runcmd:
- [df, -h]
- [git, version]
- [curl, --version]
- [bash, /home/myuser/script.sh]
In the example above, cloud-init is configured to create a file with a simple script that prints the string Hello world!. It's given a permission mask of 0744, and is owned by myuser.
Additionally, a package update command will be run on the machine. Then, the curl and git packages will be installed on the machine.
Lastly, the system will run the commands given under the runcmd list:
  1. 1.
    First, the amount of free disk space will be printed in human-readable format (df -h).
  2. 2.
    Then, the version of git installed on the system earlier will be output (git version).
  3. 3.
    Similarly, the version of curl installed on the system will be printed (curl --version).
  4. 4.
    Finally, the script created at the top of the block under write_files will be passed to bash to run (bash /home/myuser/script.sh).

Deployment method: Kubernetes CLI

Cloud-init parameters are configured for Virtual Servers using the cloudInit field.
cloudInit
String
Define cloud-init parameter
cloudInit: |
# Write a simple script that outputs "Hello world!"
write_files:
- content: |
#!/bin/bash
echo "Hello world!"
path: /home/myuser/script.sh
permissions: '0744'
owner: myuser:myuser
# Update packages
package_update: true
# Install curl and git packages
packages:
- curl
- git
# Run additional commands
runcmd:
- [df, -h]
- [git, version]
- [curl, --version ]
- [bash, /home/myuser/script.sh]
In the example given above, cloud-init is given a few parameters, which accomplish the following:
  1. 1.
    First, the amount of free disk space will be printed in human-readable format (df -h).
  2. 2.
    Then, the version of git installed on the system earlier will be output (git version).
  3. 3.
    Similarly, the version of curl installed on the system will be printed (curl --version).
  4. 4.
    Finally, the script created at the top of the block under write_files will be passed to bash to run (bash /home/myuser/script.sh).

Deployment method: Terraform

Note
It is not currently natively possible to configure Cloud-init settings natively via the Terraform module. This setting may be configured in conjunction with use of the Cloud UI or the Kubernetes CLI, or Cloud-init may be used independently of the CoreWeave Terraform module.