Kubernetes Cluster on AWS
The AWS Kubernetes Cluster template scaffolds a Pulumi project that provisions a managed Amazon EKS cluster inside a new VPC with public and private subnets. Worker nodes run in the private subnets for improved security; load balancers created by cluster workloads are automatically placed in the public subnets.


Using this template#
To use this template to deploy your own managed Kubernetes cluster, make sure you’ve installed Pulumi and configured your AWS credentials, then create a new project using the template in the language of your choice:
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-aws-typescriptAlternatively, you can create and configure a new project with this template (kubernetes-aws-typescript) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-aws-pythonAlternatively, you can create and configure a new project with this template (kubernetes-aws-python) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-aws-goAlternatively, you can create and configure a new project with this template (kubernetes-aws-go) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-aws-csharpAlternatively, you can create and configure a new project with this template (kubernetes-aws-csharp) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-aws-yamlAlternatively, you can create and configure a new project with this template (kubernetes-aws-yaml) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-aws-hclAlternatively, you can create and configure a new project with this template (kubernetes-aws-hcl) in Pulumi Cloud.
Follow the prompts to complete the new-project wizard. When it’s done, you’ll have a complete Pulumi project that’s ready to deploy and configured with the most common settings. Feel free to inspect the code in index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yaml for a closer look.
Deploying the project#
The template requires no additional configuration. Once the new project is created, you can deploy it immediately with pulumi up:
pulumi upWhen the deployment completes, Pulumi exports the following stack output values:
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- vpc_id
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
Output values like these are useful in many ways, most commonly as inputs for other stacks or related cloud resources.
Customizing the project#
Projects created with the Kubernetes template expose the following configuration settings:
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- min_cluster_size
The minimum number of nodes to allow in the cluster. Defaults to
3.- max_cluster_size
The maximum number of nodes to allow in the cluster. Defaults to
6.- desired_cluster_size
The desired number of nodes in the cluster. Defaults to
3.- node_instance_type
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpc_network_cidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
All of these settings are optional and may be adjusted either by editing the stack configuration file directly (by default, Pulumi.dev.yaml) or by changing their values with pulumi config set.
Cleaning up#
You can cleanly destroy the stack and all of its infrastructure with pulumi destroy:
pulumi destroyLearn more#
- Browse other architecture templates in the Templates gallery.
- Explore the Amazon EKS and AWSx provider API docs in the Pulumi Registry.
- Walk through Pulumi from the ground up in Pulumi Tutorials.
- Read the latest Kubernetes posts on the Pulumi blog.