Open In App

DynamoDB – Setup the AWS CLI on macOS

Last Updated : 01 Aug, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

We can use the AWS Command Line Interface (AWS CLI) to control multiple AWS services from the command line and automate them through scripts. We can use the AWS CLI for ad hoc operations, such as creating a table. We can also use it to embed Amazon DynamoDB operations within utility scripts. Before you can use the AWS CLI with DynamoDB, you must get an access key ID and secret access key.

The AWS CLI is available at http://aws.amazon.com/cli. It runs on Windows, macOS, or Linux. 

Installing the AWS CLI on macOS

The AWS CLI version 2 has no dependencies on other Python packages. It has a self-contained, embedded copy of Python included in the installer.

Prerequisites for macOS:

  • It supports the AWS CLI version 2 on Apple-supported versions of 64-bit macOS.
  • Because AWS doesn’t maintain third-party repositories, we can’t guarantee that they contain the latest version of the AWS CLI.

Installation:

The following steps show how to install the latest version of the AWS CLI version 2 by using the standard macOS user interface and your browser:

  • In your browser, download the macOS pkg file: https://awscli.amazonaws.com/AWSCLIV2.pkg
  • Double-click the downloaded file to launch the installer.
  • Follow the on-screen instructions. If you have sudo permissions, you can install the AWS CLI version 2 for all users on the computer. Download the file using the curl command. The -o option specifies the file name that the downloaded package is written to. In this example, the file is written to AWSCLIV2.pkg in the current folder.
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

  • Run the standard macOS installer program, specifying the downloaded .pkg file as the source. Use the -pkg parameter to specify the name of the package to install, and the -target / parameter for which drive to install the package to. The files are installed to /usr/local/aws-cli, and a symlink is automatically created in /usr/local/bin. You must include sudo on the command to grant write permissions to those folders.
sudo installer -pkg ./AWSCLIV2.pkg -target /

This will install the AWS CLI version 2 in your macOS system.

Uninstall the AWS CLI on macOS

To uninstall the AWS CLI version 2, run the following commands, substituting the paths you used to install.

  • Find the folder that contains the symlinks to the main program and the completer.
which aws
/usr/local/bin/aws

  • Using that information, run the following command to find the installation folder that the symlinks point to.
ls -l /usr/local/bin/aws

  • Delete the two symlinks in the first folder. If your user account already has written permission to these folders, you don’t need to use sudo.
sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer

  • Delete the main installation folder. Use sudo to gain write access to the /usr/local folder.
sudo rm -rf /usr/local/aws-cli


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads