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 x86_64 ami-0e2271e293a1c039e
af-south-1 arm64 ami-041170d2fbc997581
ap-east-1 x86_64 ami-074f98cd850a1d3be
ap-east-1 arm64 ami-0b28ead06f899d761
ap-east-2 x86_64 ami-0262cac6fe22e3b65
ap-east-2 arm64 ami-00f028baa390d839b
ap-northeast-1 x86_64 ami-05ed347b0d11556f7
ap-northeast-1 arm64 ami-0812b80692c00e949
ap-northeast-2 x86_64 ami-01a3ec52083a1200d
ap-northeast-2 arm64 ami-0625882ac0996bcfc
ap-northeast-3 x86_64 ami-0492d65da28d3e7ea
ap-northeast-3 arm64 ami-0595a748257b0bb17
ap-south-1 x86_64 ami-00e07c8b962979c51
ap-south-1 arm64 ami-0ffe2fbd2b18bdb7f
ap-south-2 x86_64 ami-017c80aa38ff74187
ap-south-2 arm64 ami-02ab193b1239a554d
ap-southeast-1 x86_64 ami-0372102cfcaa43e14
ap-southeast-1 arm64 ami-05b3a0bdcdc39a828
ap-southeast-2 x86_64 ami-03f40313c904b486e
ap-southeast-2 arm64 ami-021eb2239b6981e16
ap-southeast-3 x86_64 ami-0f46a49271c0eac26
ap-southeast-3 arm64 ami-0a1a1d6ab00d335d5
ap-southeast-4 x86_64 ami-0f77eb2a7c8896d0d
ap-southeast-4 arm64 ami-093e20b708309b7bd
ap-southeast-5 x86_64 ami-0409ce3268c94f41b
ap-southeast-5 arm64 ami-07eb514d82660b703
ap-southeast-6 x86_64 ami-0bb67a035add1992f
ap-southeast-6 arm64 ami-01b8dfcc11a614493
ap-southeast-7 x86_64 ami-08bc05896f4e54b15
ap-southeast-7 arm64 ami-02896315d71a9ffbb
ca-central-1 x86_64 ami-01f80e8af73e23888
ca-central-1 arm64 ami-0d96afa1c949d5925
ca-west-1 x86_64 ami-0eca2b2115bec95fb
ca-west-1 arm64 ami-09c2a0a98585f4465
eu-central-1 x86_64 ami-05bb7035b7f982d0e
eu-central-1 arm64 ami-0a8a7f8bdaaa30b36
eu-central-2 x86_64 ami-081f88e1ec5095081
eu-central-2 arm64 ami-09abb6d5d97feab12
eu-north-1 x86_64 ami-0141010df238c3158
eu-north-1 arm64 ami-09498e9021e707983
eu-south-1 x86_64 ami-0f527474cadc49954
eu-south-1 arm64 ami-06ded109f573a7985
eu-south-2 x86_64 ami-0c313291bb7f84532
eu-south-2 arm64 ami-04d619510b315ad5e
eu-west-1 x86_64 ami-01dd4bcf1c0435390
eu-west-1 arm64 ami-027fcfaf797d51d71
eu-west-2 x86_64 ami-0ff17f865d4c195d9
eu-west-2 arm64 ami-0e8d769a74537ac48
eu-west-3 x86_64 ami-0fb13a172325bd0db
eu-west-3 arm64 ami-0cdbfa081fb702ef4
il-central-1 x86_64 ami-0f342dd41f1c504bb
il-central-1 arm64 ami-00428485cbd5d4aff
me-central-1 x86_64 ami-048ef91519d159562
me-central-1 arm64 ami-015547ee0fb17ed20
me-south-1 x86_64 ami-0f629e6face32db13
me-south-1 arm64 ami-097cee8bc29493a5d
mx-central-1 x86_64 ami-0940bf7e48095f837
mx-central-1 arm64 ami-07ef8d5e9b5394021
sa-east-1 x86_64 ami-0fd45968ad430a248
sa-east-1 arm64 ami-0eb971420988843ec
us-east-1 x86_64 ami-0cf19b0fc0e169aa0
us-east-1 arm64 ami-017c0ea80c5544f81
us-east-2 x86_64 ami-097bdc925e652f96c
us-east-2 arm64 ami-09c2c5f0f0969d606
us-west-1 x86_64 ami-0e434bcb4cb988145
us-west-1 arm64 ami-0a8a93236e4c44527
us-west-2 x86_64 ami-0abba4c9ea6c12700
us-west-2 arm64 ami-0badc5fb5053f4680

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=rootfs.gz initrd=modules64.gz
  initrd ${base}/rootfs.gz
  initrd ${base}/modules64.gz
  boot

EC2 iPXE boot

Congratulations on successfully booting an EC2 instance using iPXE!

Success

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: 2025/10/13 16:33 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.