In this exercise, you will learn how to install the AWS CLI in your operating system (OS).
By the end of this exercise, you should be able to do the following:
An AWS Command Line Interface (AWS CLI) is a unified tool that provides a consistent interface for interacting with all parts of Amazon Web Services (AWS) directly from the command line. It allows users to control multiple AWS services and automate them through scripts.
There are different ways to install the AWS CLI, depending on your operating system (OS) or preference to use containers.
To install the AWS CLI v2: lnstalling or updating the latest version of the AWS CLI.
In this task, you will install AWS CLI to your local computer with macOS, Windows OS, and Linux OS.
This task looks super long, but you're not doing all of it - make sure you're only focusing on the OS that's relevant to you!
Here's the procedure on how you will install the AWS CLI on your Windows OS computer. If you're not using Windows OS, you can skip this.
1. Download and run the AWS CLI MSI installer for Windows (64-bit): https://awscli.amazonaws.com/AWSCLIV2.msi
2. Locate the file from your Downloads folder or any folder that you store the file, once located, double-click the file.
3. Click Run.
4. Wait a couple of seconds if you encounter this. Once the Next button is available, click Next.
5. Accept the License Agreement, and then choose Next.
6. On the Custom Setup, just click Next. It indicates that the AWS CLI v2 is the feature to be installed, requiring 10MB of space on the hard drive. The default installation location is "C:\Program Files\Amazon\AWSCLIV2". You have the option to change the installation directory.
7. Finally, click Install. For some users, User Account Control will appear. Click Yes to continue the installation.
8. Once the AWS CLI is installed, you can run aws --version command in your command line and see the following output (the version may be different). You may run this through Windows Powershell or Command Prompt (CMD).
Here's how you will install AWS CLI on your Linux OS computer. If you're not using Linux OS, you can skip this.
1. Download the installation file. Follow the command below.
2. Unzip the installer. The following example command unzips the package and creates a directory named aws under the current directory.
3. Run the install program. The installation command uses a file named install in the newly unzipped aws directory. By default, the files are all installed to /usr/local/aws-cli, and a symbolic link is created in /usr/local/bin. The command includes sudo to grant write permissions to those directories.
You can install without sudo if you specify directories that you already have write permissions to. Use the following instructions for the install command to specify the installation location:
4. Once the installation is finished, confirm the installation with the following command.
If the aws command cannot be found, you might need to restart your terminal or follow the troubleshooting in Troubleshoot AWS CLI errors.
3. You can choose to install the AWS CLI in the following ways. The access permissions will be different depending on your choice, we recommend going with Install for all users of this computer (as the second and third require a complex setup process).
4. Press Continue until you reach the end, and press OK when you reach the pop-up about accessing files in your Downloads folder.
5. You should reach a success page!
Phew! That was a bit of a mission. We promise it gets easier from here.
In this task, you will enable the AWS CLI access to the IAM user that you will use.
Now that you've created the access keys for your IAM users, you can access your AWS resources through AWS CLI. Everything you do in the AWS Management Console you can do as well using AWS CLI.
1. To access your AWS resources using AWS CLI, open a terminal (for macOS and Linux) or Windows Powershell, Command Prompt (for Windows).
2. Type the command aws configure and it will ask for the following:
Sick! You have now access to your AWS resources through CLI.
Aside from Windows Powershell or terminal for macOS/Linux OS, there's an alternative way to interact with your AWS resources. This is the AWS CloudShell.
Recap: AWS CloudShell is a browser-based command line interface (CLI) provided by AWS that allows you to directly manage and interact with AWS resources. It comes with a set of tools installed, such as the AWS CLI.
1. To navigate to AWS CloudShell, just simply click the CloudShell icon in the upper right corner beside the notification icon or in the lower left-hand corner of your AWS Management Console home page.
2. You can start by running the command aws configure. Similar to what you did in the previous task.
Congratulations! You've completed the hands-on exercise! You have successfully:
Let that sink in - you've just used a completely new way to interact with your AWS resources! That's freaking awesome. Next, let's dive into how we can use it to manage a resource.