Custom bootstrap actions - AWS ParallelCluster

Custom bootstrap actions

If you define the HeadNode / CustomActions / OnNodeStart configuration settings, AWS ParallelCluster runs arbitrary code immediately after the node starts. If you define the HeadNode / CustomActions / OnNodeConfigured configuration settings, AWS ParallelCluster runs the code after the node configuration is correctly completed.

Starting with AWS ParallelCluster version 3.4.0, the code can be run after the head node update, if you define the HeadNode / CustomActions / OnNodeUpdated configuration settings.

In most cases, this code is stored in Amazon Simple Storage Service (Amazon S3) and accessed through an HTTPS connection. The code is run as root and can be in any script language that's supported by the cluster OS. Often the code is in Bash or Python.

Note

Starting with AWS ParallelCluster version 3.7.0, the cluster Imds / ImdsSupport setting default is v2.0.

When you create a new cluster to upgrade to version 3.7.0 and later versions, either update your custom bootstrap action scripts to be compatible with IMDSv2 or set Imds / ImdsSupport to v1.0 in your cluster configuration file.

Warning

You are responsible for configuring the custom scripts and arguments as described in the Shared responsibility model. Verify that your custom bootstrap scripts and arguments are from sources that you trust to have full access to your cluster nodes.

Warning

AWS ParallelCluster doesn't support the use of internal variables that are provided through the /etc/parallelcluster/cfnconfig file. This file might be removed as part of a future release.

OnNodeStart actions are called before any node deployment bootstrap action is started, such as configuring NAT, Amazon Elastic Block Store (Amazon EBS) or the scheduler. OnNodeStart bootstrap actions may include modifying storage, adding extra users, and adding packages.

Note

If you configure DirectoryService and a HeadNode / CustomActions / OnNodeStart script for your cluster, AWS ParallelCluster configures DirectoryService and restarts the sssd, before it runs the OnNodeStart script.

OnNodeConfigured actions are called after the node bootstrap processes are complete. OnNodeConfigured actions serve the last actions to occur before an instance is considered fully configured and complete. Some OnNodeConfigured actions include changing scheduler settings, modifying storage, and modifying packages. You can pass argument to scripts by specifying them during configuration.

OnNodeUpdated actions are called after the head node update is completed and the scheduler and shared storage are aligned with the latest cluster configuration changes.

When OnNodeStart or OnNodeConfigured custom actions succeed, success is indicated with exit code zero (0). Any other exit code indicates the instance bootstrap failed.

When OnNodeUpdated custom actions succeed, success is signaled with exit code zero (0). Any other exit code indicates the update failed.

Note

If you configure OnNodeUpdated, you must manually restore the OnNodeUpdated actions to the previous state on update failures.

If an OnNodeUpdated custom action fails, the update rolls back to the previous state. However, the OnNodeUpdated action is only run at update time and not at stack rollback time.

You can specify different scripts for the head node and for each queue, in the HeadNode / CustomActions and Scheduling / SlurmQueues / CustomActions configuration sections. OnNodeUpdated can only be configured in the HeadNode section.

Note

Before AWS ParallelCluster version 3.0, it was not possible to specify different scripts for head and compute nodes. Please refer to Moving from AWS ParallelCluster 2.x to 3.x.