What domain name should I bake on my IoT device as an IoT MQTT endpoint?

Situation description

Therefore, when I create my super-sensor factory, which will send its indicators every 30 seconds to AWS IoT through MQTT, I have to bake the DNS domain name on the device to which the sensor will connect.

AWS IoT suggests using an endpoint in the form of <random-string>.iot.eu-west-1.amazonaws.com , which for me will look like A26PKG2U6WRS2I.iot.eu-west-1.amazonaws.com

Here's a slightly formatted output from the dig A26PKG2U6WRS2I.iot.eu-west-1.amazonaws.com , which shows that after several redirects this domain name resolves to 6 IP addresses, which seem to be load balancers.

 DOMAIN DETAILS: A26PKG2U6WRS2I.iot.eu-west-1.amazonaws.com. 290 POINTS TO CNAME iotmoonraker.eu-west-1.prod.iot.eu-west-1.amazonaws.com. iotmoonraker.eu-west-1.prod.iot.eu-west-1.amazonaws.com. 254 POINTS TO CNAME dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. RESOLVES TO IPs: dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. 50 IN A 54.229.34.249 dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. 50 IN A 52.19.106.35 dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. 50 IN A 52.18.139.53 dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. 50 IN A 52.48.96.41 dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. 50 IN A 52.19.155.13 dualstack.iotmoonraker-e-elb-9q2vvmxp3rir-1271985754.eu-west-1.elb.amazonaws.com. 50 IN A 54.76.47.209 

Question

I have two problems:

  • When I implement MQTT communication in C for my PIC microcontroller, my DNS resolver confuses many IP addresses that a single domain can resolve. And at the moment I donโ€™t know if I can fix it. At the moment, my solution is to create my own domain name iot-ingestion.domain-i-own.com and point it to one of the IP addresses. Is there a better option?

  • How reliable is the A26PKG2U6WRS2I.iot.eu-west-1.amazonaws.com hostname in my device? What if I want to switch the stack of IoT changes in 2-3 years and switch to another technology / provider?

+5
source share
2 answers

Yes, I would not disclose the "internal" AWS hostname. You should also avoid setting a single IP address. In AWS, IP addresses can quickly change and redirect to other users.

The solution is to really use your own domain name that you manage, but use a CNAME DNS record.

 iot-ingestion.domain-i-own.com CNAME A26PKG2U6WRS2I.iot.eu-west-1.amazonaws.com. 

It may even be worth baking different host names in different versions of the deviceโ€™s firmware, so if there is a problem with one, you can redirect it to another endpoint or completely disable it if it damages your services.

I had good experience using Route 53, Amazon DNS. It can also result in fewer DNS queries from your device to get the full IP address.

+4
source

I believe this post is related. As of June 2019, user domains do not seem to be officially supported for IOT endpoints, but are located on a roadmap. This is a common question of our customers.

This link provides further clarification.

+1
source

Source: https://habr.com/ru/post/1244351/


All Articles