Saturday, October 26, 2019

Complete configuration of AWS CLI in Ubuntu for EKS (Kubernetes)

AWS CLI installation is pretty simple in an ubuntu. but there is a one concern when you install aws cli in ubuntu which is the available version of aws cli doesnt has required eks commands. therefore you have to keep that in mind when you are typing eks commands.

Install AWS CLI

xxxx@xxxxxxx:~$ aws
Command ‘aws’ not found, but can be installed with:

xxxx@xxxxxxx:~$ sudo snap install aws-cli
or
xxxx@xxxxxxx:~$ sudo apt install awscli
See ‘snap info aws-cli’ for additional versions.

xxxx@xxxxxxx:~$ aws configure


Install eksctl in ubuntu

xxxx@xxxxxxx:~$ curl — silent — location “https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz” | tar xz -C /tmp

xxxx@xxxxxxx:~$ sudo mv /tmp/eksctl /usr/local/bin

xxxx@xxxxxxx:~$ eksctl version
[ℹ] version.Info{BuiltAt:””, GitCommit:””, GitTag:”"}

Install aws iam authenticator


xxxx@xxxxxxx:~$ chmod +x ./aws-iam-authenticator

xxxx@xxxxxxx:~$ mkdir -p $HOME/bin && cp ./aws-iam-authenticator $HOME/bin/aws-iam-authenticator && export PATH=$HOME/bin:$PATH

xxxx@xxxxxxx:~$ echo ‘export PATH=$HOME/bin:$PATH’ >> ~/.bashrc

xxxx@xxxxxxx:~$ aws-iam-authenticator help


as i mentioned previously, you might get below error if there is a version mismatch,

Error,

xxxx@xxxxxxx:~$ aws eks update-kubeconfig — name <cluster name>
Invalid choice: 'eks', maybe you meant: * es

Solution,

xxxx@xxxxxxx:~$ sudo apt-get remove -y — purge awscli
xxxx@xxxxxxx:~$ sudo apt-get install -y python3 python3-pip
xxxx@xxxxxxx:~$ sudo pip3 install awscli — upgrage
xxxx@xxxxxxx:~$ sudo pip install awscli — upgrage
xxxx@xxxxxxx:~$ sudo pip3 install awscli
xxxx@xxxxxxx:~$ aws — version
xxxx@xxxxxxx:~$ aws eks update-kubeconfig — name <cluster name>

that's it now you can work on AWS CLI.

2 comments: