Pulumi/eks set a default NodeGroup to AMI?
TypeScriptSure, to create an EKS cluster and set an AMI for the default NodeGroup, you can use Pulumi's EKS package. Here's an example of how to achieve this:
import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; const projectName = pulumi.getProject(); // Create an EKS cluster with no arguments, which will, by default, target the AWS account // and region in use by the current AWS CLI context. const cluster = new eks.Cluster(`${projectName}`, { nodeAssociatePublicIpAddress: true, vpcId: <your_VPC_ID>, subnetIds: <your_subnet_IDs>, instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, capacityType: "ON_DEMAND", amiId: <your_AMI_id>, version: "1.20", }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig;
Make sure to replace
<your_VPC_ID>
,<your_subnet_IDs>
, and<your_AMI_id>
with actual values.vpcId
andsubnetIds
are the ID of the VPC and the subnet IDs where you want to deploy your cluster.amiId
is the Amazon Machine Image ID that will be used for each of the EC2 instances in the node groups of this EKS cluster. AMI defines the OS and it's common to use the latest EKS-optimized Amazon Linux 2 for EKS node groups.instanceType
is the type of EC2 instances to use in the node group. The choice here depends on the workload you plan to run in the cluster.desiredCapacity
,minSize
, andmaxSize
control the scaling properties of your node group.
This code will create an EKS cluster with a default node group using the provided AMI ID. The EC2 instances in this cluster will be of type "t2.medium", and auto-scaling will ensure there are always between 1 and 3 instances.
Find more information in the NodeGroup component documentation.