Connecting to Amazon IoT Core service endpoints - Amazon IoT Core
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Connecting to Amazon IoT Core service endpoints

You can access the features of the Amazon IoT Core - control plane by using the Amazon CLI, the Amazon SDK for your preferred language, or by calling the REST API directly. We recommend using the Amazon CLI or an Amazon SDK to interact with Amazon IoT Core because they incorporate the best practices for calling Amazon services. Calling the REST APIs directly is an option, but you must provide the necessary security credentials that enable access to the API.

Note

IoT devices should use Amazon IoT Device SDKs. The Device SDKs are optimized for use on devices, support MQTT communication with Amazon IoT, and support the Amazon IoT APIs most used by devices. For more information about the Device SDKs and the features they provide, see Amazon IoT Device SDKs.

Mobile devices should use Amazon Mobile SDKs. The Mobile SDKs provide support for Amazon IoT APIs, MQTT device communications, and the APIs of other Amazon services on mobile devices. For more information about the Mobile SDKs and the features they provide, see Amazon Mobile SDKs.

You can use Amazon Amplify tools and resources in web and mobile applications to connect more easily to Amazon IoT Core. For more information about connecting to Amazon IoT Core by using Amplify, see Pub Sub Getting Started in the Amplify documentation.

The following sections describe the tools and SDKs that you can use to develop and interact with Amazon IoT and other Amazon services. For the complete list of Amazon tools and development kits that are available to build and manage apps on Amazon, see Tools to Build on Amazon.

Amazon CLI for Amazon IoT Core

The Amazon CLI provides command-line access to Amazon APIs.

For tools to manage Amazon services and resources in the PowerShell scripting environment, see Amazon Tools for PowerShell.

Amazon SDKs

With Amazon SDKs, your apps and compatible devices can call Amazon IoT APIs and the APIs of other Amazon services. This section provides links to the Amazon SDKs and to the API reference documentation for the APIs of the Amazon IoT Core services.

C++

To install the Amazon SDK for C++ and use it to connect to Amazon IoT:

  1. Follow the instructions in Getting Started Using the Amazon SDK for C++

    These instructions describe how to:

    • Install and build the SDK from source files

    • Provide credentials to use the SDK with your Amazon Web Services account

    • Initialize and shutdown the SDK in your app or service

    • Create a CMake project to build your app or service

  2. Create and run a sample app. For sample apps that use the Amazon SDK for C++, see Amazon SDK for C++ Code Examples.

Go

To install the Amazon SDK for Go and use it to connect to Amazon IoT:

  1. Follow the instructions in Getting Started with the Amazon SDK for Go

    These instructions describe how to:

    • Install the Amazon SDK for Go

    • Get access keys for the SDK to access your Amazon Web Services account

    • Import packages into the source code of our apps or services

  2. Create and run a sample app. For sample apps that use the Amazon SDK for Go, see Amazon SDK for Go Code Examples.

Java

To install the Amazon SDK for Java and use it to connect to Amazon IoT:

  1. Follow the instructions in Getting Started with Amazon SDK for Java 2.x

    These instructions describe how to:

    • Sign up for Amazon and Create an IAM User

    • Download the SDK

    • Set up Amazon Credentials and Region

    • Use the SDK with Apache Maven

    • Use the SDK with Gradle

  2. Create and run a sample app using one of the Amazon SDK for Java 2.x Code Examples.

  3. Review the SDK API reference documentation

JavaScript

To install the Amazon SDK for JavaScript and use it to connect to Amazon IoT:

  1. Follow the instructions in Setting Up the Amazon SDK for JavaScript. These instructions apply to using the Amazon SDK for JavaScript in the browser and with Node.JS. Make sure you follow the directions that apply to your installation.

    These instructions describe how to:

    • Check for the prerequisites

    • Install the SDK for JavaScript

    • Load the SDK for JavaScript

  2. Create and run a sample app to get started with the SDK as the getting started option for your environment describes.

.NET

To install the Amazon SDK for .NET and use it to connect to Amazon IoT:

  1. Follow the instructions in Setting up your Amazon SDK for .NET environment

  2. Follow the instructions in Setting up your Amazon SDK for .NET project

    These instructions describe how to:

    • Start a new project

    • Obtain and configure Amazon credentials

    • Install Amazon SDK packages

  3. Create and run one of the sample programs in Working with Amazon services in the Amazon SDK for .NET

  4. Review the SDK API reference documentation

PHP

To install the Amazon SDK for PHP and use it to connect to Amazon IoT:

  1. Follow the instructions in Getting Started with the Amazon SDK for PHP Version 3

    These instructions describe how to:

    • Check for the prerequisites

    • Install the SDK

    • Apply the SDK to a PHP script

  2. Create and run a sample app using one of the Amazon SDK for PHP Version 3 Code Examples

Python

To install the Amazon SDK for Python (Boto3) and use it to connect to Amazon IoT:

  1. Follow the instructions in the Amazon SDK for Python (Boto3) Quickstart

    These instructions describe how to:

    • Install the SDK

    • Configure the SDK

    • Use the SDK in your code

  2. Create and run a sample program that uses the Amazon SDK for Python (Boto3)

    This program displays the account's currently configured logging options. After you install the SDK and configure it for your account, you should be able to run this program.

    import boto3 import json # initialize client iot = boto3.client('iot') # get current logging levels, format them as JSON, and write them to stdout response = iot.get_v2_logging_options() print(json.dumps(response, indent=4))

    For more information about the function used in this example, see Configure Amazon IoT logging.

Documentation for the Amazon IoT Core services that the Amazon SDK for Python (Boto3) supports

Ruby

To install the Amazon SDK for Ruby and use it to connect to Amazon IoT:

Amazon Mobile SDKs

The Amazon Mobile SDKs provide mobile app developers platform-specific support for the APIs of the Amazon IoT Core services, IoT device communication using MQTT, and the APIs of other Amazon services.

Android

Amazon Mobile SDK for Android

The Amazon Mobile SDK for Android contains a library, samples, and documentation for developers to build connected mobile applications using Amazon. This SDK also includes support for MQTT device communications and calling the APIs of the Amazon IoT Core services. For more information, see the following:

iOS

Amazon Mobile SDK for iOS

The Amazon Mobile SDK for iOS is an open-source software development kit, distributed under an Apache Open Source license. The SDK for iOS provides a library, code samples, and documentation to help developers build connected mobile applications using Amazon. This SDK also includes support for MQTT device communications and calling the APIs of the Amazon IoT Core services. For more information, see the following:

REST APIs of the Amazon IoT Core services

The REST APIs of the Amazon IoT Core services can be called directly by using HTTP requests.