【发布时间】:2021-06-17 00:00:48
【问题描述】:
我对 web 和 stackoverflow 进行了研究,但没有找到解决方案。 我在将设备 MOXA 5105 与 AWS 连接时遇到问题。设备发布数据like here
我在 AWS 上看到了该连接,但在测试客户端中我没有看到 JSON。 在 CloudWatch 日志中我看到了这个:
{
"timestamp": "2021-06-16 06:09:48.771",
"logLevel": "ERROR",
"traceId": "XXXXXX-ebb3-XXXX-XXXXX-XXXXXXXXXXX",
"accountId": "XXXXXXXXXXXX",
"status": "Failure",
"eventType": "Publish-In",
"protocol": "MQTT",
"topicName": "MGate_5105_Test",
"clientId": "MGate_5105_Test",
"principalId": "CERTIFICATCODEXXXX",
"sourceIp": "5.226.117.166",
"sourcePort": 55194
}
我在 AWS IOT 中编写的政策如下:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:client/MGate_5105_Test"
},
{
"Effect": "Allow",
"Action": "iot:Receive",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:topic/#"
},
{
"Effect": "Allow",
"Action": "iot:Publish",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:topic/MGate_5105_Test/#"
},
{
"Effect": "Allow",
"Action": "iot:Subscribe",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:topicfilter/MGate_5105_Test/#"
},
{
"Effect": "Allow",
"Action": "iot:UpdateThingShadow",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:thing/MGate_5105_Test"
},
{
"Effect": "Allow",
"Action": "iot:GetThingShadow",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:thing/MGate_5105_Test"
},
{
"Effect": "Allow",
"Action": "iot:DeleteThingShadow",
"Resource": "arn:aws:iot:eu-central-1:XXXXXXXXXXXXXX:thing/MGate_5105_Test"
}
]
}
其中 clientID=事物名称以使其更简单
【问题讨论】:
标签: amazon-web-services mqtt aws-iot