Several years ago before the unified AWS CLI was released I wrote about installing the EC2 command line tools. Now it’s time to update that.
It goes without saying that over the decade Amazon has been providing cloud services their interfaces and tools have matured greatly (along with their overall offerings). Early on Amazon didn’t even have web console and we had to rely on a disparate offering of command line tools for managing S3, EC2, ELB, etc. Finally, in the fall of 2013 Amazon released the AWS CLI, which is a unified set of command line tools that works similarly across platforms (Windows, Linux, Mac) and across AWS services. It’s definitely nice to use the same (or nearly the same) syntax on both Windows and Linux machines to perform various functions.
Installing AWS CLI on Linux (Ubuntu)
The easiest way I’ve found to install and update the AWS CLI on Ubuntu (and Debian-based linux distros) is using apt, with this simple one-liner:
sudo apt install awscli -y
Once installed or updated check the version with:
Installing AWS CLI on Windows
Assuming you are installing on Windows 2008 R2 or later, we’ll leverage the native capability of PowerShell to use Invoke-WebRequest (AKA wget) to retrieve the latest installer. I’m also assuming you have a directory c:temp. If not, create it or use a directory of your choosing. Note: these steps can be used to update the AWS CLI to the latest version as well. If you aren’t running at least PS v3 you can update PowerShell to get this functionality. And, you’ll have to restart PowerShell if you are doing a new install of the AWS CLI to access them.
To download the latest version of the installer in PowerShell run:
wget -uri https://s3.amazonaws.com/aws-cli/AWSCLI64.msi -OutFile c:tempAWSCLI64.msi
Once the CLI is installed and configured you can run various commands to test connectivity to AWS services.
aws s3 ls s3:// (list all S3 buckets)
aws ec2 describe-instances