Build a custom Amazon Linux AMI - Amazon EKS

Help improve this page

To contribute to this user guide, choose the Edit this page on GitHub link that is located in the right pane of every page.

Build a custom Amazon Linux AMI

Important

Amazon EKS will no longer publish EKS-optimized Amazon Linux 2 (AL2) AMIs after November 26th, 2025. Additionally, Kubernetes version 1.32 is the last version for which Amazon EKS will release AL2 AMIs. From version 1.33 onwards, Amazon EKS will continue to release AL2023 and Bottlerocket based AMIs.

The Amazon EKS optimized Amazon Linux (AL) AMIs are built on top of AL2 and AL2023, specifically for use as nodes in Amazon EKS clusters. Amazon EKS provides open-source build scripts in the Amazon EKS AMI Build Specification repository that you can use in the following ways: * View the configurations for kubelet, the runtime, and the AWS IAM Authenticator for Kubernetes. * Build your own AL-based AMI from scratch.

This repository contains the specialized bootstrap script and nodeadm script that runs at boot time. These scripts configure your instance’s certificate data, control plane endpoint, cluster name, and more. The scripts are considered the source of truth for Amazon EKS optimized AMI builds, so you can follow the GitHub repository to monitor changes to our AMIs.

Prerequisites

Quickstart

This section shows you the commands to create a custom AMI in your AWS account. To learn more about the configurations available to customize your AMI, see the template variables on the Amazon Linux 2023 page.

Step 1. Setup your environment

Clone or fork the official Amazon EKS AMI repository. For example:

git clone https://github.com/awslabs/amazon-eks-ami.git cd amazon-eks-ami

Verify that Packer is installed:

packer --version

Step 2. Create a custom AMI

The following are example commands for various custom AMIs.

Basic NVIDIA AL2 AMI:

make k8s=1.31 os_distro=al2 \ enable_accelerator=nvidia \ nvidia_driver_major_version=560 \ enable_efa=true

Basic NVIDIA AL2023 AMI:

make k8s=1.31 os_distro=al2023 \ enable_accelerator=nvidia \ nvidia_driver_major_version=560 \ enable_efa=true

STIG-Compliant Neuron AL2023 AMI:

make k8s=1.31 os_distro=al2023 \ enable_accelerator=neuron \ enable_fips=true \ source_ami_id=ami-0abcd1234efgh5678 \ kms_key_id=alias/aws-stig

After you run these commands, Packer will do the following: * Launch a temporary Amazon EC2 instance. * Install Kubernetes components, drivers, and configurations. * Create the AMI in your AWS account.

Step 3. View default values

To view default values and additional options, run the following command:

make help