Skip to main content
EKS nodes need to be bootstrapped when they launch so they join the cluster and register with the control plane. The mechanism differs by AMI type. This module provides pre-built templates for each supported type and exposes hooks for customization.

How User Data Works by Node Group Type

EKS Managed Node Groups

By default the EKS service appends its own bootstrap user data. Any user-supplied data is pre-pended before it. If a custom ami_id is provided, the service no longer supplies bootstrap data — you must enable enable_bootstrap_user_data = true or provide your own template.

Self Managed Node Groups

You are responsible for all bootstrapping. The module provides templates per AMI type that you opt into with enable_bootstrap_user_data = true, or you can supply your own template via user_data_template_path.

AL2023 (nodeadm / NodeConfig Format)

AL2023 uses the nodeadm bootstrapper with a MIME multipart cloud-init format. The key hook variables are cloudinit_pre_nodeadm and cloudinit_post_nodeadm.

Pre-nodeadm Cloud-Init Parts

Use cloudinit_pre_nodeadm to inject additional MIME parts before the nodeadm configuration part runs. Each entry becomes a separate part in the multipart document.

Post-nodeadm Cloud-Init Parts

Use cloudinit_post_nodeadm to inject MIME parts after the nodeadm configuration, for example to run a shell script after the node has joined the cluster.

NodeConfig Object Reference

The application/node.eks.aws content type accepts a NodeConfig manifest. This is the canonical format for configuring nodeadm on AL2023:

AL2 (Legacy Bash Bootstrap)

For AL2_* AMI types, user data is a bash script. Use pre_bootstrap_user_data, bootstrap_extra_args, and post_bootstrap_user_data to hook into the bootstrap process.
bootstrap_extra_args for AL2 AMIs are arguments passed directly to the AWS EKS Optimized AMI bootstrap script. Common uses include --kubelet-extra-args, --b64-cluster-ca, and --apiserver-endpoint.

Custom AMI with Bootstrap User Data

When you specify a custom ami_id for an EKS managed node group, the EKS service no longer injects bootstrap data. You have two options:

Option 1: Use the Module-Provided Template

Opt in to the module’s built-in bootstrap template for EKS-optimized AMI derivatives:

Option 2: Bring Your Own Template

For non-EKS-optimized AMIs or when you need full control over user data:
Only the variables that the module passes to templatefile() for the respective AMI type are available in your custom template. If you need additional values, pre-render the template before passing it to the module.

Bottlerocket (TOML Format)

For BOTTLEROCKET_* AMI types, user data must be in TOML format. When used with EKS managed node groups, the supplied TOML is merged with the configuration provided by the EKS service — there is no concept of pre/post bootstrap. Use bootstrap_extra_args to supply additional Bottlerocket settings.
pre_bootstrap_user_data and post_bootstrap_user_data are not valid for Bottlerocket. The OS controls when settings are applied. Use bootstrap_extra_args for any additional TOML configuration. See the Bottlerocket settings documentation for all available options.

Windows (PowerShell Format)

For WINDOWS_* AMI types, user data is a PowerShell script.

Variable Reference