IoT user
IoT user

Reputation: 1300

Connect gateway to AWS IoT

I want to connect an external gateway which recieves data from mqtt devices to my AWS IoT Core.

In this picture you can find (more or less) an overview of the project.

Details of the project

To summarize, I would like to connect the IoT Gateway of the previous picture to AWS IoT Core.

I have seen a lot of examples about similar topics, but in none of them I can find what I want to do.

Is it possible to do it only by knowing the hostname/endpoint of my AWS cloud account and put it in my getaway to send data to that host?

How can I find my AWS hostname/endpoint? Is this valid: aws iot describe_endpoint?

After putting the host name in the external gateway I will create the subscription in the IoT Core.

The most similar tutorial that I have found was this:

https://aws.amazon.com/es/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/

But instead of build a bridge between Mosquitto and AWS IoT, I will send directly the data from the gateway to AWS IoT.

If this is not the correct way, How I should do it?

Thanks!

Upvotes: 1

Views: 1013

Answers (2)

IoT user
IoT user

Reputation: 1300

I just made it work folowing the tutorial:

https://aws.amazon.com/es/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/

But instead of using a .conf file in mosquitto I had to do it in CMD:

    mosquitto_pub --cafile rootCA.pem --cert certificate.pem.crt --key private.pem.key -h XXXX.iot.eu-west-2.amazonaws.com -p 8883 -q 1 -d -t topic -m "testing"

Upvotes: 1

Keivan
Keivan

Reputation: 1779

For connecting any device to AWS IoT Core, first the device should be defined as a thing in AWS IoT Service. By defining that, you will get Authorization and Authentication for your gateway which should be placed in to your device. Because the communication between your gateway and AWS IoT broker should be secure. Second, for connecting to AWS IoT broker, one of AWS IoT SDKs should be used. You can find more information about them here. The choice of SDKs depends on your gateway. For example, if it is running OS based on Linux or Windows you can use Python (Boto), if it is Bare-Metal, you can use SDK in Embedded C. You should consider correct policies attached to the certificate of your device. For example, the following policy will allow your device to do all actions described here.

{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:*",
      "Resource": "*"
    }
  ],
  "Version": "2012-10-17"
}

You can find the endpoint address of your IoT core under setting.

Upvotes: 0

Related Questions