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-0a8d486a75228afc1
af-south-1 x86_64 ami-02102efc9e5297c42
ap-east-1 arm64 ami-0adc71d2662044e4a
ap-east-1 x86_64 ami-0b0b87498a3740383
ap-east-2 arm64 ami-0d19934045e048bb0
ap-east-2 x86_64 ami-049223ea574e1e8d0
ap-northeast-1 arm64 ami-084043efec207f04f
ap-northeast-1 x86_64 ami-0fad9f4958b1d342f
ap-northeast-2 arm64 ami-082b6eb307fc50465
ap-northeast-2 x86_64 ami-0bf0804eb47ad4b2e
ap-northeast-3 arm64 ami-03dae2424348edbd7
ap-northeast-3 x86_64 ami-031a9fabe6f68fc69
ap-south-1 arm64 ami-02a2a34afce79e399
ap-south-1 x86_64 ami-0eb74dcde1dc6e319
ap-south-2 arm64 ami-0e7ae245ffc96a987
ap-south-2 x86_64 ami-074bd031f8cd9effb
ap-southeast-1 arm64 ami-04b88f08788f98d9e
ap-southeast-1 x86_64 ami-01ede6688bcbd35b9
ap-southeast-2 arm64 ami-0349d3121e05ba840
ap-southeast-2 x86_64 ami-01571b86b89a4165c
ap-southeast-3 arm64 ami-0f2e5dcf011c34233
ap-southeast-3 x86_64 ami-0fc4d880c31d7bb35
ap-southeast-4 arm64 ami-0631d5acc400b75f7
ap-southeast-4 x86_64 ami-05333b6744bd33f16
ap-southeast-5 arm64 ami-0e559373fbbbdf9fd
ap-southeast-5 x86_64 ami-004cce596b54b5c66
ap-southeast-6 arm64 ami-01b67977ffbcc1d6f
ap-southeast-6 x86_64 ami-05e6658e20bf71d09
ap-southeast-7 arm64 ami-0015de053a60f3425
ap-southeast-7 x86_64 ami-0f0dc2b629f632755
ca-central-1 arm64 ami-00781e9e4603318a8
ca-central-1 x86_64 ami-0a587172a53d5b61b
ca-west-1 arm64 ami-0b706df9d52c2e83c
ca-west-1 x86_64 ami-0584f1e1d837c5ab2
eu-central-1 arm64 ami-049472191eda8fb26
eu-central-1 x86_64 ami-0c43395ba8adaaf6e
eu-central-2 arm64 ami-0855a0b724cf9b487
eu-central-2 x86_64 ami-05fa9ba3f1eeb9f04
eu-north-1 arm64 ami-07c3b4c29511e3778
eu-north-1 x86_64 ami-0c9dcf5ed4c09f4e5
eu-south-1 arm64 ami-04af0105d3e352f2d
eu-south-1 x86_64 ami-06100caf5d587f381
eu-south-2 arm64 ami-028b47f6350d54c13
eu-south-2 x86_64 ami-09168177ab2056e82
eu-west-1 arm64 ami-0638f981d3166df3d
eu-west-1 x86_64 ami-05b6834774f9e88e1
eu-west-2 arm64 ami-0b6b6ba6093cd937b
eu-west-2 x86_64 ami-0363c05ecff3f3a57
eu-west-3 arm64 ami-090785926e957ba2d
eu-west-3 x86_64 ami-0675218e02d340657
il-central-1 arm64 ami-0f56ef99f041fc067
il-central-1 x86_64 ami-0ea5d6d16a4322289
mx-central-1 arm64 ami-00ff6e8aaec27798f
mx-central-1 x86_64 ami-03a2ce17cfb958340
sa-east-1 arm64 ami-0302ee9ffcfc368a2
sa-east-1 x86_64 ami-0010c225e8c086513
us-east-1 arm64 ami-00f18f77a815bca91
us-east-1 x86_64 ami-0aa6de01d8464ede0
us-east-2 arm64 ami-0bd3a8c6148d295c5
us-east-2 x86_64 ami-0e9b6a3e30cc2dd11
us-west-1 arm64 ami-04a73023760ba2b60
us-west-1 x86_64 ami-0a2e2817228175b96
us-west-2 arm64 ami-07761029bc1813eeb
us-west-2 x86_64 ami-01f69597e603c2f79

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.