# Kubectl and aws cli setup in Linux

Steps:

1. **Linux:**
    
    ```bash
    sudo apt-get update && sudo apt-get install -y kubectl
    ```
    
2. **MacOS:**
    
    ```bash
    brew install kubectl
    ```
    
3. **Windows:**
    
    * Download the latest version of `kubectl` from the official Kubernetes release page: https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
        
    * Add the downloaded executable to your system's PATH.
        
4. Verify the installation:
    
    ```bash
    kubectl version --short --client
    ```
    

### Configuring AWS CLI:

1. **Install AWS CLI:**
    
    * Follow the instructions here: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
        
2. **Configure AWS CLI:**
    
    ```bash
    aws configure
    ```
    
    * You'll be prompted to enter your AWS access key, secret key, default region, and output format.
        
3. **Verify AWS CLI Configuration:**
    
    ```bash
    aws ec2 describe-instances
    ```
    

### Setting up AWS IAM for EKS:

1. **Create IAM Role:**
    
    * Open the IAM console in the AWS Management Console.
        
    * Navigate to "Roles" and click "Create Role."
        
    * Choose "EKS" as the service that will use this role and select "Allows Amazon EKS to manage your clusters."
        
2. **Attach Policies:**
    
    * Attach the policies `AmazonEKSClusterPolicy` and `AmazonEKSServicePolicy` to the role.
        
3. **Create Kubernetes Config:**
    
    * After creating the EKS cluster, update your `kubeconfig` with the cluster details.
        
        ```bash
        aws eks --region <region> update-kubeconfig --name <cluster_name>
        ```
        
4. **Verify Configuration:**
    
    ```bash
    kubectl get nodes
    ```
    

### Additional Tips:

* Ensure that you have the necessary AWS CLI and `kubectl` versions compatible with your EKS cluster.
    
* Always follow security best practices, such as restricting AWS IAM permissions to the minimum required.
    
* Keep your AWS CLI and `kubectl` configurations secure, especially access keys and secrets.
    

These steps provide a basic setup for using `kubectl` with AWS EKS. For more detailed information, refer to the official documentation for [kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/) and [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html).

#everystepstowardmoreproductivity  
#staycurious  
#stayhealthydeveloper
