iPXE in Amazon EC2

You can use iPXE to boot Amazon (AWS) EC2 instances using a public iPXE AMI. You can use an iPXE script to direct the EC2 instance to boot via any means supported by iPXE. For example, you could boot a set of diskless EC2 instances using HTTPS or iSCSI from a single server hosted in the same AWS region.

Launching

The EC2 iPXE images are published outside of the AWS Marketplace and are shared directly from account 833372943033.

Launch the latest iPXE AMI for your AWS region and CPU architecture from the table below:

AWS region CPU architecture AMI ID
af-south-1 arm64 ami-04226e140453c1e33
af-south-1 x86_64 ami-04d4fa6924d79f8a1
ap-east-1 arm64 ami-0157f4dec3606458a
ap-east-1 x86_64 ami-0543423594dca0937
ap-east-2 arm64 ami-0bd5692fbe875e2d2
ap-east-2 x86_64 ami-06188f5ba5afbd8fd
ap-northeast-1 arm64 ami-04d77dc13f83e0093
ap-northeast-1 x86_64 ami-09c68c9d8f7c0bb91
ap-northeast-2 arm64 ami-07e671d9364a752c4
ap-northeast-2 x86_64 ami-0a1e7431732d21228
ap-northeast-3 arm64 ami-0ec5c2fd5fd3ac397
ap-northeast-3 x86_64 ami-09c2e8d6c9f84ab58
ap-south-1 arm64 ami-0a3e8368a7e4d232d
ap-south-1 x86_64 ami-0a25189112d6f7559
ap-south-2 arm64 ami-0599c02ff48806d54
ap-south-2 x86_64 ami-07e6fc0bf1da19b84
ap-southeast-1 arm64 ami-0ff68ffd9c8bb417f
ap-southeast-1 x86_64 ami-09c4af675ae927956
ap-southeast-2 arm64 ami-08a9c40cc7dda63db
ap-southeast-2 x86_64 ami-0fcc3286787715f38
ap-southeast-3 arm64 ami-0981c4a1146843d88
ap-southeast-3 x86_64 ami-0761b9bc6d1ddce6f
ap-southeast-4 arm64 ami-071e9591b41c4bd8b
ap-southeast-4 x86_64 ami-0d28e5e074179e626
ap-southeast-5 arm64 ami-0912f633cb10472fb
ap-southeast-5 x86_64 ami-0f84ec0d35e1bfb53
ap-southeast-6 arm64 ami-01d02baa6a0e0b958
ap-southeast-6 x86_64 ami-0cfe516f7fed5e9f8
ap-southeast-7 arm64 ami-0ee8b1b43aedc17ee
ap-southeast-7 x86_64 ami-0198555c40692624f
ca-central-1 arm64 ami-0d979718cfa53c62e
ca-central-1 x86_64 ami-0c9df2720343a888f
ca-west-1 arm64 ami-057913e3ef98ca119
ca-west-1 x86_64 ami-0b7440c22d7aa8790
eu-central-1 arm64 ami-0c355b8f1f543b7db
eu-central-1 x86_64 ami-018bbb1fe4a9bccff
eu-central-2 arm64 ami-00b179a2f739f1b0a
eu-central-2 x86_64 ami-0dd64de5e4bb61933
eu-north-1 arm64 ami-0c1acb5e417411de1
eu-north-1 x86_64 ami-0b825bcca3cb389f1
eu-south-1 arm64 ami-0c23a5704d711fb12
eu-south-1 x86_64 ami-0d44f493c469061c6
eu-south-2 arm64 ami-093a851c5d68f297c
eu-south-2 x86_64 ami-08a74d7c19305725e
eu-west-1 arm64 ami-0d775087d4e66e573
eu-west-1 x86_64 ami-0effc01ffb438a07a
eu-west-2 arm64 ami-0825d3ad1af425559
eu-west-2 x86_64 ami-072b5019ba4872747
eu-west-3 arm64 ami-0ab5fbb23e5cdc748
eu-west-3 x86_64 ami-029e58a07b0910c8e
il-central-1 arm64 ami-0198e5663cf88f805
il-central-1 x86_64 ami-091ef6a81e3a397fc
mx-central-1 arm64 ami-059512085755c05ef
mx-central-1 x86_64 ami-014b3f26ce24ba46d
sa-east-1 arm64 ami-073cf0d7d3ce5b33c
sa-east-1 x86_64 ami-046852a1b902be737
us-east-1 arm64 ami-0fc77d2d2cdb54bce
us-east-1 x86_64 ami-0cb5869cd7cc182af
us-east-2 arm64 ami-025959c131cabcf34
us-east-2 x86_64 ami-070b429ac3696ae84
us-west-1 arm64 ami-01caeeba0d818c0f5
us-west-1 x86_64 ami-097813d902b8dc934
us-west-2 arm64 ami-0e5d4cca9ef24c7e1
us-west-2 x86_64 ami-09989f22ed75289e5

