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-025c34c5246051d21
af-south-1 x86_64 ami-0114321ff0587c6ba
ap-east-1 arm64 ami-0e1474ba33c3c91cd
ap-east-1 x86_64 ami-0f7139045da7816d7
ap-east-2 arm64 ami-06956d51118dfea3a
ap-east-2 x86_64 ami-00b564183b6a4988f
ap-northeast-1 arm64 ami-01fe232a138394599
ap-northeast-1 x86_64 ami-0e9a9809912cc4126
ap-northeast-2 arm64 ami-034c3b3f76de55035
ap-northeast-2 x86_64 ami-08fe2e078d65d4530
ap-northeast-3 arm64 ami-0dbc1833792d8d274
ap-northeast-3 x86_64 ami-0afea7210669648bb
ap-south-1 arm64 ami-0013ba70f4ad4e385
ap-south-1 x86_64 ami-03e30f301a536d786
ap-south-2 arm64 ami-0e27efa3c46be149c
ap-south-2 x86_64 ami-0ea25d8c4482d5772
ap-southeast-1 arm64 ami-0d4545813a8f25a64
ap-southeast-1 x86_64 ami-072ebf78174572ac8
ap-southeast-2 arm64 ami-0064548c647f772f5
ap-southeast-2 x86_64 ami-092dc620e498d0cc8
ap-southeast-3 arm64 ami-029a224fe11e2ff65
ap-southeast-3 x86_64 ami-00e5cc45ea167107a
ap-southeast-4 arm64 ami-05d1889a66d96394a
ap-southeast-4 x86_64 ami-0ee90df736ae3b888
ap-southeast-5 arm64 ami-0d506e40d1e2505cd
ap-southeast-5 x86_64 ami-0c956cbb4bc5312a8
ap-southeast-6 arm64 ami-0c1165764eb807e63
ap-southeast-6 x86_64 ami-04c63e55c79f5f08b
ap-southeast-7 arm64 ami-0a5ff80c77f75acac
ap-southeast-7 x86_64 ami-0d6d90c434fbe3789
ca-central-1 arm64 ami-0fbe02665f6a1cb22
ca-central-1 x86_64 ami-0a870488a96368da7
ca-west-1 arm64 ami-09ed0767635d3b1c0
ca-west-1 x86_64 ami-0a0c2c0e6e60e8b00
eu-central-1 arm64 ami-02a04bcc813c4f4e5
eu-central-1 x86_64 ami-0f98c969c1c7cd142
eu-central-2 arm64 ami-04166a0b95b82dc21
eu-central-2 x86_64 ami-03de5e60ca8abac6d
eu-north-1 arm64 ami-0b40a99adc03439a9
eu-north-1 x86_64 ami-01728db18f43bc151
eu-south-1 arm64 ami-085990aa39a081c64
eu-south-1 x86_64 ami-0bbf2010531d2686d
eu-south-2 arm64 ami-0b0d2c830053dd467
eu-south-2 x86_64 ami-08677aac4a9e5b774
eu-west-1 arm64 ami-0d8e9ad19e5e9d9fe
eu-west-1 x86_64 ami-06b4485b5c6a54c11
eu-west-2 arm64 ami-0399aa25ece6a3bea
eu-west-2 x86_64 ami-0f250ace7ef0eb51d
eu-west-3 arm64 ami-0a42b56a7991aed8d
eu-west-3 x86_64 ami-03176a9839e418c66
il-central-1 arm64 ami-024bf663fc984e216
il-central-1 x86_64 ami-08c1e3100b45fe82e
mx-central-1 arm64 ami-0ab52c7ce585d87ea
mx-central-1 x86_64 ami-0cf1d3a0dceffd168
sa-east-1 arm64 ami-0f77f32dc7ab3790a
sa-east-1 x86_64 ami-0348a7511fb29fba8
us-east-1 arm64 ami-0c1787e9f2bb31c4b
us-east-1 x86_64 ami-003aec66f49fe3990
us-east-2 arm64 ami-0d1eb58ab221fefa7
us-east-2 x86_64 ami-067a02663dc42a8b8
us-west-1 arm64 ami-0ecd5e859388dfaa2
us-west-1 x86_64 ami-0530ad8a86c8d50b2
us-west-2 arm64 ami-0e8e8ffa5fe5a04d7
us-west-2 x86_64 ami-09d7068a3f6d3920e

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.