Open In App

How to Upgrade AWS CLI to The Latest Version ?

Last Updated : 16 May, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The AWS Command Line Interface (AWS CLI) is a tool that lets you communicate with AWS services by typing commands into your terminal/shell. It is an effective and practical method for managing resources, automating processes, and carrying out operations on AWS.

However, because AWS is continually updating and adding new capabilities to its services you may need to upgrade your AWS CLI to the most recent version in order to use them. We will go over how to update the AWS CLI to the newest version on a variety of operating systems including Windows, Linux, and macOS in this article. We will go over several frequently used terms, procedures, and AWS CLI examples.

What is AWS CLI?

The term AWS CLI refers to the Amazon Web Services Command Line Interface. It is a single tool with a standardized interface for administering and controlling many AWS services. The Amazon CLI can used for several purposes including :

AWS CLI is available with Windows, Linux, and macOS. There are many ways to install it such as pip, MSI installer, bundled installer, and Homebrew. AWS CloudShell sessions and Docker containers also be used to access the AWS CLI.

Why Do You Need to Upgrade AWS CLI?

To support the most recent features and improvements to AWS services the AWS CLI is updated on a regular basis. Therefore to take use of the new features and steer clear of compatibility problems, you might need to update your AWS CLI to the most recent version. For instance, AWS CLI version 2.2.5 or later is required to use the new AWS S3 Intelligent-Tiering Archive Access tier.

Additionally updating AWS CLI guarantees you get the most dependable and safest version of the program. In its most recent iterations, AWS CLI can resolve security flaws, enhance speed, and correct bugs. Thus to maintain your AWS CLI current it is advised that you upgrade it on a frequent basis.

How To Check Your AWS CLI Version?

Before upgrading your AWS CLI you should check the version you are currently using. To achieve this, you can use the following command :

aws --version
  • The following screenshot shows the output i.e., current version AWS CLI version in your instance

Verifying AWS CLI Version

  • This will show the operating system details Python and Botocore versions and the AWS CLI version.

How to Upgrade to the Latest Version of AWS CLI? A Step-By-Step Guide

The following are the steps for upgrading the AWS CLI version to the latest version:

Step 1: Install AWS CLI (if not installed)

  • If you haven’t installed the AWS CLI then refer this article to install the AWS CLI on ubuntu – Article

Step 2: Check Current Version

  • Before upgrading, it’s crucial to know your current AWS CLI version. Open your command line terminal and execute the following command:
aws --version
  • This will display the current version installed on your system as shown in above blocks.

Step 3: Upgrade AWS CLI

  • To upgrade the AWS CLI, you can use the package manager that corresponds to your operating system. Here are the commands for popular package managers:

Python Package Manager ( pip )

  • On using the python package manager pip we can update the AWS CLI software, The command looks as follows:
pip install --upgrade awscli

Output

Upgrading AWS CLI

For Homebrew (macOS)

  • The following command helps in upgrading the AWS CLI software to the latest version using brew package manager for the MacOS system:
brew upgrade awscli

For apt (Debian/Ubuntu)

  • The following command helps in upgrading the AWS CLI software to the latest version using apt-get package manager for the Ubuntu OS system:
sudo apt-get install --only-upgrade -y awscli

Step 4: Verify Upgrade

  • After the upgrade, run the following command to verify the updated version:
aws --version

Output

AWS-CLI-Version

Benefits of Upgrading to the latest version of AWS CLI

The following are the benefits of upgrading the AWS CLI to the latest version:

  • Modernized experience: Enjoy a streamlined interface with improved commands, making interactions with AWS services smoother and more efficient.
  • Enhanced features: Access the latest functionalities and services unavailable in older versions. Stay ahead of the curve with cutting-edge capabilities.
  • Improved performance: Benefit from performance optimizations and bug fixes, leading to faster command execution and a more responsive experience.
  • Security updates: Gain access to the latest security patches and vulnerability fixes, ensuring your AWS environment remains protected.
  • Consistency across platforms: Experience a unified experience across different operating systems with a consistent command structure and behavior.
  • Future-proof your workflows: Ensure compatibility with future AWS services and features by staying on the latest version.

By upgrading, you’ll not only streamline your workflow but also unlock new possibilities and ensure the security and stability of your AWS infrastructure. Consider making the switch today and experience the advantages firsthand.

How to Uninstall AWS CLI? A Step-By-Step Guide

The following are the steps to uninstall the AWS CLI:

Step 1: Access Your Terminal

  • Firstly check whether the AWS CLI is installed or not, for that open your terminal and enter the following command:
aws --version

Step 2: Uninstall the AWS CLI

  • Depending on how you installed the AWS CLI software, use one of the following methods to uninstall the software of AWS CLI:

Uninstall AWS CLI using pip

  • The following command is used to uninstall the AWS CLI using python package manager (pip):
pip uninstall awscli

