This is an old revision of the document!


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-0b5fe8c851fe24e42
af-south-1 x86_64 ami-0499ff19c9d4ab164
ap-east-1 arm64 ami-02d07cd25218c979c
ap-east-1 x86_64 ami-0b0bbc86157eb286b
ap-east-2 arm64 ami-077f82f8e37a2f3de
ap-east-2 x86_64 ami-0819cff7d0eeebca4
ap-northeast-1 arm64 ami-0104cd6ee9d78a98c
ap-northeast-1 x86_64 ami-0d1e24d08f5faa3b5
ap-northeast-2 arm64 ami-08c3e3930dea9796d
ap-northeast-2 x86_64 ami-0e0e1a44bcbb33fad
ap-northeast-3 arm64 ami-0f3906277be9e51ee
ap-northeast-3 x86_64 ami-01d7b9212f74d5a15
ap-south-1 arm64 ami-072cd2588e1d976b3
ap-south-1 x86_64 ami-0f9d8ad6c38dd5c0d
ap-south-2 arm64 ami-0b8f9b6c71c5d3a5c
ap-south-2 x86_64 ami-0870c8fa15251ff92
ap-southeast-1 arm64 ami-0d5146be4abfd32e6
ap-southeast-1 x86_64 ami-0b223fdcd4a442811
ap-southeast-2 arm64 ami-04b0903d7955bc192
ap-southeast-2 x86_64 ami-08ddd896cc068cf49
ap-southeast-3 arm64 ami-0923e3870c6e9bf5b
ap-southeast-3 x86_64 ami-0be3615ae0a02813f
ap-southeast-4 arm64 ami-0c3d9290555d205a1
ap-southeast-4 x86_64 ami-03d76b4e035bd51c7
ap-southeast-5 arm64 ami-0cc6d91bd77bf3bae
ap-southeast-5 x86_64 ami-0bd4376a4f20afeb8
ap-southeast-6 arm64 ami-0c4a52ba9a244415e
ap-southeast-6 x86_64 ami-05cdf50f3dbe71578
ap-southeast-7 arm64 ami-084f5d95815c8d757
ap-southeast-7 x86_64 ami-0934d0a9eb5991a5c
ca-central-1 arm64 ami-085558b904877667d
ca-central-1 x86_64 ami-0d55c8e3de0bb175f
ca-west-1 arm64 ami-0532d0916b45eebcc
ca-west-1 x86_64 ami-0643116d6270d0349
eu-central-1 arm64 ami-0c6159df9caa4b596
eu-central-1 x86_64 ami-05f588bda98bba5fe
eu-central-2 arm64 ami-0b0a75c56b857c4b9
eu-central-2 x86_64 ami-0b3fb06a83c76ff49
eu-north-1 arm64 ami-02cd62fd788d84775
eu-north-1 x86_64 ami-07a62812f576c8b7a
eu-south-1 arm64 ami-0801a314df5b9710e
eu-south-1 x86_64 ami-09fb820b82ba28a1e
eu-south-2 arm64 ami-0c760a3581d3982a0
eu-south-2 x86_64 ami-057702c099c338bf3
eu-west-1 arm64 ami-02e59e4e5e42ba54c
eu-west-1 x86_64 ami-06a3b7f82bc8b3584
eu-west-2 arm64 ami-0b76083fb869662c5
eu-west-2 x86_64 ami-08aac14bad359f6ec
eu-west-3 arm64 ami-056ac9dd6a0847e2b
eu-west-3 x86_64 ami-0f0c89b23cbc309ec
il-central-1 arm64 ami-041f1a67453905103
il-central-1 x86_64 ami-0be86a5a5acbc229f
mx-central-1 arm64 ami-054ffa6548c73db5a
mx-central-1 x86_64 ami-0acea4493b3be3cd5
sa-east-1 arm64 ami-0bd8be65c8d7cf2a1
sa-east-1 x86_64 ami-04d4bae2fb1ffbc6a
us-east-1 arm64 ami-049157019f15fbf7b
us-east-1 x86_64 ami-01c3dfbae57f0763c
us-east-2 arm64 ami-047050cfcc1e99096
us-east-2 x86_64 ami-0a42c38ab5002e377
us-west-1 arm64 ami-03814fa10804c9d65
us-west-1 x86_64 ami-007eff5f91b43a544
us-west-2 arm64 ami-01fc858a4301e4c42
us-west-2 x86_64 ami-04f3712d805fd71e5

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

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.1783946028.txt.gz ยท Last modified: 2026/07/13 12: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.