1 Risposta
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
0
I tried it in an EC2 environment with AWS CLI.
aws iot-data publish --topic esp32/sub --payload '{"a":"b"}' --region ap-northeast-1 --debug
EndpointConnectionError: Could not connect to the endpoint URL: "https://data.iot.ap-northeast-1.amazonaws.com/topics/esp32%2Fsub"
2022-06-25 11:57:35,520 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
Could not connect to the endpoint URL: "https://data.iot.ap-northeast-1.amazonaws.com/topics/esp32%2Fsub"
It seems to be trying to connect to the data endpoint
instead of data-ats endpoint
It appears that only ats-data is provided for VPC endpoints. https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html
I was able to Publish correctly by explicitly specifying the endpoint.
aws iot-data publish --topic esp32/sub --payload '{"a":"b"}' --region ap-northeast-1 --debug --endpoint https://a2klze32u5vkt3-ats.iot.ap-northeast-1.amazonaws.com
2022-06-25 11:57:55,896 - MainThread - urllib3.connectionpool - DEBUG - https://a2klze32u5vkt3-ats.iot.ap-northeast-1.amazonaws.com:443 "POST /topics/esp32%2Fsub HTTP/1.1" 200 65
2022-06-25 11:57:55,897 - MainThread - botocore.parsers - DEBUG - Response headers: {'date': 'Sat, 25 Jun 2022 11:57:55 GMT', 'x-amzn-RequestId': '2740292f-48b4-3fca-2fe6-11f6bbfaf895', 'content-length': '65', 'content-type': 'application/json', 'connection': 'keep-alive'}
2022-06-25 11:57:55,897 - MainThread - botocore.parsers - DEBUG - Response body:
{"message":"OK","traceId":"2740292f-48b4-3fca-2fe6-11f6bbfaf895"}
2022-06-25 11:57:55,898 - MainThread - botocore.hooks - DEBUG - Event needs-retry.iot-data-plane.Publish: calling handler <botocore.retryhandler.RetryHandler object at 0x7f2daa776790>
2022-06-25 11:57:55,898 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2022-06-25 11:57:55,898 - MainThread - awscli.formatter - DEBUG - RequestId: 2740292f-48b4-3fca-2fe6-11f6bbfaf895
I have not tried this with boto3, but it might work if you specify an endpoint.
con risposta 2 anni fa
Contenuto pertinente
- AWS UFFICIALEAggiornata 3 anni fa
- AWS UFFICIALEAggiornata 3 anni fa