Setting up AWS CLI on Mac and Windows

Windows

Installer

Download and run the MSI Installer.

Download the AWS CLI setup file

Python, pip and AWS CLI

To install Python 3 and pip

If you don’t have Python 3 and pip install do the following.

Download and install the Python 3 installer from Python.org

Install aws-cli via pip

Using the Windows Command Prompt verify that both python and pip are installed.

python --version
>> Python 3.7.1
pip --version
>> pip 18.1 from c:\program files\python37\lib\site-packages\pip (python 3.7)

Install the aws-cli via pip

pip install awscli

Adding the AWS CLI Executable to your Command Line Path

After installing with pip, add the aws program to your OS’s PATH environment variable. 

  • Python 3 and pip – C:\Program Files\Python37\Scripts\

  • Python 3 and pip –user option – %USERPROFILE%\AppData\Local\Programs\Python\Python37\Scripts

To modify your PATH variable (Windows)

  1. Press the Windows key and type environment variables.

  2. Choose Edit environment variables for your account.

  3. Choose PATH and then choose Edit.

  4. Add paths to the Variable value field, separated by semicolons. For example: C:\existing\path;C:\new\path

  5. Choose OK twice to apply the new settings.

  6. Close any running command prompts and re-open.

Mac

Brew Method

Brew is a package manager that helps install a bunch of packages that apple didn’t include. It can save you a-lot of time. 

Install brew (skip if already installed)

Paste this into the terminal prompt. The script explains what it will do then pauses before it does. 

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install aws-cli

brew install awscli

Pip Method

Check if pip and python is installed.

pip --version

If python is not installed download and install Python 3.6 from Python.org

If pip is not installed run the following provided by the Python Packaging Authority. 

curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py --user

Install aws-cli via pip 

pip install awscli --upgrade --user

Adding the AWS CLI Executable to your Command Line Path

After installing with pip, you may need to add the aws program to your OS’s PATH environment variable. The location of the program depends on where Python is installed.

If you don’t know where it was installed run the following command. The first output path may be to a symlink, so we need to run -al to where it points.

which python
>> /usr/local/bin/python
ls -al /usr/local/bin/python
>> ~/Library/Python/3.7/bin/python3.7

pip installs programs in the same folder that contains the Python program. Add this folder to your PATH variable.

To modify your PATH variable (Linux, macOS, or Unix)

Find your shell’s profile script in your user folder. If you are not sure which shell you have, run echo $SHELL.

ls -a ~
. .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads

Add an export command to your profile script.

export PATH=~/.local/bin:$PATH

This command adds a path, ~/.local/bin in this example, to the current PATH variable.

Load the profile into your current session.

source ~/.bash_profile

Configure AWS-CLI

Check if your AWS CLI install was successful.

aws --version
>> aws-cli/1.15.69 Python/2.7.10 Darwin/18.2.0 botocore/1.10.68     

Configure AWS-CLI with aws configure

aws configure

After this command is run, it will ask for 4 pieces of information:

AWS Access Key ID [****************DXAQ]:
AWS Secret Access Key [****************0lUP]:
Default region name [us-west-1]:
Default output format [None]:

The most important pieces of information are AWS Access Key ID [****************DXAQ]:and AWS Secret Access Key [****************0lUP]:

To get your access key information –

  1. Navigate and sign into AWS Console
  2. Go to the “IAM” section
  3. Click on “Users”
  4. Find you username and click on it
  5. Click on the “Security credentials” and click create access key.

The two other pieces of information remaining are Default region nameand Default output format. Set your region to where you would like your commands to run. I typically leave the output format as None, however text, json and table are available. 

2 comments
0 likes
Prev post: Installing Kubernetes with Kubeadm, quick and dirty!Next post: Nuke / Delete ALL your untracked AWS resources

Related posts

Comments

  • Dell 1130 Not Printing

    January 28, 2021 at 4:46 am
    Reply

    Hi, Thanks for sharing this information. It is really good. Find the right solution form Dell 1130 Not Printing, and get rid from Dell […] Read MoreHi, Thanks for sharing this information. It is really good. Find the right solution form Dell 1130 Not Printing, and get rid from Dell 1130 Printer errors and issues. Read Less

  • Error 10403 Not Found

    January 12, 2021 at 10:03 am
    Reply

    Hi, Thanks for sharing this information with us. It is good and really useful. If you are facing issues during Update Error On Mac, […] Read MoreHi, Thanks for sharing this information with us. It is good and really useful. If you are facing issues during Update Error On Mac, visit Error 10403 Not Found to Solve Update Error Not Found 10403 On Mac. Read Less

Leave a Reply

Your email address will not be published. Required fields are marked *