How to Install AWS CLI on Ubuntu?
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
Here are the step-by-step instructions to install AWS CLI on Ubuntu
Step 1: Update package Lists
Open a terminal and update the package lists using the following command.
sudo apt-get update
Step 2: Install Python PIP
AWS CLI requires Python PIP (Python Package Index) to be installed. Python is a prerequisite for AWS CLI. You can install Python using the following command.
sudo apt-get install python3-pip
Step 3: Install AWS CLI
Once Python is installed, you can install AWS CLI using pip (Python package installer). You can install AWS CLI by running the following command.
sudo pip install awscli
This command installs AWS CLI system-wide, making it available to all users on the system.
Step 4: Verify Installation
After the installation is completed, you can verify if AWS CLI is installed or not by checking the version using the below command.
aws --version
Step 5: Configure AWS CLI
After AWS CLI is installed, you need to configure it. This can be done using the “aws configure” command. Run the following command.
aws configure
You will be prompted to enter your AWS Access Key ID, AWS Secret Access Key, Default region name, and Default output format. If you do not have these credentials, you can obtain them from the AWS Identity and Access Management (IAM) service.
After you have successfully configured AWS CLI, you can start using it to manage your AWS services.
Commands Frequently Used in AWS CLI.
1. To list the S3 buckets in the AWS.
aws s3 ls
2. To describe the EC2 instance.
aws ec2 describe-instances
3. To list all the IAM user.
aws iam list-users
Conclusion
Once you’ve completed these steps, the AWS CLI should be installed and configured on your Ubuntu system. You can now use various AWS commands in the terminal to manage your AWS resources, access services, and automate tasks directly from the command line.
FAQs
Q1. Where does the AWS CLI install files on Ubuntu?
Answer:
The main executable is installed at /usr/local/bin/aws. Configuration files go in ~/.aws/ and caching in ~/.aws/cli/cache.
Q2. How do I use environment variables for credentials?
Answer:
Set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables instead of typing credentials in aws configure.
Q3. Where can I find my AWS access keys?
Answer:
Your access keys are available in the IAM dashboard of your AWS account. Go to IAM > Users > Security Credentials.