When people start learning AWS, they usually focus only on installing the AWS CLI.
But installing it is just the first step.
To actually interact with AWS services from your Ubuntu machine, you also need to configure AWS credentials properly.
In this guide, weβll go through the complete setup process for AWS CLI on Ubuntu β from installation to configuration and verification.
Why AWS CLI?
AWS CLI allows you to manage AWS services directly from your terminal.
You can:
- Launch EC2 instances
- Upload files to S3
- Configure IAM
- Manage EKS clusters
- Automate cloud operations using scripts
Instead of clicking through the AWS Console every time, AWS CLI helps automate everything efficiently.
Step 1: Update Packages
First, update your system packages:
sudo apt update
This ensures your package manager has the latest repository information.
Step 2: Install Required Dependencies
Install curl and unzip:
sudo apt install unzip curl -y
These tools are required to download and extract the AWS CLI installer.
Step 3: Download AWS CLI v2 Installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
This downloads the latest AWS CLI v2 package for Ubuntu/Linux systems.
Step 4: Unzip the Installer
unzip awscliv2.zip
This extracts the installation files.
Step 5: Run the Install Script
sudo ./aws/install
AWS CLI will now be installed on your machine.
Step 6: Verify Installation
Check whether AWS CLI is installed successfully:
aws --version
Example output:
Step 7: Configure AWS CLI
Now comes the important part β configuration.
Run:
aws configure
Youβll be asked for:
AWS Access Key ID
AWS Secret Access Key
Default region name
Default output format
Example:
AWS Access Key ID [None]: AKIAXXXXX
AWS Secret Access Key [None]: ********
Default region name [None]: ap-south-1
Default output format [None]: json
You can generate Access Keys from:
AWS Console β IAM β Users β Security Credentials β Create Access Key
Step 8: Verify Configured Profiles
To check configured AWS profiles and settings:
aws configure list
This helps verify whether your credentials and region are configured correctly.
Step 9: View Stored Credentials
AWS stores credentials locally inside the .aws directory.
Check credentials file:
cat ~/.aws/credentials
Check config file:
cat ~/.aws/config
Understanding the Files
credentials file
Stores:
- Access Key ID
- Secret Access Key
Example:
[default]
aws_access_key_id = XXXXX
aws_secret_access_key = XXXXX
config file
Stores:
- Default region
- Output format
Example:
[default]
region = ap-south-1
output = json
Important Security Tip β οΈ
Never share:
- Access Key ID
- Secret Access Key
-
.aws/credentialsfile
Also, add .aws/ to .gitignore if you're working inside projects.
Conclusion
Installing AWS CLI is easy, but properly configuring it is what actually enables you to work with AWS services from your local Ubuntu machine.
Once configured, you can automate cloud operations directly from the terminal and integrate AWS into scripts, CI/CD pipelines, and DevOps workflows.
If you're starting your cloud or DevOps journey, AWS CLI is one of the most essential tools to learn π



Top comments (0)