How to uninstall aws-cli
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Uninstalling AWS CLI cleanly requires knowing which version and install method you used. AWS CLI v1 is usually installed with pip, while AWS CLI v2 is commonly installed by package manager or bundled installer. If you remove only one path, old binaries or credentials may remain and cause confusing behavior.
Identify Version and Binary Location
Start by checking active version and executable path.
On Windows PowerShell:
Typical version output:
aws-cli/1.xmeans AWS CLI v1.aws-cli/2.xmeans AWS CLI v2.
Record path output before uninstall so you can verify removal later.
Uninstall AWS CLI v1 Installed with pip
If version is v1 and installed through Python tooling, remove with the same pip context used at install time.
If you use pip3:
If installed in a virtual environment, activate that environment first, then run uninstall. For system wide installs, you may need elevated privileges depending on your OS policy.
Uninstall AWS CLI v2 on macOS and Linux
For Homebrew installs on macOS:
For bundled installer layout, remove the symlink and install directory:
Some systems use alternate directories. If which aws points elsewhere, remove that location instead.
On Linux, if you installed with custom flags such as --bin-dir or --install-dir, use your custom paths:
Uninstall AWS CLI v2 on Windows
For MSI or installer based setup:
- Open Settings and navigate to Apps.
- Find
AWS Command Line Interface v2. - Select uninstall.
PowerShell option:
If uninstall entry remains but command is missing, restart shell and confirm PATH cleanup.
Remove AWS Configuration and Credentials if Needed
Uninstalling binaries does not remove AWS profiles or keys stored in user configuration directories. Delete only if you no longer need these credentials.
macOS and Linux:
Windows PowerShell:
If multiple users share a machine, inspect each profile location separately.
Verify Complete Removal
Open a new terminal session and run:
Expected result is command not found or equivalent error. Then check lingering executables:
On Windows:
If a path still appears, remove that binary and review shell PATH entries.
Reinstall Cleanly if Required
If your goal is version migration, reinstall immediately after cleanup using one consistent method only. Mixing package manager and bundled installer on the same machine often leads to path conflicts.
Simple reinstall verification:
This confirms both executable resolution and profile loading.
Automate Verification in CI Images
If you maintain base images, add a short verification step after uninstall so stale binaries do not survive layered image caches.
This check catches partial removal early and keeps build environments consistent.
Common Pitfalls
- Running v1 uninstall commands against a v2 bundled install.
- Forgetting custom install directories used during initial setup.
- Leaving old binary symlinks in PATH after uninstall.
- Assuming uninstall removed credential files automatically.
- Using multiple install methods that conflict on command resolution.
Summary
- Detect AWS CLI version and path before removing anything.
- Use uninstall steps that match install method and operating system.
- Remove leftover symlinks and directories for complete cleanup.
- Delete
~/.awsonly when you intend to remove stored credentials. - Validate removal in a fresh shell so cached paths do not mislead you.
Related reading
- How to unload a table on RedShift to a single CSV file?
- How to update a Map or a List on AWS DynamoDB document API?
- How to update an item in Dynamodb of type String Set SS?
- How to update an item in Dynamodb of type String Set SS?
- How to update Kubernetes Dashboard in hosted Kubernetes on GKE?
- How to update metadata of an existing object in AWS S3 using python boto3?
- How to update multiple items in a DynamoDB table at once
- How to update several attributes of an item in dynamodb using boto3

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.