

# Custom Amazon Machine Images (AMIs) for AWS PCS
Custom AMIs

AWS PCS is designed to work with Amazon Machine Images (AMI) that you bring to the service. These AMIs can have arbitrary software and configurations installed on them, so long as they have the AWS PCS agent and a compatible version of Slurm installed and configured correctly. You must use AWS-provided installers to install the AWS PCS software on your custom AMI. We recommend you use AWS-provided installers to install Slurm on your custom AMI but you can install Slurm on your own if you prefer (not recommended). 

**Note**  
If you want to try AWS PCS without building a custom AMI, you can use a sample AMI provided by AWS. For more information, see [Using sample Amazon Machine Images (AMIs) with AWS PCS](working-with_ami_samples.md).

**Important**  
AWS PCS currently requires a kernel with IPv4 support for local node communication, even when you use AWS PCS in an IPv6-only network.

This tutorial helps you create an AMI that can be used with PCS compute node groups to power your HPC and AI/ML workloads.

**Topics**
+ [

# Step 1 – Launch a temporary instance
](working-with_ami_custom_launch-instance.md)
+ [

# Step 2 – Install the AWS PCS agent
](working-with_ami_custom_install-agent.md)
+ [

# Step 3 – Install Slurm
](working-with_ami_custom_install-slurm.md)
+ [

# Step 4 – (Optional) Install additional drivers, libraries, and application software
](working-with_ami_custom_install-software.md)
+ [

# Step 5 – Create an AMI compatible with AWS PCS
](working-with_ami_custom_create-ami.md)
+ [

# Step 6 – Use the custom AMI with an AWS PCS compute node group
](working-with_ami_custom_use-ami.md)
+ [

# Step 7 – Terminate the temporary instance
](working-with_ami_custom_terminate-instance.md)

# Step 1 – Launch a temporary instance


Launch a temporary instance that you can use to install and configure the AWS PCS software and Slurm scheduler. You use this instance to create an AMI compatible with AWS PCS. 

**To launch a temporary instance**

