​​Kubernetes is an open-source platform for automating the deployment, scaling, and management of containerized applications. 

How to Run Kubernetes on AWS

It provides a unified solution for scheduling and orchestration, networking, storage, and security for large-scale, complex applications and allows for self-healing, automatic rollouts and rollbacks, and service discovery and load balancing. With its modular architecture and robust API, Kubernetes offers a flexible and scalable platform for managing modern cloud-native applications, making it a cornerstone of the cloud-native ecosystem.

Kubernetes uses a declarative API approach to define and manage the desired state of the system and employs a control loop to continuously monitor and maintain this state.

Why to Use Kubernetes on AWS?

Kubernetes on AWS provides several benefits:

1. Seamlessly Move Application

Using Kubernetes, containerized applications can be seamlessly moved from local development machines to production deployments on the cloud using the same operational tooling.

2. Integration

Kubernetes integrates with AWS services such as Elastic Load Balancer, Amazon RDS, and Amazon S3, allowing for a seamless experience.

3. Portability

Kubernetes makes it easy to deploy and manage applications across multiple cloud providers or on-premises.

4. Flexibility

Kubernetes provides a unified platform for deploying, scaling, and managing a variety of applications, including stateful and stateless applications, and batch and real-time data processing workloads.

5. Run Anywhere

Run highly available and scalable Kubernetes clusters on AWS while maintaining full compatibility with your Kubernetes deployments running on-premises.

Different Ways To Install Kubernetes on AWS

Here, we are going to discuss mainly 2 ways to install Kubernetes on AWS:

1. Manually Using Amazon EC2 Machines

Here are the steps to install Kubernetes on AWS manually using EC2 Machines

A. Create an AWS account or sign in to an existing one.

B. Launch EC2 Instances: Create EC2 instances (at least 3) in the same VPC(Virtual Private Cloud) and security group. While launching AWS EC2 instances, make sure that you open all the ports in the related security groups.

C. Install Docker: Install Docker on each EC2 instance. Be a root user.

sudo su
yum install docker -y
systemctl enable docker && systemctl start docker

D. Install Kubeadm, kubelet, and kubectl: On each EC2 instance, install kubeadm, kubelet, and kubectl using the appropriate package manager for your operating system (e.g., apt for Ubuntu).

yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet && systemctl start kubele

E. Initialize the Master Node: On one EC2 instance, initialize the master node using the kubeadm init command.

F. Join Worker Nodes: On the other EC2 instances, join them as worker nodes to the master node using the kubeadm join command obtained from the output of the kubeadm init command.

G. Verify the Cluster: Verify the cluster by checking the status of all nodes using the kubectl get nodes command and also verify the pods running on the cluster.

H. Deploy a Sample Application: Deploy a sample application to the cluster to verify that the installation was successful.

Note: These are high-level steps, and the exact details may vary based on your specific requirements and setup.


  1. When you are creating your EC2 instances, you need to have at least 2 CPUs with at least 1700 MB allocated.
  2. All the AWS EC2 instances need to be on the same VPC and preferably same availability zone.

2. Kubernetes with Elastic Kubernetes Service (EKS)

Here are the high-level steps to install Kubernetes on AWS using Amazon Elastic Container Service for Kubernetes (EKS):

A. Create an AWS account or sign in to an existing one.

B. Creating an EKS role.

C. Set up an Amazon Virtual Private Cloud (VPC) and configure subnets, security groups, and routing tables.

D. Create an Amazon EKS cluster using the AWS Management Console, AWS CLI, or AWS CloudFormation.

  • AWS Management Console
    • Go to the Amazon EKS page, and click Create cluster.
    • Provide a name for the cluster, select the region, and VPC.
    • Configure the cluster settings, including the worker node group, security groups, and instance type.
    • Launch the cluster.

Run the following command to create a cluster:

aws eks create-cluster --name <cluster-name> --region <region> --role-arn <role-arn> --resources-vpc-config subnetIds=<subnet-ids>,securityGroupIds=<security-group-ids>

It takes about 5 minutes before your cluster is created. You can ping the status of the command using this CLI command:

aws eks --region us-east-1 describe-cluster --name demo --query

The output displayed will be:

  • AWS CloudFormation:

Create a CloudFormation stack with the following YAML template:​

AWSTemplateFormatVersion: '2010-09-09'
Type: 'AWS::EKS::Cluster'
Name: <cluster-name>
RoleArn: <role-arn>
- <subnet-id-1>
- <subnet-id-2>
- ...
- <security-group-id-1>
- <security-group-id-2>
- ...

E. Launch worker nodes and associate them with the cluster using an EC2 Auto Scaling group or manually.

  • EC2 Auto Scaling Group:​
    • Create a CloudFormation stack with the following YAML template:

      AWSTemplateFormatVersion: '2010-09-09'
      Type: 'AWS::EKS::NodeGroup'
      ClusterName: <cluster-name>
      DesiredSize: <desired-size>
      MaxSize: <max-size>
      MinSize: <min-size>
      - <instance-type-1>
      - <instance-type-2>
      - ...
      NodegroupName: <node-group-name>
      - <subnet-id-1>
      - <subnet-id-2>
      - ...
  • Manually:
    • Launch EC2 instances using the Amazon EKS-optimized Amazon Linux 2 AMI.
    • Connect to the instances and install the `aws-cli` and `kubectl` tools.
    • Join the instances to the cluster using the following command:
aws eks update-kubeconfig --name <cluster-name>
aws eks describe-cluster --name <cluster​

F. Verify the cluster setup and connectivity by running a sample application deployment.

G. Optionally, set up cluster autoscaling and configure Kubernetes networking and storage plugins.

Note: These steps are just a summary, and there are many more details and considerations to take into account when deploying a production-ready EKS cluster.


Quoting the Kubernetes documentation, “If you just want to “kick the tires” on Kubernetes, use the local Docker-based solutions. When you are ready to scale up to more machines and higher availability, a hosted solution is the easiest to create and maintain.”

For those of you who are AWS power users, Amazon EKS is a natural fit and for those who are just migrating the whole project to the cloud or a from a different cloud, EKS might a little daunting, but if you are familiar with setting up EC2 machines, you can choose to go with that too.