You can use any compatible EC2 instance type (including instance types with Enhanced or SR-IOV networking).

Configuring

iPXE EC2 instances are controlled via an iPXE script stored as the instance user-data. The iPXE AMI includes an embedded script that will automatically obtain an IP address via DHCP, print out some useful diagnostic information, and then download and execute http://169.254.169.254/latest/user-data.

You can use this user-data iPXE script to direct the remainder of the network boot process. For example, to download and boot Tiny Core Linux, you could set your instance's user data to contain:

  #!ipxe
  set base http://tinycorelinux.net/12.x/x86/release/distribution_files/
  kernel ${base}/vmlinuz64
  initrd ${base}/rootfs.gz
  initrd ${base}/modules64.gz
  boot

EC2 iPXE boot

Congratulations on successfully booting an EC2 instance using iPXE!

Success

Using cloud-init

If you are using cloud-init to configure your EC2 instance, then you may want to use the user-data to store the cloud-init configuration as well as your iPXE boot script.

You can use the cloud-init tool to create a MIME multi-part archive that contains both your cloud-init configuration and your iPXE boot script. You can attach your iPXE boot script using any filename and the MIME type text/x-ipxe. For example:

  cloud-init devel make-mime --force \
    --attach config.yml:cloud-config \
    --attach boot.ipxe:x-ipxe \
    > user-data

iSCSI

You can use your user-data script to direct iPXE to boot from an iSCSI target. For example: to boot from an iSCSI target hosted on another EC2 instance 172.16.0.1 within the same VPC, you could set your instance's user data to contain:

  #!ipxe
  sanboot iscsi:172.16.0.1::::iqn.1995-08.org.example.iscsitarget:disk1

Note that the operating system on the iSCSI target disk will need to include the appropriate software and configuration to allow it to identify its own iSCSI root disk. You can install software such as sanbootable to help set up the required configuration.

IPv6

The iPXE AMI will include support for both IPv4 and IPv6. You should enable IPv6 in your VPC to speed up the boot, since otherwise iPXE will spend several seconds attempting to obtain an IPv6 address.

Troubleshooting

You can view the iPXE output via the EC2 system log or instance screenshot. For example:

  aws ec2 get-console-output --query Output --output text \
          --instance-id i-04549ed5e420eae6e

You should see output similar to:

  iPXE 1.21.1+ (gfa012) -- Open Source Network Boot Firmware -- http://ipxe.org
  Features: DNS HTTP HTTPS iSCSI TFTP SRP AoE ELF MBOOT PXE bzImage Menu PXEXT
  Amazon EC2 - iPXE boot via user-data
  CPU: GenuineIntel Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
  net0: 06:ee:8d:98:cc:67 using netfront on vif/0 (Ethernet) [closed]
    [Link:up TX:0 TXE:0 RX:0 RXE:0]
  Configuring (net0 06:ee:8d:98:cc:67)...... ok
  net0: 172.31.41.104/255.255.240.0 gw 172.31.32.1
  net0: fe80::4ee:8dff:fe98:cc67/64
  http://169.254.169.254/latest/user-data... ok

Warning

Note that there is often a time delay of several minutes in obtaining system logs or instance screenshots from EC2 - this is a longstanding problem with EC2 itself and is not related to iPXE. You may need to retry the command several times (or possibly stop the instance) in order to obtain any output.

Building from source

You can build your own version of the public iPXE AMIs using:

  make CONFIG=cloud EMBED=config/cloud/aws.ipxe \
       bin-x86_64-pcbios/ipxe.usb bin-arm64-efi/ipxe.usb

and import them using the aws-import tool (found in the contrib directory in the iPXE source tree).

howto/ec2.txt ยท Last modified: 2026/07/13 12:40 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL https://ipxe.org
References to "iPXE" may not be altered or removed.