Connecting to AWS IoT Core service endpoints - AWS IoT Core

Connecting to AWS IoT Core service endpoints

You can access the features of the AWS IoT Core - control plane by using the AWS CLI, the AWS SDK for your preferred language, or by calling the REST API directly. We recommend using the AWS CLI or an AWS SDK to interact with AWS IoT Core because they incorporate the best practices for calling AWS 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 AWS IoT Device SDKs. The Device SDKs are optimized for use on devices, support MQTT communication with AWS IoT, and support the AWS IoT APIs most used by devices. For more information about the Device SDKs and the features they provide, see AWS IoT Device SDKs.

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

You can use AWS Amplify tools and resources in web and mobile applications to connect more easily to AWS IoT Core. For more information about connecting to AWS 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 AWS IoT and other AWS services. For the complete list of AWS tools and development kits that are available to build and manage apps on AWS, see Tools to Build on AWS.

AWS CLI for AWS IoT Core

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

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

AWS SDKs

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

C++
To install the AWS SDK for C++ and use it to connect to AWS IoT:
  1. Follow the instructions in Getting Started Using the AWS SDK for C++

    These instructions describe how to:

    • Install and build the SDK from source files

    • Provide credentials to use the SDK with your AWS 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 AWS SDK for C++, see AWS SDK for C++ Code Examples.

Go
To install the AWS SDK for Go and use it to connect to AWS IoT:
  1. Follow the instructions in Getting Started with the AWS SDK for Go

    These instructions describe how to:

    • Install the AWS SDK for Go

    • Get access keys for the SDK to access your AWS 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 AWS SDK for Go, see AWS SDK for Go Code Examples.

Java
To install the AWS SDK for Java and use it to connect to AWS IoT:
  1. Follow the instructions in Getting Started with AWS SDK for Java 2.x

    These instructions describe how to:

    • Sign up for AWS and Create an IAM User

    • Download the SDK

    • Set up AWS 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 AWS SDK for Java 2.x Code Examples.

  3. Review the SDK API reference documentation

JavaScript
To install the AWS SDK for JavaScript and use it to connect to AWS IoT:
  1. Follow the instructions in Setting Up the AWS SDK for JavaScript. These instructions apply to using the AWS 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 AWS SDK for .NET and use it to connect to AWS IoT:
  1. Follow the instructions in Setting up your AWS SDK for .NET environment

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

    These instructions describe how to:

    • Start a new project

    • Obtain and configure AWS credentials

    • Install AWS SDK packages

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

  4. Review the SDK API reference documentation

PHP
To install the AWS SDK for PHP and use it to connect to AWS IoT:
  1. Follow the instructions in Getting Started with the AWS 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 AWS SDK for PHP Version 3 Code Examples

Python
To install the AWS SDK for Python (Boto3) and use it to connect to AWS IoT:
  1. Follow the instructions in the AWS 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 AWS 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 AWS IoT logging.

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

AWS Mobile SDKs

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

Android

AWS Mobile SDK for Android

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

iOS

AWS Mobile SDK for iOS

The AWS 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 AWS. This SDK also includes support for MQTT device communications and calling the APIs of the AWS IoT Core services. For more information, see the following:

REST APIs of the AWS IoT Core services

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