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-0b7448b7d4173c04b
af-south-1 arm64 ami-028e65294b7e61d03
ap-east-1 x86_64 ami-0bfb515ba3c42a0c6
ap-east-1 arm64 ami-03aec63cd66d406c5
ap-east-2 x86_64 ami-0457900b05307d95b
ap-east-2 arm64 ami-0d0dbc7c3332e6366
ap-northeast-1 x86_64 ami-0e3f9242f4d7a8add
ap-northeast-1 arm64 ami-00ec67cad13a13278
ap-northeast-2 x86_64 ami-0a33226a040a964b8
ap-northeast-2 arm64 ami-07962e164418f0e3b
ap-northeast-3 x86_64 ami-0093d59b8d4c13744
ap-northeast-3 arm64 ami-00e55de20df2b55d6
ap-south-1 x86_64 ami-04c48916e49040d5a
ap-south-1 arm64 ami-017108c948a8877e4
ap-south-2 x86_64 ami-0ad6f8d732ca774e0
ap-south-2 arm64 ami-0dc21e7b7d9a65381
ap-southeast-1 x86_64 ami-06043d6fcf4415fd7
ap-southeast-1 arm64 ami-050abd05842cb1e20
ap-southeast-2 x86_64 ami-04a58630bca938f4f
ap-southeast-2 arm64 ami-0e83027e54b32e8c6
ap-southeast-3 x86_64 ami-00963efa859a82fa5
ap-southeast-3 arm64 ami-0e73e43ee06f8e77f
ap-southeast-4 x86_64 ami-0e4e4a48af1ed35da
ap-southeast-4 arm64 ami-01b33785fdf963af5
ap-southeast-5 x86_64 ami-0be8753dba7f5c647
ap-southeast-5 arm64 ami-0d83be2771d0f3b97
ap-southeast-6 x86_64 ami-0c024b9d231d6a604
ap-southeast-6 arm64 ami-0c172f2baf42576d4
ap-southeast-7 x86_64 ami-0ff8b8d0e50691ab2
ap-southeast-7 arm64 ami-0081ef1222e00dd63
ca-central-1 x86_64 ami-06b65d9dfe02cf5c3
ca-central-1 arm64 ami-034a0ad6cabebf1fc
ca-west-1 x86_64 ami-03f258ac47f9f4551
ca-west-1 arm64 ami-0666f0a7e75d3972d
eu-central-1 x86_64 ami-0f4f20af2fa78c2ff
eu-central-1 arm64 ami-0b8c99cca48f74c75
eu-central-2 x86_64 ami-0d5b2dcef00e89f73
eu-central-2 arm64 ami-0865009ac5dc0ea3f
eu-north-1 x86_64 ami-01d423ecfd905e4af
eu-north-1 arm64 ami-0ad1763bf92e2d613
eu-south-1 x86_64 ami-0faffd3991748e0e7
eu-south-1 arm64 ami-00575603cd3cae7b3
eu-south-2 x86_64 ami-04c151d58d8c4d845
eu-south-2 arm64 ami-0215a1e5c129cb279
eu-west-1 x86_64 ami-01fe39b7265e70921
eu-west-1 arm64 ami-0d36cd091d8cce442
eu-west-2 x86_64 ami-0a2f973734cc5f6c9
eu-west-2 arm64 ami-0d2845ea359f4b4c0
eu-west-3 x86_64 ami-040faa97311a43761
eu-west-3 arm64 ami-070ff5176c45fedcc
il-central-1 x86_64 ami-024748ff743e154a6
il-central-1 arm64 ami-0e80c465f5e1fb1ba
me-central-1 x86_64 ami-04adc414e94b47c0f
me-central-1 arm64 ami-0f24e1da9cdf7bdea
me-south-1 x86_64 ami-06598ea8a966ff305
me-south-1 arm64 ami-0dce5c952e0ddacad
mx-central-1 x86_64 ami-0a67aa3ff5cf2e236
mx-central-1 arm64 ami-003eedd5aeb3bbe0f
sa-east-1 x86_64 ami-0a3a92d865cb8dcc8
sa-east-1 arm64 ami-085866cc1093833f4
us-east-1 x86_64 ami-0603cdaecff370264
us-east-1 arm64 ami-0e2b4a9f0d1cf0d28
us-east-2 x86_64 ami-09afd7b57d204d32f
us-east-2 arm64 ami-0bd5ca9dfbe3d415f
us-west-1 x86_64 ami-03a6be3e3f23fbfd9
us-west-1 arm64 ami-0ea42daeaba259c70
us-west-2 x86_64 ami-075016c84185d4465
us-west-2 arm64 ami-088dacc6d3bfc9f34

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.