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-0ebca013553d4e6df
af-south-1 x86_64 ami-0fbf40f65dbd2d72d
ap-east-1 arm64 ami-0e7e9f83ea2346a6a
ap-east-1 x86_64 ami-0072686a6f22eb4c2
ap-east-2 arm64 ami-07827907e9f74ffeb
ap-east-2 x86_64 ami-0fef591713bae78f6
ap-northeast-1 arm64 ami-0b7f214f6660d5734
ap-northeast-1 x86_64 ami-08a67b1310488f918
ap-northeast-2 arm64 ami-0653b192f4148ffe8
ap-northeast-2 x86_64 ami-0b6798cac2a566789
ap-northeast-3 arm64 ami-0a71ae65d4127fe73
ap-northeast-3 x86_64 ami-0d6519fb74bcbf9fc
ap-south-1 arm64 ami-0543488bd0a49ca14
ap-south-1 x86_64 ami-0048515676e4bd2c0
ap-south-2 arm64 ami-01cee7b3ec9894f11
ap-south-2 x86_64 ami-0554bdb17902a0ec2
ap-southeast-1 arm64 ami-09ebca981e1e39e90
ap-southeast-1 x86_64 ami-02c9756ef80f265f2
ap-southeast-2 arm64 ami-008218189a03b1f72
ap-southeast-2 x86_64 ami-052791aa5b96398b2
ap-southeast-3 arm64 ami-0a09368b8d94277b2
ap-southeast-3 x86_64 ami-046557a3ef4b93c4e
ap-southeast-4 arm64 ami-0386e9a38853c8287
ap-southeast-4 x86_64 ami-0c4ef88196b04b759
ap-southeast-5 arm64 ami-0c8aa447f7f14c8d3
ap-southeast-5 x86_64 ami-040956be0c692bac9
ap-southeast-6 arm64 ami-0906e1cbf0c740cb0
ap-southeast-6 x86_64 ami-0b049227fc4215dc7
ap-southeast-7 arm64 ami-045af8059a45ddbfa
ap-southeast-7 x86_64 ami-0cac1b96ba9fb948d
ca-central-1 arm64 ami-004fdb2cb6450a291
ca-central-1 x86_64 ami-028e0269e0b0d6cbb
ca-west-1 arm64 ami-0273fb3731d563cf7
ca-west-1 x86_64 ami-0bf7f451e83ec3112
eu-central-1 arm64 ami-0c780d03ac3465b49
eu-central-1 x86_64 ami-0ed17887767b8221e
eu-central-2 arm64 ami-0d1a067ecda0c756a
eu-central-2 x86_64 ami-09588d326416dddd2
eu-north-1 arm64 ami-066d1f6d850794524
eu-north-1 x86_64 ami-09ca30a603c36a398
eu-south-1 arm64 ami-01bc3ac205e1721e0
eu-south-1 x86_64 ami-0070c365072ff1e02
eu-south-2 arm64 ami-0cc968fae6e027a30
eu-south-2 x86_64 ami-04221c30fe439e000
eu-west-1 arm64 ami-02c12aedbda2b87de
eu-west-1 x86_64 ami-0142c086fc45c8a12
eu-west-2 arm64 ami-0f2c51dfc60559a68
eu-west-2 x86_64 ami-0de8a99aba3ec9d24
eu-west-3 arm64 ami-05293f9a3932de054
eu-west-3 x86_64 ami-0c23ec339804de7c5
il-central-1 arm64 ami-041ef999b1b40d706
il-central-1 x86_64 ami-0117e0335208ef02e
me-south-1 arm64 ami-0cb792f6f70d69e8c
me-south-1 x86_64 ami-0b06dc9e46d424a9d
mx-central-1 arm64 ami-09c79eef3f6af309d
mx-central-1 x86_64 ami-04be96d90bf5e1ad5
sa-east-1 arm64 ami-00a775a710d2b8e35
sa-east-1 x86_64 ami-0491b1895ea1ab798
us-east-1 arm64 ami-04e39cf6f6a66874d
us-east-1 x86_64 ami-007564a8d0f35e25c
us-east-2 arm64 ami-0948cb2d884d5c025
us-east-2 x86_64 ami-093420162f3ffb17b
us-west-1 arm64 ami-0548c84e98f9e104f
us-west-1 x86_64 ami-0b0c1eee95127d8d4
us-west-2 arm64 ami-02566b9a862ff56f5
us-west-2 x86_64 ami-09f48bf556946796e

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.