boto3 iot-data 发布的消息未收到
boto3 iot-data published messages not receiving
我正在尝试通过 python Lambda 函数向 AWS IoT 发布消息。
我已在 IoT 控制台上订阅了一个主题 ('test') 并触发了该功能,但消息未送达。
Python 代码段:
iot = boto3.client('iot-data','eu-west-1') res = {
"message" : "Hello!"
}
iot.publish(
topic='test', //do we need to pass the thing name here?
qos=0,
payload=json.dumps(res))
物联网政策:
{ "Version": "2012-10-17", "Statement": [
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
} ] }
此外,我已将正确的 IAM 权限分配给 lambda 函数以发布到 IoT。
非常感谢 pint 我在正确方向上的任何帮助。
想通了,我的 lambda 函数部署在没有互联网连接的 VPC 子网中。创建了一个 NAT 网关,现在子网通过它访问互联网。
P.S- 要将消息发布到物联网 (MQTT) 需要互联网连接。
我正在尝试通过 python Lambda 函数向 AWS IoT 发布消息。
我已在 IoT 控制台上订阅了一个主题 ('test') 并触发了该功能,但消息未送达。
Python 代码段:
iot = boto3.client('iot-data','eu-west-1') res = {
"message" : "Hello!"
}
iot.publish(
topic='test', //do we need to pass the thing name here?
qos=0,
payload=json.dumps(res))
物联网政策:
{ "Version": "2012-10-17", "Statement": [
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
} ] }
此外,我已将正确的 IAM 权限分配给 lambda 函数以发布到 IoT。
非常感谢 pint 我在正确方向上的任何帮助。
想通了,我的 lambda 函数部署在没有互联网连接的 VPC 子网中。创建了一个 NAT 网关,现在子网通过它访问互联网。
P.S- 要将消息发布到物联网 (MQTT) 需要互联网连接。