esp-aws-iot icon indicating copy to clipboard operation
esp-aws-iot copied to clipboard

Error(-12) connecting to ac6aacx09z5rv-ats.iot.us-east- 2.amazonaws.com:8883 (CA-72)

Open nguyentranho opened this issue 4 years ago • 4 comments

I'm constantly running into this error without any clue. Could you give some hints?

nguyentranho avatar Jul 11 '20 02:07 nguyentranho

@nguyentranho , can you give some more details? Especially these:

  • Have you created the thing and certificate and attached appropriate policy?
  • Have you verified that everything works fine with other MQTT clients (say mosquitto) or direct AWS IoT HTTP APIs from a host machine in the same network?
  • Do you always see this error or is it intermittent?

shahpiyushv avatar Jul 13 '20 13:07 shahpiyushv

Hi, I have fixed it with following policy. I'm still confused about its syntax. I was trying to explicitly set the filter to "topic/esp32/sub" but it always replies with -12 error { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iot:*", "Resource": "arn:aws:iot:us-east-2:438468228341:*" } ] }

nguyentranho avatar Jul 15 '20 08:07 nguyentranho

@nguyentranho , you can use wildcards in your resources, but if you want the policy to be more restrictive, for Publish and Receive, the Resource is in this format: "arn:aws:iot:*:*:topic/<your-topic>". For subscribe, it is "arn:aws:iot:*:*:topicfilter/<your-topic>", and for connect, it is "arn:aws:iot:*:*:client/<client-id>"

shahpiyushv avatar Jul 18 '20 18:07 shahpiyushv

I had the similar issue, I solved by creating a policy and properly editing the resources in connect, publish and subscribe.

ujur007 avatar Jul 20 '21 13:07 ujur007