1.  Open the [Amazon EC2 console](https://console.aws.amazon.com/ec2). 

1.  In the navigation pane, choose **Instances**, then choose **Launch instances** to open the new launch instance wizard. 

1.  (Optional) In the **Name and tags** section, provide a name for the instance, such as `PCS-AMI-instance`. The name is assigned to the instance as a resource tag (`Name=PCS-AMI-instance`). 

1.  In the **Application and OS Images** section, select an AMI for one of the [supported operating systems](working-with_ami_installers.md#working-with_ami_installers_os). 

1.  In the **Instance type** section, select a [supported instance type](working-with_ami_installers.md#working-wth_ami_installers_instance-types). 

1.  In the **Key pair** section, select the key pair to use for the instance. 

1.  In the **Network settings** section: 

   1.  For **Firewall (security groups)**, choose **Select existing security group**, then select a security group that allows inbound SSH access to your instance. 

1.  In the **Storage** section, configure the volumes as needed. Make sure to configure sufficient space to install your own applications and libraries. 

1.  In the **Summary** panel, choose **Launch instance**. 

# Step 2 – Install the AWS PCS agent


Install the agent that configures the instances launched by AWS PCS for use with Slurm. For more information about the AWS PCS agent, see [AWS PCS agent versions](pcs-agent-versions.md).

**To install the AWS PCS agent**

1.  Connect to the instance you launched. For more information, see Connect to your Linux instance. 

1.  (Optional) To ensure that all of your software packages are up to date, perform a quick software update on your instance. This process may take a few minutes. 
   + **Amazon Linux 2, Amazon Linux 2023, RHEL 9, RHEL 8, Rocky Linux 9, and Rocky Linux 8**

     ```
     sudo yum update -y
     ```
   + **Ubuntu 22.04 and Ubuntu 24.04**

     ```
     sudo apt-get update && sudo apt-get upgrade -y
     ```

1. Reboot the instance and reconnect to it.

1. Download the AWS PCS agent installation files. The installation files are packaged into a compressed tarball (`.tar.gz`) file. To download the latest *stable* version, use the following command. Substitute *region* with the AWS Region where you launched your temporary instance, such as `us-east-1`. 

   ```
   curl https://aws-pcs-repo-region.s3.region.amazonaws.com/aws-pcs-agent/aws-pcs-agent-v1.3.2-1.tar.gz -o aws-pcs-agent-v1.3.2-1.tar.gz
   ```

   You can also get the latest version by replacing the version number with `latest` in the preceding command (for example: `aws-pcs-agent-v1-latest.tar.gz`).
**Note**  
This might change in future releases of the AWS PCS agent software. 

1. (Optional) Verify the authenticity and integrity of the AWS PCS software tarball. We recommend that you do this to verify the identity of the software publisher and to check that the file has not been altered or corrupted since it was published.

   1.  Download the public GPG key for AWS PCS and import it into your keyring. Substitute *region* with the AWS Region where you launched your temporary instance. The command should return a key value. Record the key value; you use it in the next step. 

      ```
      wget https://aws-pcs-repo-public-keys-region.s3.region.amazonaws.com/aws-pcs-public-key.pub && \
          gpg --import aws-pcs-public-key.pub
      ```

   1.  Run the following command to verify the GPG key's fingerprint.

      ```
      gpg --fingerprint 7EEF030EDDF5C21C
      ```

      The command should return a fingerprint that is identical to the following:

      ```
      1C24 32C1 862F 64D1 F90A  239A 7EEF 030E DDF5 C21C
      ```
**Important**  
Don't run the AWS PCS agent installation script if the fingerprint doesn't match. Contact [AWS Support](https://console.aws.amazon.com/support).

   1. Download the signature file and verify the signature of the AWS PCS software tarball file. Replace *region* with the AWS Region where you launched your temporary instance, such as `us-east-1`.

      ```
      wget https://aws-pcs-repo-region.s3.region.amazonaws.com/aws-pcs-agent/aws-pcs-agent-v1.3.2-1.tar.gz.sig && \
          gpg --verify ./aws-pcs-agent-v1.3.2-1.tar.gz.sig
      ```

      The output should be similar to the following:

      ```
      gpg: assuming signed data in './aws-pcs-agent-v1.3.2-1.tar.gz'
      gpg: Signature made Thu 06 Nov 2025 11:10:36 AM CET using RSA key ID ECC0AE5C
      gpg: Good signature from "AWS PCS Packages (AWS PCS Packages)"
      gpg: WARNING: This key is not certified with a trusted signature!
      gpg:          There is no indication that the signature belongs to the owner.
      Primary key fingerprint: 1C24 32C1 862F 64D1 F90A  239A 7EEF 030E DDF5 C21C
         Subkey fingerprint: B7E1 8788 3517 6A74 C3D5  EAF5 6088 136D ECC0 AE5C
      ```

      If the result includes `Good signature` and the fingerprint matches the fingerprint returned in the previous step, proceed to the next step.
**Important**  
Don't run the AWS PCS software installation script if the fingerprint doesn't match. Contact [AWS Support](https://console.aws.amazon.com/support).

1. Extract the files from the compressed `.tar.gz` file and navigate to the extracted directory.

   ```
   tar -xf aws-pcs-agent-v1.3.2-1.tar.gz && \
       cd aws-pcs-agent
   ```

1. Install the AWS PCS software.

   ```
   sudo ./installer.sh
   ```

1. Check the AWS PCS software version file to confirm a successful installation.

   ```
   cat /opt/aws/pcs/version
   ```

   The output should be similar to the following:

   ```
   AGENT_INSTALL_DATE='Fri Dec 13 12:28:43 UTC 2024'
   AGENT_VERSION='1.3.2'
   AGENT_RELEASE='1'
   ```

# Step 3 – Install Slurm


Install a version of Slurm that is compatible with AWS PCS. For more information, see [Slurm versions in AWS PCS](slurm-versions.md).

**Note**  
If you have an AMI with a previous version of the Slurm software installed on it, you must perform the following steps to install the new version of Slurm. The AWS PCS agent enables the correct version of the Slurm binaries at runtime, according to the Slurm version configured at cluster creation time. 

**To install Slurm**

1.  Connect to the same temporary instance where you installed the AWS PCS software. 

1.  Download the Slurm installer software. The Slurm installer is packaged into a compressed tarball (`.tar.gz`) file. To download the latest *stable* version, use the following command. Substitute *region* with the AWS Region of your temporary instance, such as `us-east-1`. 

   ```
   curl https://aws-pcs-repo-region.s3.region.amazonaws.com/aws-pcs-slurm/aws-pcs-slurm-25.05-installer-25.05.4-1.tar.gz \
        -o aws-pcs-slurm-25.05-installer-25.05.4-1.tar.gz
   ```

   You can also get the latest version by replacing the version number with `latest` in the preceding command (for example: `aws-pcs-slurm-25.05-installer-latest.tar.gz`). For a complete list of available versions with checksums, see [Slurm versions in AWS PCS](slurm-versions.md).
**Note**  
This might change in future releases of the Slurm installer software. 

1. (Optional) Verify the authenticity and integrity of the Slurm installer tarball. We recommend that you do this to verify the identity of the software publisher and to check that the file has not been altered or corrupted since it was published.

   1. Download the public GPG key for AWS PCS and import it into your keyring. Substitute *region* with the AWS Region where you launched your temporary instance. The command should return a key value. Record the key value; you use it in the next step.

      ```
      wget https://aws-pcs-repo-public-keys-region.s3.region.amazonaws.com/aws-pcs-public-key.pub && \
          gpg --import aws-pcs-public-key.pub
      ```

   1.  Run the following command to verify the GPG key's fingerprint.

      ```
      gpg --fingerprint 7EEF030EDDF5C21C
      ```

      The command should return a fingerprint that is identical to the following:

      ```
      1C24 32C1 862F 64D1 F90A  239A 7EEF 030E DDF5 C21C
      ```
**Important**  
Don't run the Slurm installation script if the fingerprint doesn't match. Contact [AWS Support](https://console.aws.amazon.com/support).

   1. Download the signature file and verify the signature of the Slurm installer tarball file. Replace *region* with the AWS Region where you launched your temporary instance, such as `us-east-1`.

      ```
      wget https://aws-pcs-repo-region.s3.region.amazonaws.com/aws-pcs-slurm/aws-pcs-slurm-25.05-installer-25.05.4-1.tar.gz.sig && \
           gpg --verify ./aws-pcs-slurm-25.05-installer-25.05.4-1.tar.gz.sig
      ```

      The output should be similar to the following:

      ```
      gpg: assuming signed data in './aws-pcs-slurm-25.05-installer-25.05.4-1.tar.gz'
      gpg: Signature made Fri 24 Oct 2025 05:05:11 PM UTC using RSA key ID ECC0AE5C
      gpg: Good signature from "AWS PCS Packages (AWS PCS Packages)"
      gpg: WARNING: This key is not certified with a trusted signature!
      gpg:          There is no indication that the signature belongs to the owner.
      Primary key fingerprint: 1C24 32C1 862F 64D1 F90A  239A 7EEF 030E DDF5 C21C
           Subkey fingerprint: B7E1 8788 3517 6A74 C3D5  EAF5 6088 136D ECC0 AE5C
      ```

      If the result includes `Good signature` and the fingerprint matches the fingerprint returned in the previous step, proceed to the next step.
**Important**  
Don't run the Slurm installation script if the fingerprint doesn't match. Contact [AWS Support](https://console.aws.amazon.com/support).

1. Extract the files from the compressed `.tar.gz` file and navigate into the extracted directory.

   ```
   tar -xf aws-pcs-slurm-25.05-installer-25.05.4-1.tar.gz && \
       cd aws-pcs-slurm-25.05-installer
   ```

1. Install Slurm. The installer downloads, compiles, and installs Slurm and its dependencies. It takes several minutes, depending on the specifications of the temporary instance you selected.

   ```
   sudo ./installer.sh -y
   ```

1. Check the scheduler version file to confirm the installation.

   ```
   cat /opt/aws/pcs/scheduler/slurm-25.05/version
   ```

   The output should be similar to the following:

   ```
   SLURM_INSTALL_DATE='Mon Nov 3 14:23:38 UTC 2025'
   SLURM_VERSION='25.05.4'
   PCS_SLURM_RELEASE='1'
   ```

# Step 4 – (Optional) Install additional drivers, libraries, and application software


Install additional drivers, libraries, and application software on the temporary instance. The installation procedures will vary depending on the specific applications and libraries. If you have not built a custom AMI for AWS PCS before, we recommend you first build and test an AMI with just the AWS PCS software and Slurm installed, then incrementally add your own software and configurations once you have confirmed initial success. 

**Examples**
+  Elastic Fabric Adapter (EFA) software. For more information, see [Get started with EFA and MPI for HPC workloads on Amazon EC2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-start.html#efa-start-enable) in the *Amazon Elastic Compute Cloud User Guide*. 
+  Amazon Elastic File System (Amazon EFS) client. For more information, see [Manually installing the Amazon EFS client](https://docs.aws.amazon.com/efs/latest/ug/installing-amazon-efs-utils.html) in the *Amazon Elastic File System User Guide*. 
+  Lustre client, to use Amazon FSx for Lustre and Amazon File Cache. For more information, see [Installing the Lustre client](https://docs.aws.amazon.com/fsx/latest/LustreGuide/install-lustre-client.html) in the *FSx for Lustre User Guide*. 
+  Amazon CloudWatch agent, to use CloudWatch Logs and Metrics. For more information, see [Install the CloudWatch agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-EC2-Instance.html) in the *Amazon CloudWatch User Guide*. 
+  AWS Neuron, to use **trn\$1** and **inf\$1** instance types. For more information, see the [AWS Neuron documentation](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/). 
+  NVIDIA Driver, CUDA, and DCGM, to use **p\$1** or **g\$1** instance types. 

# Step 5 – Create an AMI compatible with AWS PCS


After you have installed the required software components, you create an AMI that you can reuse to launch instances in AWS PCS compute node groups.

**Important**  
AWS PCS currently requires a kernel with IPv4 support for local node communication, even when you use AWS PCS in an IPv6-only network.

**To create an AMI from your temporary instance**

1.  Open the [Amazon EC2 console](https://console.aws.amazon.com/ec2). 

1. In the navigation pane, choose **Instances**. 

1.  Select the temporary instance that you created. Choose **Actions**, **Image**, **Create image**. 

1.  For **Create image**, do the following: 

   1.  For **Image name**, enter a descriptive name for the AMI. 

   1.  (Optional) For **Image description**, enter a brief description of the purpose of the AMI. 

   1.  Choose **Create image**. 

1.  In the navigation pane, choose **AMIs**. 

1.  Locate the AMI that you created in the list. Wait for its status to change from **Pending** to **Available**, then use it with a AWS PCS compute node group. 

# Step 6 – Use the custom AMI with an AWS PCS compute node group


You can use your custom AMI with a new or existing AWS PCS compute node group. 

**Important**  
AWS PCS currently requires a kernel with IPv4 support for local node communication, even when you use AWS PCS in an IPv6-only network.

------
#### [ New compute node group ]

**To use the custom AMI**

1.  Open the [AWS PCS console](https://console.aws.amazon.com/pcs). 

1.  In the navigation pane, choose **Clusters**. 

1.  Choose the cluster where you will use the custom AMI, then select **Compute node groups**. 

1.  Create a new compute node group. For more information, see [Creating a compute node group in AWS PCS](working-with_cng_create.md). Under **AMI ID**, search for the name or ID of the custom AMI you want to use. Finish configuring the compute node group, then choose **Create compute node group**. 

1. (Optional) Confirm the AMI supports instance launches. Launch an instance in the compute node group. You can do this by configuring the compute node group to have a single static instance, or you can submit a job to a queue that uses the compute node group.

   1.  Check the Amazon EC2 console until an instance appears tagged with the new compute node group ID. For more information on this, see [Finding compute node group instances in AWS PCS](working-with_compute-instances.md).. 

   1.  When you see an instance launch and complete its bootstrap process, confirm it is using the expected AMI. To do this, select the instance, then inspect **AMI ID** under **Details**. It should match the AMI you configured in the compute node group settings. 

   1.  (Optional) Update the compute node group scaling configuration to your preferred values. 

------
#### [ Existing compute node group ]

**To use the custom AMI**

1.  Open the [AWS PCS console](https://console.aws.amazon.com/pcs). 

1.  In the navigation pane, choose **Clusters**. 

1.  Choose the cluster where you will use the custom AMI, then select **Compute node groups**. 

1. Select the node group you wish to configure and choose **Edit**. Under **AMI ID**, search for the name or ID of the custom AMI you want to use. Finish configuring the compute node group, then choose **Update**. New instances launched in the compute node group will use the updated AMI ID. Existing instances will continue to use the old AMI until AWS PCS replaces them. For more information, see [Updating an AWS PCS compute node group](working-with_cng_update.md).

1. (Optional) Confirm the AMI supports instance launches. Launch an instance in the compute node group. You can do this by configuring the compute node group to have a single static instance, or you can submit a job to a queue that uses the compute node group.

   1.  Check the Amazon EC2 console until an instance appears tagged with the new compute node group ID. For more information on this, see [Finding compute node group instances in AWS PCS](working-with_compute-instances.md).. 

   1.  When you see an instance launch and complete its bootstrap process, confirm it is using the expected AMI. To do this, select the instance, then inspect **AMI ID** under **Details**. It should match the AMI you configured in the compute node group settings. 

   1.  (Optional) Update the compute node group scaling configuration to your preferred values. 

------

# Step 7 – Terminate the temporary instance


After you have confirmed that your AMI works as intended with AWS PCS, you can terminate the temporary instance to stop incurring charges for it. 

**To terminate the temporary instance**

1.  Open the [Amazon EC2 console](https://console.aws.amazon.com/ec2). 

1.  In the navigation pane, choose **Instances**. 

1.  Select the temporary instance that you created and choose **Actions**, **Instance state**, **Terminate instance**. 

1.  When prompted to confirm, choose **Terminate**. 