<p>Using the <a href="https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest" rel="nofollow noreferrer">terraform EKS module</a>, how do you use GPU nodes?</p>
<p>The <a href="https://eksctl.io/usage/gpu-support/" rel="nofollow noreferrer">EKS docs</a> suggest that GPU support is automatic, but some <a href="https://deploying.ai/aws-eks-gpu-nvidia/" rel="nofollow noreferrer">guides/tutorials</a> suggest that the user has to install the nvidia-device-plugin and configure AMIs themselves?</p>

Jethro
<p>You need to tell the worker groups to use a specific AMI image, and install the NVIDIA device plugin.</p>
<p>There is an <a href="https://github.com/terraform-aws-modules/terraform-aws-eks/blob/65777d0a37791dd1200d478e3bacc4c9a75f24c8/workers.tf#L183" rel="nofollow noreferrer">image_id</a> property for the <code>worker_groups</code> block.</p>
<p>Find the appropriate AMI image <a href="https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html" rel="nofollow noreferrer">here</a>, selecting the <code>x86 accelerated</code> link under the appropriate kubernetes version and AWS region for your cluster. Copy the AMI id, eg for k8s 1.18 in eu-west-2 you need <a href="https://console.aws.amazon.com/systems-manager/parameters/%252Faws%252Fservice%252Feks%252Foptimized-ami%252F1.18%252Famazon-linux-2-gpu%252Frecommended%252Fimage_id/description?region=eu-west-2" rel="nofollow noreferrer">ami-027a09e5aa5a67e59</a>.</p>
<p>Then plug in your AMI id as <code>image_id</code> in your <code>worker_groups</code> config eg:</p>
<pre class="lang-yaml prettyprint-override"><code>module &quot;eks&quot; {
  worker_groups = [
    {
      image_id = &quot;ami-027a09e5aa5a67e59&quot;
    }
  ]
}
</code></pre>
<p>Finally, you need to <a href="https://github.com/NVIDIA/k8s-device-plugin#installing-via-helm-installfrom-the-nvidia-device-plugin-helm-repository" rel="nofollow noreferrer">install the nvidia-device-plugin</a>, which could be performed within terraform using the <a href="https://registry.terraform.io/providers/hashicorp/helm/latest/docs" rel="nofollow noreferrer">helm provider</a>:</p>
<pre class="lang-yaml prettyprint-override"><code>resource &quot;helm_release&quot; &quot;k8s-device-plugin&quot; {
  name  = &quot;k8s-device-plugin&quot;
  repository = &quot;https://nvidia.github.io/k8s-device-plugin&quot;
  chart = &quot;nvidia-device-plugin&quot;
  version = &quot;0.6.0&quot;
  namespace = &quot;kube-system&quot;
}
</code></pre>
<p>You should now be able to <a href="https://github.com/NVIDIA/k8s-device-plugin#running-gpu-jobs" rel="nofollow noreferrer">run GPU pods</a> by requesting the <code>nvidia.com/gpu</code> resource type.</p>
