George McKinney Adventures in Software Development

September 12, 2020

Updating AWS CLI on Linux from Version 1 to Version 2

Filed under: Amazon — georgemck @ 3:32 am

Amazon Linux 1 and 2 AMI used for EC2 have AWS CLI pre-installed but if it is version 1 and you want to update to version 2, do this.

 

Step 1. First check which version you have currently installed:

aws –version

will output something like this:

aws-cli/1.14.39 Python/3.7.3 Linux/4.14.193-113.317.amzn1.x86_64 exe/x86_64.amzn.2018

 

Step 2. Optionally, you can review its configuration with:

aws configure

output:

AWS Access Key ID [****************AU4L]:
AWS Secret Access Key [****************cFa+]:
Default region name [us-east-1]:
Default output format [json]:

 

Step 3. Uninstalling depends on which version of Python you have associated with AWS CLI. Check the AWS version previously displayed to be sure. Here is a link to the documentation https://docs.aws.amazon.com/cli/latest/userguide/install-linux-al2017.html

For Python 2, the command is:

pip uninstall awscli

For Python 3, the command is:

pip3 uninstall awscli

 

Step 4. Installing version 2 according to: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html

   curl “https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip” -o “awscliv2.zip”
   unzip awscliv2.zip
   sudo ./aws/install

 

Step 5. Upon installation of the version 2, it will probably not be in the same place the operating system is expecting and it will be necessary to update the path according to the output of Step 4.

export PATH=$PATH:/usr/local/bin/aws

 

Now check the version

aws –version

output:

aws-cli/2.0.48 Python/3.7.3 Linux/4.14.193-113.317.amzn1.x86_64 exe/x86_64.amzn.2018

 

Step 6. Optionally, rerun the configure option in order to make sure everything is still there and you will be good to go.

   aws configure

output:

AWS Access Key ID [****************AU4L]:
AWS Secret Access Key [****************cFa+]:
Default region name [us-east-1]:
Default output format [json]:

 

This shows how straightforward updating this valuable tool can be. As one of the three ways of managing Amazon Web Services resources (AWS Console, AWS SDKs and AWS CLI), you will be ready for the task at hand.

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress