Amazon EKS — Install AWS CLI
Install AWS CLI
The AWS CLI is your gateway to AWS services. Every EKS operation — from creating clusters to updating kubeconfig — requires it.
What is AWS CLI?
AWS Command Line Interface (CLI) is a tool that lets you interact with AWS services from your terminal. For EKS, you’ll use it to:
- Configure AWS credentials
- Update your kubeconfig to connect to EKS clusters
- Check EKS cluster status
- Manage IAM roles and policies
Install AWS CLI v2
macOS
$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
$ sudo installer -pkg AWSCLIV2.pkg -target /
$ rm AWSCLIV2.pkg
Or with Homebrew:
$ brew install awscli
Linux (x86_64)
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install
$ rm -rf aws awscliv2.zip
Linux (ARM64 — Graviton)
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install
$ rm -rf aws awscliv2.zip
Windows
Download and run the MSI installer from:
https://awscli.amazonaws.com/AWSCLIV2.msi
Verify Installation
$ aws --version
aws-cli/2.15.30 Python/3.11.8 Darwin/23.4.0 exe/x86_64 prompt/off
You should see version 2.x.x. If you see version 1.x, uninstall it and install v2.
Configure AWS CLI
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json
This creates two files:
$ cat ~/.aws/credentials
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
$ cat ~/.aws/config
[default]
region = us-east-1
output = json
Verify AWS Access
$ aws sts get-caller-identity
{
"UserId": "AIDAEXAMPLEUSERID",
"Account": "123456789012",
"Arn": "arn:aws:iam::123456789012:user/eks-admin"
}
If this command returns your account info, you’re good to go.
Using Named Profiles (Recommended)
For multiple AWS accounts, use named profiles:
$ aws configure --profile eks-tutorial
AWS Access Key ID [None]: AKIA...
AWS Secret Access Key [None]: wJal...
Default region name [None]: us-east-1
Default output format [None]: json
Then use the profile:
$ export AWS_PROFILE=eks-tutorial
$ aws sts get-caller-identity
Best practice: Never use the
defaultprofile for production. Always use named profiles so you don’t accidentally run commands in the wrong account.
Region Selection for EKS
Choose your region based on:
| Factor | Recommendation |
|---|---|
| Latency | Choose a region close to your users |
| Cost | us-east-1 and us-west-2 are typically cheapest |
| Features | New EKS features launch in us-east-1 first |
| Compliance | Some data must stay in specific regions |
| Tutorial | We’ll use us-east-1 throughout this tutorial |
Common Mistakes
| Mistake | Fix |
|---|---|
| Using AWS CLI v1 | Uninstall v1, install v2 |
| Hardcoding credentials in scripts | Use aws configure or environment variables |
| Using root account credentials | Create an IAM user (see IAM Setup) |
| Wrong region | Set AWS_DEFAULT_REGION or use --region flag |
Quick Reference
# Install (macOS)
$ brew install awscli
# Configure
$ aws configure
# Verify
$ aws --version
$ aws sts get-caller-identity
# Use a profile
$ export AWS_PROFILE=eks-tutorial
What’s Next?
AWS CLI is ready. Now let’s install the EKS-specific tool: Install eksctl.