Spin Up Kubernetes on AWS Under 30 min Prep

You usually can get some free credits if this is your first time registering your AWS account, but this whole series should take less than 2 hours, so even if you pay for it out of your own pocket, it will be less than $0.20.

(You can see the last picture in this blog where I run my cluster for more than 10 hours and it only cost $0.78. With that being said, it does happen that you accidentally did not turn off your services and get charged $100 at the end of the month, but as long as you follow my instructions step by step, that should not happen. If you are interested in, I will show you extra steps on how to monitor and alert your bills at the end of the series. But for now, let’s not worry about it yet!)

Step 1. Set up your AWS account & Payment

Go to the AWS website and register an account as you would on any website.

Image for post
Image for post

Once you log in, you can see this overwhelming panel throwing everything that you don’t need at this moment. Ignore them and just type “billing” in the search bar on the top. You will end up on the billing page as shown on the second picture.

Image for post
Image for post
Image for post
Image for post

(As you can see, I spent only $0.78 for running a Kubernetes cluster for more than 10 hours)

Once you are on the billing page, you can go check if you have credit to use under the credit tab, or you can simply add your credit card. I know it’s generally not a good idea to add your credit card to any website unless you 100% needs it, but that’s how I was motivated to get familiar with billing dashboard and setting alert things like that.

Step 2. Install CLIs

You will need three CLIs to run your Kubernetes clusters. They are:

  • AWS CLI
  • kubectl
  • eksctl

(1) For Mac:

(2) For Windows

Download and install awscli as any other program: https://awscli.amazonaws.com/AWSCLIV2.msi

Then run the following command in your powershell:

Download and install eksctl as any other program: https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html#installing-eksctl

Step 3. Start your cluster

(You will need to wait ~15 min for step (1) and (4), so your prep time is 10 min, but the total cooking time is about 30 min)

(1) Create EKS Cluster without nodegroup

Copy the following commands to whatever terminal you are using

(2) IAM OIDC Provider

Copy the following commands to whatever terminal you are using

(3) Create Keypair

Use the command below to create a key called k8s-demo.pem

(4) Create Node Group

Make sure you are in the directory of your computer where the pem file above is create, then type the command below.

(5) Verify it is running

Type the command above you should see some result like this:

(6) Delete the Cluster

To avoid further charges, you can delete you the cluster you just created by simply typing the command below.

Written by

I am a Machine Learning Engineer with special interest in mental health and finance.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store