The AWS CLI (Command Line Interface) is a tool that lets you interact with Amazon Web Services through the command line. It allows you to manage AWS services, automate tasks, and access various AWS functionalities using commands typed into a terminal or command prompt.
How to install AWS CLI
Download and run the installation script.
Check that the AWS CLI is working
Configure AWS CLI Security Profile
Set the aws_access_key_id and aws_secret_access_key for each AWS account profile
Fix Invalid apiVersion, Can’t find aws binary
Deploy an AWS EKS cluster with Terraform.
To install follow the official installation instructions or run the install script.
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" $ unzip awscliv2.zip $ sudo ./aws/install
Check that the AWS CLI has been installed:
$ aws --version aws-cli/2.13.38 Python/3.11.6 Linux/5.15.0-88-generic exe/x86_64.ubuntu.22 prompt/off
Set the values you provide for the AWS Access Key ID and the AWS Secret Access Key. Values will be written to the shared credentials file (~/.aws/credentials) using the "default" profile.
$ aws configure AWS Access Key ID [None]: BKA******************VK AWS Secret Access Key [None]: VHYLs**************************9z4Ga Default region name [None]: Default output format [None]:
AWS CLI uses ~/.aws/credentials file for storing the aws_access_key_id
and aws_secret_access_key
for each AWS account that it manages, the values are stored under [profile name]
. The default profile is used when the user doesn't specify a specific profile.
The file can be manually modified or the aws configure
command can be used.
Example:
[default] aws_access_key_id = AK************JT aws_secret_access_key = HZJK****************************adsg12621a [ditwl_infradmin] aws_access_key_id = AK*************4 aws_secret_access_key = PI********************mc4 account_id = 12345678910
Execute aws configure help
for advanced options.
Create a new AWS CLI profile:
$ aws configure --profile ditwl-test AWS Access Key ID [None]: AK*************4 AWS Secret Access Key [None]: PI********************mc4 Default region name [None]: Default output format [None]:
AWS CLI uses ~/.aws/config
file for storing the advanced options for each AWS profile (in square brackets) that it manages, for example:
[profile ditwl_infradmin] region = us-east-1 [default] [profile ditwl-test]
The Kubernetes Kubectl command checks connectivity with all the clusters in the kubeconfig
file, if any of the clusters is an Amazon EKS then it can show this error:
$ kubectl version error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
Update the AWS CLI to the latest version by uninstalling and installing again.
When running the aws
command: bash: /usr/bin/aws: No such file or directory
, fix by following these instructions:
aws
binary location is updated, run hash aws
and test againIT Wonder Lab tutorials are based on the diverse experience of Javier Ruiz, who founded and bootstrapped a SaaS company in the energy sector. His company, later acquired by a NASDAQ traded company, managed over €2 billion per year of electricity for prominent energy producers across Europe and America. Javier has over 25 years of experience in building and managing IT companies, developing cloud infrastructure, leading cross-functional teams, and transitioning his own company from on-premises, consulting, and custom software development to a successful SaaS model that scaled globally.
Are you looking for cloud automation best practices tailored to your company?