Building a custom CfnCluster AMI

Warning

Building a custom AMI is not the recomended approach for customizing CfnCluster.

Once you build your own AMI, you will no longer receive updates or bug fixes with future releases of CfnCluster. You will need to repeat the steps used to create your custom AMI with each new CfnCluster release.

Before reading any further, take a look at the Custom Bootstrap Actions section of the documentation to determine if the modifications you wish to make can be scripted and supported with future CfnCluster releases

While not ideal, there are a number of scenarios where building a custom AMI for CfnCluster is necessary. This tutorial will guide you through the process.

How to customize the CfnCluster AMI

The base CfnCluster AMI is often updated with new releases. This AMI has all of the components required for CfnCluster to function installed and configured. If you wish to customize an AMI for CfnCluster, you must start with this as the base.

  1. Find the AMI which corresponds with the region you will be utilizing in the list here: https://github.com/awslabs/cfncluster/blob/master/amis.txt.

  2. Within the EC2 Console, choose “Launch Instance”.

  3. Navigate to “Community AMIs”, and enter the AMI id for your region into the search box.

  4. Select the AMI, choose your instance type and properties, and launch your instance.

  5. Log into your instance using the ec2-user and your SSH key.

  6. Customize your instance as required

  7. Run the following command to prepare your instance for AMI creation:

    sudo /usr/local/sbin/ami_cleanup.sh
    
  8. Stop the instance

  9. Create a new AMI from the instance

  10. Enter the AMI id in the custom_ami field within your cluster configuration.