Skip to main content

AWS EKS CheatSheet

A Cheatsheet to interact with your EKS Cluster using Terminal

After you’ve set up your EKS cluster using Argonaut, you may want to interact with your cluster using your terminal. This cheat sheet lists the commands that you can quickly run to do the same.


💡 This cheat sheet assumes the cluster name to be is demoCluster and the environment name to be is demoEnvironment.

1. Setup

  1. Install aws cli, kubectl

  2. Login to your AWS console using your username-password.

  3. Setup access to the kubernetes cluster using the art cli

    1. Have the art configured

    2. Run this command to generate the AWS access and secret keys and export them directly to your terminal

      eval $(art configure generate-aws-credentials --format eval)
    3. Reference: art configure generate-aws-credentials

  4. Alternately, setup access to the kubernetes cluster using AWS credentials

    1. Ensure the user is part of the cluster's authorized users. This can only be done by a user who already has access to the cluster by following this step.

    2. Create an access key and a secret key on AWS.

    3. Once you’ve generated the keys, export the following environment variables:

      export AWS_ACCESS_KEY_ID=<Access-Id-from-Step-3>
      export AWS_SECRET_ACCESS_KEY=<Access-Secret-Key-from-Step-3>
      export AWS_DEFAULT_REGION=ap-south-1
  5. Create a config file for kubectl by running the following command:

    aws eks update-kubeconfig --name demoEnvironment

2. Commands

To list pods/services running in your environment

kubectl get pods -n demoEnvironment

To view logs for a specific pod/service

kubectl -n demoEnvironment logs podName stateful --tail=100 -f

To log into a pod

kubectl exec -i -t -n demoEnvironment podName -c stateful -- /bin/bash

To view the state of your cluster

Use a Kubernetes dashboard such as k9s to easily view the state of your clusters in your terminal.

To add an AWS user to your cluster


kubectl -n kube-system edit configmap/aws-auth

Then add the below:

mapUsers: |
- userarn: arn:aws:iam::<<<accountid>>>:user/<your-username>
username: <your-username>
- system:masters

Note: This will get reset if a change is made to the cluster infrastructure (like modifying node pools etc.)

To view old application log

Set up Grafana (using LogQL) to view older (before Argonaut) application logs and metrics.

Best Practices

When using the terminal to interact with your cluster managed by Argonaut, we recommend the following:

  • Do not modify secrets directly on the cluster. Argonaut will not know about the changes and it’ll be out of sync.
  • When using a tool like kubectl or others directly on your cluster, do only read operations. Avoid writing configurations directly to your cluster.