AWS For Developers For Dummies
Book image
Explore Book Buy On Amazon
CLI is an essential part of working with AWS, especially for a developer. You can use CLI to perform quick setups, determine whether specific calls worked as intended, obtain status information, and so on. There isn’t anything new about CLI.

After all, developers have used the command prompt or terminal window on desktop systems to perform various tasks for years. In fact, some developers create extensive batch file and script libraries to perform common tasks in the desktop environment. Using CLI with AWS is more of the same, despite the fact that you use it in a cloud environment. However, unlike the command prompt and terminal window, you don’t have CLI installed on your system by default.

Getting started with CLI

The AWS CLI software depends on Python. Consequently, in order to install CLI, you must first install Python. The current version of CLI requires that you have one of the following:
  • Python 2.6.5 or above
  • Python 3.3 or above
Installing Anaconda also installs the pip utility that you use to perform various Python-specific tasks. If you choose not to use Anaconda, you may need to install pip. However, you can check for pip by typing pip --version and pressing Enter at a command prompt or within a terminal window. If pip is present, you see the pip version number, location, and Python version number.

After you know that you have Python and pip installed, type pip install --upgrade awscli and press Enter to install CLI. The install command tells pip to install a package. The --upgrade option tells pip to upgrade any packages required to support CLI. The awscli keyword tells pip what to install, which is the AWS CLI. (Note that Amazon recommends using the --user option, which does install AWS CLI in a different folder, but also makes AWS CLI harder to access and use.)

After you press Enter, pip displays a series of messages telling you about the installation process. When the process completes, you return to the command prompt. At this point, CLI is ready for use.

installing pip for CLI You see installation messages as pip does its work.

To verify that your installation works, type aws --version and press Enter. You see information about AWS CLI. Depending on your setup, you may also see a warning message about a lack of a file association for the .py file type.

AWS CLI Test your AWS CLI setup by checking its version information.

Obtaining additional information and help

As with AWS, CLI is quite complex in its abilities. It has to be, given that you can access every AWS service using it. It would take a book, or even two, devoted to that topic to describe everything CLI can do.

Because of CLI’s complexity, you need to know how to obtain help when you need it to perform specific tasks. The first place to look is on the AWS site. This site provides you with access to tools such as a CLI reference and access to the community forum. The community forum is especially important because you can use it to obtain answers to questions that no one else has thought to ask about and those special situations where it looks like there is a glitch in CLI’s behavior (and it often turns out that there really is one). The AWS site also provides you with usage examples and other useful information for working with CLI.

The second place to look is AWS itself. Type aws help at the command line and press Enter. You see the first page of a multipage help screen. Notice the -- More -- entry at the bottom. This entry tells you there is more information to see. Press the spacebar to see it.

help command AWS Obtain assistance directly from the aws utility using the help command.

The aws help command can provide you with a lot of information. For example, if you want to find out about a specific service, add that service name to the end of the command. To discover more about S3, type aws help s3 and press Enter. You see a list of additional S3 command options. Say that you want to discover more about configuring S3. In this case, you type aws help s3-config and press Enter. The S3 overview help provides you with this more detailed help topic, so you can drill down as you need more information to perform specific tasks.

About This Article

This article is from the book:

About the book author:

John Mueller is an author and technical editor who has written 103 books. Some of his current works include Python development books. He has also written AWS For Admins For Dummies, which provides administrators a great place to start with Amazon Web Services (AWS). John has had an interest in AWS since its inception. In fact, he wrote Mining Amazon Web Services based on that humble beginning. Be sure to read John's blog at http://blog.johnmuellerbooks.com/.

This article can be found in the category: