Working with the IoT API

0

This is probably a silly question, but I see plenty of decent documentation around working with AWS IoT API, but I can't seem to figure out what the actual endpoint is. Where are we making the call?

While testing I'd like to interact with IoT Core via Postman.

Do we make the call against the device data endpoint? ie.

https://abcd1234-ats.iot.us-east-1.amazonaws.com

If so, can we also use our domain configuration if we set it? ie.

https://iotcore.mydomain.com

Is it like this?

POST https://abcd1234-ats.iot.us-east-1.amazonaws.com/wireless-devices

asked a year ago206 views
3 Answers
2
Accepted Answer

Not a silly question at all. There are multiple endpoints for interacting with AWS IoT Core. If you are trying to interact with devices on the data plane endpoint, you want to use your custom service endpoint, which can be fetched with aws iot describe-endpoint --endpoint-type iot:Data-ATS. The endpoint returned is what you would plug into Postman as the base URL.

The example in the last part of your post references "wireless-devices" though, which makes me wonder if you are trying to interact with devices connected through AWS IoT Core for LoRaWAN. This service uses separate endpoints for control plane and data plane, which can be found here: https://docs.aws.amazon.com/general/latest/gr/iot-core.html#iot-wireless_region.

Finally, the question about the custom domain configuration should work with Postman once you set up a custom domain, but please note that the only service endpoint you can setup with a custom domain is the AWS IoT Core data plane endpoint. This doesn't work with the AWS IoT Core control plane, other data plane endpoints like Jobs or CredentialProvider, or other data endpoints like the AWS IoT Core for LoRaWAN endpoint mentioned above.

I found a post on Stack Overflow that has some notes on using Postman to connect here: https://stackoverflow.com/questions/52814373/http-post-to-aws-iot

(For other readers, the best place to start for an introduction to AWS IoT Core endpoints is here.)

Ryan_B
answered a year ago
2

There are no silly questions at re:Post ;) Let me disambiguate the concept of "endpoint" in AWS ioT a bit.

AWS IoT Core for LoRaWAN control plane API endpoints : these ones are what you most probably need to use based on the example you provided

You can find an overview of endpoints for AWS IoT API for control plane here: https://docs.aws.amazon.com/general/latest/gr/iot-core.html#iot-wireless_region

You can find APIs for IoT Wireless here: https://docs.aws.amazon.com/iot-wireless/2020-11-22/apireference/API_Operations.html, e.g. take a look at https://docs.aws.amazon.com/iot-wireless/2020-11-22/apireference/API_ListWirelessDevices.html

If using postman, you should combine the control plane endpoint and the API call: GET https://api.iotwireless.us-east-1.amazonaws.com/wireless-devices

You should also use Postman's AWS authentication capabilities: https://learning.postman.com/docs/sending-requests/authorization/#aws-signature

As a side remark, when developing applications using one of our SDK https://aws.amazon.com/tools/ is a recommended approach to interact with AWS IoT control plane APIs. You could also use AWS CLI e.g.

 aws iotwireless list-wireless-devices

** AWS IoT Core Data plane endpoints for MQTT and HTTP ingestion**

Please note that the above approach applies to the control plane APIs. AWS IoT Core also offers endpoints like abcddef-ats.iot.us-east-1.amazonaws.com. There are data plane endpoints for the protocols you see here: https://docs.aws.amazon.com/iot/latest/developerguide/protocols.html. Because you are using AWS IoT core for LoRaWAN, these endpoints are not relevant for your solution. If you ever want to use data plane endpoints to publish via HTTPS, you would say:

aws iot describe-endpoint --endpoint-type iot:Data-ATS
curl --tlsv1.2 \
    --cacert Amazon-root-CA-1.pem \
    --cert device.pem.crt \
    --key private.pem.key \
    --request POST \
    --data "{ \"message\": \"Hello, world\" }" \
    "https://IoT_data_endpoint:8443/topics/topic?qos=1"

Details are here: https://docs.aws.amazon.com/iot/latest/developerguide/http.html

** AWS IoT core for LoRaWAN LNS and CUPS endpoints**

To make it complete, AWS IoT core for LoRaWAN offers endpoints for your LoRaWAN gateway to connect, you will find more info here

https://docs.aws.amazon.com/iot-wireless/2020-11-22/apireference/API_GetServiceEndpoint.html

To get CUPS or LNS endpoints using AWS CLI, you could call:

 aws iotwireless get-service-endpoint
answered a year ago
0

Terrific thank you both. Was able to get it working with both of your answers!

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions