canonical/open-documentation-academy

LXD: configure `cloud-init` from a file

Open

#63 opened on Apr 26, 2024

 (6 comments) (0 reactions) (1 assignee)Python (99 forks)auto 404
good first issuehow-tosize 3

Repository metrics

Stars
 (119 stars)
PR merge metrics
 (PR metrics pending)

Description

Documentation: https://documentation.ubuntu.com/lxd/en/latest/ GitHub repo: https://github.com/canonical/lxd Contribution guide: https://documentation.ubuntu.com/lxd/en/latest/contributing/


To run some actions on an instance when it is started for the first time, you can use cloud-init. See How to use cloud-init in the LXD documentation.

The How to configure cloud-init section describes the format needed for the cloud-init configuration options, and how to configure it if you're using the API, but it's missing instructions for how to configure the options through the CLI.

You would usually do this by writing the configuration to a file (for example, cloud-init.yml) and then passing it in:

lxc config set <instance_name> cloud-init.user-data - < ~cloud-init.yml

This information should be added to the page.

Contributor guide