Bassam Ismail

Importing EKS cluster kubeconfig using AWS CLI

10 October, 2023

k8s aws

To fetch the kubeconfig of your AWS EKS cluster you need the two things:

Screenshot of AWS Console with EKS service page open

  1. aws-cli installed on your machine
  2. AWS credentials configured

I have a global venv which I activate from my home directory.

$ . ~/.venv/bin/
$ pip install awscli

In case my ~/.aws/credentials file isn’t populated I’ll export the environment variables.


Once I have these two things in set up, I’d use aws eks subcommand to import the kubeconfig.

$ aws eks update-kubeconfig --region [CLUSTER_REGION] --name [CLUSTER_NAME]
Updated context arn:aws:eks:eu-west-2:ARN:cluster/mothership in ~/.kube/config

With this, the kubeconfig should be updated in our home directory ~/.kube/config and we should be able to query our cluster.

$ kubectl get pods -n kube-system