ESP32 AWS Data Communication Issue
Posted: Wed Jun 05, 2019 11:28 am
I am working with two boards having ESP32-WROOM-32U and I am using the example code of ESP-IDF-v3.1.3(examples/protocols/aws_iot). I have an AWS account which I am using for communication between board and server. I am facing a problem in data communication between the AWS server and my boards.
Trying to do:-
So when I am publishing from the server, both my boards are subscribing and getting the data sent from the server. But I want one-on-one communication.
I am trying the following things:
1. I have created an AWS account in which we created two IOT-things with different names and used the IOT-thing names as client ID for the two different board.
2. I have downloaded the AWS-root-ca certificate, Private key(`xxxx-private.pem.key`) and the Certificate file(`xxxx-certificate.pem.crt`) related to the two IOT-things. These keys I have loaded into the respective ESP32 boards by embedding the certificates into the app binary.
3. I have tried attaching different policies(one by one) to the IOT-things. Below are the policy document that I tried
a. policy document 1
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
}
]
}
b. policy document 2
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "arn:aws:iot:us-west-2:157123841039:client/DEVICE2"
}
]
}
c. policy document 3
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect",
"iot:Publish",
"iot:Subscribe"
],
"Resource": "arn:aws:iot:us-west-2:157123841039:thing/DEVICE1"
}
]
}
4. I am using same topic in both the IOT-things and different certificates are being used.
5. At the time of AWS connection, the devices are getting connected to the respective IOT-things which I am monitoring in the AWS activity window of the respective IOT-things. But while publishing the data from the server(from any IOT-thing MQTT client window) the data is getting received by both the two boards. And while I am publishing data form any one board, data is received on both the consoles of both the IOT-things in the MQTT Client window.
Is there any way in which I can make the communication one-on-one between the AWS server and respective board so that when I am publishing from the server both the boards should not get the data. And when I send data from my board can it be visible only on the particular MQTT client window for which I sent the data ?
Please help me with this issue. Thank You.
Trying to do:-
So when I am publishing from the server, both my boards are subscribing and getting the data sent from the server. But I want one-on-one communication.
I am trying the following things:
1. I have created an AWS account in which we created two IOT-things with different names and used the IOT-thing names as client ID for the two different board.
2. I have downloaded the AWS-root-ca certificate, Private key(`xxxx-private.pem.key`) and the Certificate file(`xxxx-certificate.pem.crt`) related to the two IOT-things. These keys I have loaded into the respective ESP32 boards by embedding the certificates into the app binary.
3. I have tried attaching different policies(one by one) to the IOT-things. Below are the policy document that I tried
a. policy document 1
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
}
]
}
b. policy document 2
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "arn:aws:iot:us-west-2:157123841039:client/DEVICE2"
}
]
}
c. policy document 3
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect",
"iot:Publish",
"iot:Subscribe"
],
"Resource": "arn:aws:iot:us-west-2:157123841039:thing/DEVICE1"
}
]
}
4. I am using same topic in both the IOT-things and different certificates are being used.
5. At the time of AWS connection, the devices are getting connected to the respective IOT-things which I am monitoring in the AWS activity window of the respective IOT-things. But while publishing the data from the server(from any IOT-thing MQTT client window) the data is getting received by both the two boards. And while I am publishing data form any one board, data is received on both the consoles of both the IOT-things in the MQTT Client window.
Is there any way in which I can make the communication one-on-one between the AWS server and respective board so that when I am publishing from the server both the boards should not get the data. And when I send data from my board can it be visible only on the particular MQTT client window for which I sent the data ?
Please help me with this issue. Thank You.