Prerequisites

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.

If you already have the AWS CLI (version 1 or version 2) installed and configured on your machine, navigate down the page to Test the AWS CLI.

Open the PlatformIO CLI terminal window

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:

  1. Open VS Code, if necessary.
  2. Choose the PlatformIO logo on the VS Code activity bar.
  3. From the Quick Access menu, expand Miscellaneous, and select New Terminal. The terminal viewport should load with a new terminal labeled PlatformIO CLI.

    PlatformIO CLI terminal in VS Code

Download and install the AWS CLI

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.

  • If you do not have a personal AWS account, sign in to AWS console or create an AWS account before proceeding.
  • Once complete, choose the appropriate operating system from the following list and complete the instructions to install the AWS CLI:
Ubuntu Linux v18.0+ (64-bit)
MacOS 10.14+
Windows 10 (64-bit)

For additional information and instructions, see Installing or updating the latest version of the AWS CLI .

Retrieve the IAM user access credentials

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.

Configure the AWS CLI

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 AWS Region . 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:

aws configure

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.

  • AWS Access Key ID [None]: EXAMPLEKEYIDEXAMPLE
  • AWS Secret Access Key [None]: EXAMPLEtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  • Default region name [None]: us-west-2
  • Default output format [None]: json

Test the AWS CLI

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:

aws --version
If you receive errors, see Troubleshooting AWS CLI errors .

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 .


Questions? Please use M5Stack Forum

AWS IoT Kit now features direct access to M5Stack Forum , 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.