Prepare a cloud-init Metadata File
Use the following information to prepare your cloud-init metadata file. The metadata file is required for cloud-init.
- The metadata file is a plain-text file formatted as YAML or JSON.
- The maximum file size is 512KB.
- All standard
v1
keys are accepted, such as:distro
local_hostname
platform
public_ssh_keys
- The
instance-id
key is required. All other keys are optional. - For network configuration, both
v1
andv2
keys are accepted.
instance-id: cloud-vm-example-1 local hostname: cloud-vm network: version: 2 ethernets: nics: match: name: eth* dhcp4: yes
This example shows a metadata file in JSON
format that specifies a fixed IP network
configuration:
{ "instance-id": "cloud-vm-example-2", "local-hostname": "cloud-vm", "cloud-name": "vSphere", "distro": "ubuntu", "distro-version": "20.04", "distro-release": "focal", "network": { "version": 2, "ethernets": { "nics": { "match": { "name": "eth*" }, "nameservers": { "addresses": ["203.0.113.1"], "search": ["www.example.com", "example.com"] }, "gateway4": "192.0.2.253", "dhcp4": false, "addresses": [ "192.0.2.0/24" ] } } } }