# general


10/22/2023, 12:12 PM
Copy code
// Create the EKS cluster
const cluster = new eks.Cluster(`${namePrefix}-eks-cluster`, {
    name: `${namePrefix}-cluster`,
    // Put the cluster in the new VPC created earlier
    vpcId: eksVpc.vpcId,
    // Public subnets will be used for load balancers
    publicSubnetIds: eksVpc.publicSubnetIds,
    // Private subnets will be used for cluster nodes
    privateSubnetIds: eksVpc.privateSubnetIds,
    // Change configuration values to change any of the following settings
    instanceType: eksNodeInstanceType,
    desiredCapacity: desiredClusterSize,
    minSize: minClusterSize,
    maxSize: maxClusterSize,
    // Do not give the worker nodes public IP addresses
    nodeAssociatePublicIpAddress: false,
    // Change these values for a private cluster (VPN access required)
    endpointPrivateAccess: false,
    endpointPublicAccess: true,
    skipDefaultNodeGroup: true

const workerNode = new eks.NodeGroup(`${namePrefix}-workerNodeGroup`, {
    cluster: cluster,
    labels: {"workload": "worker"},
    nodeAssociatePublicIpAddress: false,
    instanceProfile: instanceProfile,
    instanceType: "t3.medium",
}, {
    providers: { kubernetes: cluster.provider },