Run Amazon Linux 2 As A Virtual Machine On Premises - Amazon Elastic Compute Cloud
Run Amazon Linux 2 As A Virtual Machine On Premises - Amazon Elastic Compute Cloud
このページはお客様の⾔語に翻訳されていません。 翻訳のリクエスト
Use the Amazon Linux 2 virtual machine (VM) images for on-premises development and testing. We offer a different Amazon Linux 2 VM
image for each of the supported virtualization platforms. You can view the list of supported platforms on the Amazon Linux 2 virtual
machine images (https://cdn.amazonlinux.com/os-images/latest/) page.
To use the Amazon Linux 2 virtual machine images with one of the supported virtualization platforms, do the following:
Note
The seed.iso boot image includes only the configuration information required to boot the VM. It does not include the Amazon
Linux 2 operating system files.
To generate the seed.iso boot image, you need two configuration files:
• meta-data – This file includes the hostname and static network settings for the VM.
• user-data – This file configures user accounts, and specifies their passwords, key pairs, and access mechanisms. By default, the Amazon
Linux 2 VM image creates an ec2-user user account. You use the user-data configuration file to set the password for the default user
account.
local-hostname: vm_hostname
# eth0 is the default network interface enabled in the image. You can configure static network
settings with an entry like the following.
network-interfaces: |
auto eth0
iface eth0 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
Replace vm_hostname with a VM host name of your choice, and configure the network settings as required.
c. Save and close the meta-data configuration file.
For an example meta-data configuration file that specifies a VM hostname ( amazonlinux.onprem ), configures the default network
interface ( eth0 ), and specifies static IP addresses for the necessary network devices, see the sample Seed.iso file
1 / 3 2023/12/30 21:12
Run Amazon Linux 2 as a virtual machine on premises - Ama... https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazo...
(https://cdn.amazonlinux.com/os-images/latest/) .
#cloud-config
#vim:syntax=yaml
users:
# A user by the name `ec2-user` is created in the image by default.
- default
chpasswd:
list: |
ec2-user:plain_text_password
# In the above line, do not add any spaces after 'ec2-user:'.
Replace plain_text_password with a password of your choice for the default ec2-user user account.
c. (Optional) By default, cloud-init applies network settings each time the VM boots. Add the following to prevent cloud-init from
applying network settings at each boot, and to retain the network settings applied during the first boot.
# NOTE: Cloud-init applies network settings on every boot by default. To retain network settings
# from first boot, add the following ‘write_files’ section:
write_files:
- path: /etc/cloud/cloud.cfg.d/80_disable_network_after_firstboot.cfg
content: |
# Disable network configuration after first boot
network:
config: disabled
4. Create the seed.iso boot image using the meta-data and user-data configuration files.
For Linux, use a tool such as genisoimage. Navigate into the seedconfig folder, and run the following command.
For macOS, use a tool such as hdiutil. Navigate one level up from the seedconfig folder, and run the following command.
2 / 3 2023/12/30 21:12
Run Amazon Linux 2 as a virtual machine on premises - Ama... https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazo...
After the VM has booted, log in using one of the user accounts that is defined in the user-data configuration file. After you have logged in
for the first time, you can then disconnect the seed.iso boot image from the VM.
3 / 3 2023/12/30 21:12