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.


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
ap-northeast-1 x86_64 ami-0e9014339a741b571
ap-northeast-1 arm64 ami-0d01a6b3c56eaa737
ap-northeast-2 x86_64 ami-0c506caa835fe9cb6
ap-northeast-2 arm64 ami-0525c3a5c17856ad2
ap-northeast-3 x86_64 ami-00e7e8bcfea4c424b
ap-northeast-3 arm64 ami-028980525b3afa892
ap-south-1 x86_64 ami-046f875f515190d4d
ap-south-1 arm64 ami-060839c13351a0b69
ap-southeast-1 x86_64 ami-0a6eb11b6cdede714
ap-southeast-1 arm64 ami-02731e017ea6f93a1
ap-southeast-2 x86_64 ami-00c1688e748e9a9fc
ap-southeast-2 arm64 ami-06cae808c5665d667
ca-central-1 x86_64 ami-0b130f7ed65a50573
ca-central-1 arm64 ami-0946f07eb2897338a
eu-central-1 x86_64 ami-007b3ec5c343a9b2c
eu-central-1 arm64 ami-05cfbca76a01ed103
eu-north-1 x86_64 ami-0ace0af9c5f20ee8b
eu-north-1 arm64 ami-08dfe2a516015be84
eu-west-1 x86_64 ami-024cb6caeafdb378f
eu-west-1 arm64 ami-011b5fd4e26dd9cb1
eu-west-2 x86_64 ami-0df7f77ba5387c4f4
eu-west-2 arm64 ami-0a27fbd69b61868b6
eu-west-3 x86_64 ami-0f56d0855ece24764
eu-west-3 arm64 ami-025d926e738bbd730
sa-east-1 x86_64 ami-009d265e65d276791
sa-east-1 arm64 ami-0483eb3b9289a3d51
us-east-1 x86_64 ami-00efa6f5c2ff28052
us-east-1 arm64 ami-0eb179a3cfc84527c
us-east-2 x86_64 ami-0a17aa1b759ff801e
us-east-2 arm64 ami-0f21b9ed377ce031f
us-west-1 x86_64 ami-0aa022dcfa285c3a6
us-west-1 arm64 ami-094b4782464a2e12f
us-west-2 x86_64 ami-01ff169ad626d941e
us-west-2 arm64 ami-04f42069546d88558

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


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

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:

  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

EC2 iPXE boot

Congratulations on successfully booting an EC2 instance using iPXE!



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 within the same VPC, you could set your instance's user data to contain:

  sanboot iscsi:

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.


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.


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
  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: gw
  net0: fe80::4ee:8dff:fe98:cc67/64 ok


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 AMI using:

  make CONFIG=cloud EMBED=config/cloud/aws.ipxe bin/ipxe.usb

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

howto/ec2.txt ยท Last modified: 2021/05/01 20:48 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.