我是这个AWS IoT的新手。我在创建事物时遇到问题。为此,我仔细阅读了这份文档:
https://docs.aws.amazon.com/iot/latest/apireference/API_CreateThing.html
我的授权有问题。我收到此错误:
无法打开与xxxxxx.iot.us-east.amazonaws.com:443的TCP连接 (getaddrinfo:名称或服务未知)
答案 0 :(得分:0)
我通过以下方式在AWS IoT上创建了东西:
class AwsIotService
def self.create_thing(thing_name)
begin
iot = Aws::IoT::Client.new(region: ENV['AWS_REGION'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'])
iot.create_thing(thing_name: thing_name)
rescue Aws::IoT::Errors::ServiceError
end
end
end