In this lesson, you will download and install the AWS CLI for your host machine’s operating system, retrieve AWS Identity and Access Management (IAM) user access credentials to manage services with the AWS CLI, configure the AWS CLI, and finally test that the AWS CLI is working properly.
In the Getting Started tutorial, you installed and used PlatformIO (PIO) and the PIO terminal window. The PIO terminal window pre-loads additional applications and libraries that your standard terminal/command prompt might not have. It is important to continue to use the PIO terminal window for all following steps.
If you closed Visual Studio Code (VS Code) or don’t have the terminal viewport with the PlatformIO CLI displayed, complete the following steps:
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. You can control multiple AWS services from the command line and automate them through scripts with just one tool. To configure the AWS CLI, you must have an AWS account.
Issue the following commands to download and install the latest AWS CLI version 2 for 64-bit Linux:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install
For additional information and instructions, see Installing or updating the latest version of the AWS CLI .
AWS Identity and Access Management (IAM) is a web service that helps you securely control access to AWS resources. As a best practice, we recommend to create an administrative user instead of using your root user account.
To retrieve your IAM user’s access credentials, follow the instructions outlined in the Quick configuration with aws configure documentation.
With the AWS CLI installed and the IAM user access credentials in hand, it’s time to configure the AWS CLI.
One of the settings you will configure is the
. Keep in mind that the Region you’re currently using stays consistent. For purposes of this tutorial, we use
us-west-2 as the standard Region. Using a different Region or unknowingly changing Regions can cause other challenges in subsequent steps, including
regional service availability
Issue the following command in the terminal viewport to configure the AWS CLI on your host machine:
The CLI prompts you to input four parameters. Complete the information similar to the following example. Note: The AWS Access Key ID and AWS Secret Access Key must match the information that you retrieved for your IAM user.
With the AWS CLI configured, it is time to test that everything is configured correctly. Let’s begin with a simple test. Run the following command to confirm the AWS CLI version that’s installed:
Next, verify that the AWS CLI is configured with your IAM credentials and is using the us-west-2 (US West (Oregon)) Region. Run the following command to check your MQTT broker endpoint for AWS IoT.
aws iot describe-endpoint --endpoint-type iot\:Data-ATS
It should return an address with the pattern
xxxxxxxx-ats.iot.us-west-2.amazonaws.com. Take a moment to copy and paste the endpoint to a secure location. If you receive an error, see the troubleshooting guide mentioned previously on this page.
Now that everything is installed and configured, continue to the next lesson, Device Provisioning .
AWS IoT Kit now features direct access to
, which is a community-driven, questions-and-answers service. Search re:Post using the
Core2 for AWS
tag to see if your question has been asked and answered. If not, ask a new question using the
Core2 for AWS tag.