Uninstall AWS CLI using HomeBrew ( for MacOS )

  • The following command is used to uninstall the AWS CLI using bew the package manager for MacOS:
brew uninstall awscli

Uninstall AWS CLI using ( Debian/Ubuntu )

  • The following command is used to uninstall the AWS CLI using the apt package manager for Ubuntu OS.
sudo apt-get remove awscli

Step 3: Confirming Uninstallation

  • After uninstalling the AWS CLI, verify whether that AWS CLI has been successfully removed or not by checking its version again. Execute the following command to check the CLI Version:
aws --version

AWS CLI Update Commands

The following are the some of the AWS CLI update commands with examples:

1. Update AWS CLI to the Latest Version

  • The following command is used to the update the AWS CLI to the latest version:
pip install --upgrade awscli

2. Check for Available Updates

  • The following command is used to check for the updates, the following command shows the updates of all the software
pip list --outdated

3. Update Specific Version of AWS CLI

  • The following command is used to update AWS CLI to the specific version:
pip install --upgrade awscli=2.2.10

4. Update AWS CLI using OS Package Manager

The following command is used to update the AWS CLI using OS Package Manager:

Ubuntu ( apt-get )

pip install --upgrade awscli

CentOS/RHEL ( yum )

sudo yum update aws-cli

McOS ( bew )

brew upgrade awscli

How to Update Secrets in AWS CLI?

  • Firstly list out the following command to known the options of the AWS Secrets Service:
aws secretsmanager help
  • Now, one knowing the options of the secrets and its usage, use the following command with update-secret option to update the secrets that are stored in AWS Secret Manager:
aws secretsmanager update-secret --secret-id my-secret --secret-string '{"username":"new-user","password":"new-pass"}'

How to Update Lambda in AWS CLI?

  • Firstly list out the following command to known the options of the AWS lambda Service:
aws lambda help
  • For once understanding the options of the aws lambda, use the option update-function-code option to update the code for a lambda function.
aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip

How to Update Policy in AWS CLI?

  • Firstly list out the following command to known the options of the AWS Policy Service:
aws policy help
  • After once knowing the options of the aws policy service by the above command. Now, use the option update-policy to update an IAM policy attached to a user, group or role.
aws iam update-policy --policy-arn arn:aws:iam::123456789012:policy/MyPolicy --policy-document file://policy.json

How to Update ECS Service using AWS CLI

  • Firstly list out the following command to known the options of the AWS ECS Service:
aws ecs help
  • After once knowing the options of the aws ecs service by the above command. Now use the option update-service to update the ECS service followed by the service name and any desired options:
aws ecs update-service --cluster my-cluster --service my-service --desired-count 3

How Change AWS CLI profile?

  • To known about the AWS CLI option for configuring profile, updating the profile using following option:
aws configure help
  • The following command is used for changing the AWS CLI profile, once it is executed it will ask for access key, secret key, region and format-type, on providing those the profile will be updated.
aws configure --profile myprofile

Change AWS CLI Region

  • The following command helps in setting the region to the current profile as default region for the AWS CLI:
aws configure set region us-west-2

Troubleshooting of AWS CLI Installation and Uninstall Errors

The following are the some of the troubleshooting steps for AWS CLI Installation and Uninstallation Errors:

  • Check Dependencies: Ensure that all the necessary dependencies installed on the system such as python and pip before AWS CLI installation.
  • Verify Installation Method: Double-check the installation method you are using and ensure its compatibility with your operating system.
  • Network Connectivity: Check your network connectivity and firewall setting to ensure they are not blocking access to AWS endpoints required for installation.
  • Review Error Messages: Pay attention to the error messages and log files that are encountered while uninstallation for making sure that doesn’t conflict other resources.

Conclusion

AWS CLI upgrades are simple to complete and guarantee you have access to the newest AWS features and enhancements. Following these easy steps even beginners can maintain their AWS CLI up to date and fully utilize Amazon Web Services sophisticated command-line interface.

AWS CLI Upgrade – FAQs

Why is it important to upgrade AWS CLI?

To get the most recent features, security updates, and enhancements offered by AWS, you must upgrade the AWS CLI.

Can I use AWS CLI on Windows?

Yes, AWS CLI is compatible with Windows. You can install it using the MSI installer available on the AWS CLI User Guide.

What if I encounter issues during the upgrade?

If you face problems, refer to the official AWS CLI Troubleshooting Guide.

Does upgrading AWS CLI affect existing configurations?

Upgrading AWS CLI generally maintains existing configurations, but it’s recommended to check the release notes for any specific changes.

How often should I upgrade AWS CLI?

It’s advisable to check for updates regularly and upgrade as needed, especially when AWS announces new releases.

How to check if AWS CLI is installed?

On running the following command to check its version confirms whether the AWS CLI software has installed or not. If installed what is its version.

aws  --version


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads