$ aws -version aws-cli/2.0.47 Python/3.7.4 Linux/4.14.133-113.105.amzn2.x8664 botocore/2.0.0 AWS CLI version 2. The AWS CLI version 2 is the most recent major version of the AWS CLI and supports all of the latest features. On Linux or macOS, you can use the bundled installer to install version 1 of the AWS Command Line Interface (AWS CLI). The bundled installer includes all dependencies and can be used offline. The bundled installer doesn't support installing to paths that contain spaces.
The AWS CLI is a command line utility that lets you deploy and configure services on Amazon Web Services without needing to use the web user interface. This tutorial, will show you how to install it on a Mac and how to configure a user.
Introduction
The AWS CLI can be installed on macOS using the command line or by using the installer wizard. This tutorial will show you how to install it using the installer wizard.
Step 1: Install AWS CLI
Download the latest Amazon CLI installer package from the Amazon Website.
Double click on the downloaded AWSCLIV2.pkg package to start the installer.
Click Continue.
Click Continue.
Click Continue.
Agree to the license terms then click Continue.
Choose whether to install for the current user or all users then click Continue.
Click Continue.
Click Install.
Click Close.
Test the installation
Test the installation was successful by opening a terminal and running the following command:
The output should show the version number of the AWS CLI:
We are now ready to create a user account and configure the AWS CLI to use this account to manage services.
Step 2: Create IAM user with programmatic access
Download macos to usb. Login to the AWS management console then search for IAM in the Find services text field.
Click Users.
Click Add user.
Enter the name of the user, tick the Programmatic access check box, then click the Next: Permissions button.
Click Attach existing policies directly, tick the policies you want the user to have access to, then click the Next: Tags button. In the following example, I have given the user full administrator access, however it’s recommended that you give the user the least amount of privileges possible.
Enter any tags you would like to help you keep users organized then click Next: Review.
Click the Download .csv button to save the access key and secret to your local machine. Make sure it is saved before clicking Close.
The user is now created and we are ready to configure the AWS CLI with the credentials we downloaded above.
Advertisement
Step 3: Configure Credentials
Open the macOS terminal and run the following command:
Enter the AWS Access Key ID and the AWS Secret Access Key when prompted. Choose the default region and output format of json and then the details will be saved to ~/.aws/credentials.
Now we can test to see if the credentials work by running a command, for example list the S3 buckets with:
Conclusion
That’s it. We are now ready to deploy and manage services using the AWS CLI.
Written by: Tony Mackay
AWSDevOpsInstaller
Download and run the MSI Installer.
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.
Install the aws-cli via pip
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 FilesPython37Scripts
- Python 3 and pip –user option –
%USERPROFILE%AppDataLocalProgramsPythonPython37Scripts
To modify your PATH variable (Windows)
- Press the Windows key and type
environment variables
. - Choose Edit environment variables for your account.
- Choose PATH and then choose Edit.
- Add paths to the Variable value field, separated by semicolons. For example:
C:existingpath
;
C:newpath
- Choose OK twice to apply the new settings.
- Close any running command prompts and re-open.
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.
Install aws-cli
Pip Method
Check if pip and python is installed.
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.
Install aws-cli via pip
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.
pip
installs programs in the same folder that contains the Python program. Add this folder to your PATH
variable.Aws Cli Download Mac Iso
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
.- Bash –
.bash_profile
,.profile
, or.bash_login
- Zsh –
.zshrc
- Tcsh –
.tcshrc
,.cshrc
or.login
.
Add an export command to your profile script.
This command adds a path,
~/.local/bin
in this example, to the current PATH variable.![Aws Cli Download Mac Aws Cli Download Mac](/uploads/1/2/7/7/127702843/447409793.png)
Load the profile into your current session.
Check if your AWS CLI install was successful.
Configure AWS-CLI with aws configure
After this command is run, it will ask for 4 pieces of information:
The most important pieces of information are
AWS Access Key ID [****************DXAQ]:
and AWS Secret Access Key [****************0lUP]:
To get your access key information –
- Navigate and sign into AWS Console
- Go to the “IAM” section
- Click on “Users”
- Find you username and click on it
- Click on the “Security credentials” and click create access key.
Aws Cli 2 Download
The two other pieces of information remaining are
Default region name
and 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. Related posts
Aws Cli Download Mac Installer
- Quick Guide: Setting up AWS CLI with MFA / Cross-Account Roles March 20, 2019
- GuardDuty in a multi-account organization with Terraform February 1, 2019
- Testing Lambdas locally with aws-sam-cli January 4, 2019