I am running Ubuntu under WSL2 on Windows 11 and building an AWS CDK project. I recently discovered that I needed to update my AWS CLI from version 1 to 2. I followed the letter the official AWS documentation, but it didn't work. After following it and running aws --version, it is still showing the following (thus indicating that I am still running under v1):
aws-cli/1.22.34 Python/3.10.12 Linux/4.4.0-22621-Microsoft botocore/1.34.43
I tried everything again, and after downloading the package and executing sudo ./aws/install, I get the message: Found same AWS CLI version: /usr/local/aws-cli/v2/2.15.27. Skipping install.
So the above error is saying I already have v2 installed, which is in contradiction to what I see when I run aws --version.
Why is this happening? I expected that upgrading my aws cli version would be a simple one-line command (i.e. just like updating npm). Why did Amazon have to make this so complicated?
How do I fix this?
Run
and you can verify that you have v2 installed and running.
The problem is that your
PATHcontains v1 before, so when you run justawsthat's the version found.