NoCloud (seed.iso) cloud-init configuration for Amazon Linux 2023 on KVM and VMware
This section covers how to create and use a seed.iso image
to configure Amazon Linux 2023 running on KVM or VMware. Because KVM and VMware
environments do not have
Amazon EC2 Instance Meta Data Service (IMDS),
an alternate method of configuring Amazon Linux 2023 is required, and
providing a seed.iso image is one of those methods.
The seed.iso boot image includes the initial configuration
information that is needed to boot and configure your new virtual machine,
such as the network configuration, host name, and user data.
Note
The seed.iso image includes only the configuration
information required to boot the VM. It does not include the
Amazon Linux 2023 operating system files.
To generate the seed.iso image, you need at least two
configuration files, sometimes three:
-
meta-data -
This file typically includes the hostname for the virtual machine.
-
user-data -
This file typically configures user accounts, their passwords, ssh key pairs, and/or access mechanisms. By default, the Amazon Linux 2023 KVM and VMware images create an
ec2-useruser account. You can use theuser-dataconfiguration file to set the password and/or ssh keys for this default user account. -
network-config(optional) -
This file typically provides a network configuration for the virtual machine which will override the default one. The default configuration is to use DHCP on the first available network interface.
Create the seed.iso disk image
-
On a Linux or macOS computer, create a new folder named
seedconfigand navigate into it.Note
Using Windows or another Operating System to complete these steps is possible, but you will have to find the equivalent tool to
mkisofsto complete creating theseed.isoimage. -
Create the
meta-dataconfiguration file.-
Create a new file named
meta-data. -
Open the
meta-datafile using your preferred editor and add the following, replacingvm-hostnamewith the host name for the VM:#cloud-config local-hostname:vm-hostname -
Save and close the
meta-dataconfiguration file.
-
-
Create the
user-dataconfiguration file.-
Create a new file named
user-data. -
Open the
user-datafile using your preferred editor and add the following, making substitutions as needed:#cloud-config #vim:syntax=yaml users: # A user by the name 'ec2-user' is created in the image by default. - default - name: ec2-user ssh_authorized_keys: - ssh-rsassh-key# In the above line, replacessh keywith the content of your ssh public key. -
You can optionally add more user accounts to the
user-dataconfiguration file.You can specify additional user accounts, their access mechanisms, passwords, and key pairs. For more information about the supported directives, see the upstream
cloud-initdocumentation. -
Save and close the
user-dataconfiguration file.
-
-
(Optional) Create the
network-configconfiguration file.-
Create a new file named
network-config. -
Open the
network-configfile using your preferred editor and add the following, replacing the various IP addresses with the appropriate ones for your setup.#cloud-config version: 2 ethernets: enp1s0: addresses: -192.168.122.161/24gateway4:192.168.122.1nameservers: addresses:192.168.122.1Note
cloud-initnetwork configuration provides mechanisms to match against the MAC address of the interface instead of specifying the interface name which can change depending on the VM configuration. This (and more)cloud-initfeatures for network configuration are described in more detail in the upstreamcloud-initNetwork Config Version 2 documentation. -
Save and close the
network-configconfiguration file.
-
-
Create the
seed.isodisk image using themeta-data,user-data, and optionalnetwork-configconfiguration files created in the previous steps.Do one of the following, depending on the OS you are creating the
seed.isodisk image on.-
On Linux systems, use a tool such as
mkisofsorgenisoimageto create the completedseed.isofile. Navigate into theseedconfigfolder, and run the following command:$mkisofs -output seed.iso -volid cidata -joliet -rock user-data meta-data -
If you use a
network-config, include it in the invocation ofmkisofs:$mkisofs -output seed.iso -volid cidata -joliet -rock user-data meta-data network-config -
On macOS systems, you can use a tool such as
hdiutilto generate the finishedseed.isofile. Sincehdiutiltakes a pathname rather than a list of files, the same invocation can be used regardless of if anetwork-configconfiguration file has been created or not.$hdiutil makehybrid -o seed.iso -hfs -joliet -iso -default-volume-name cidata seedconfig/
-
-
The resulting
seed.isofile can now be attached to your new Amazon Linux 2023 Virtual Machine using a virtual CD-ROM drive forcloud-initto find on first boot and apply the configuration to the system.