首页 > 解决方案 > AWS IoT 核心:批量注册失败

问题描述

我试图找出在 AWS IoT Core 中批量注册 IoT 设备的可能性,这使我找到了这些指南: 指南 1指南 2

我已经到了需要运行aws iot start-thing-registration-task命令的步骤,但出现错误:

'inputFileKey' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9!_.*'()-\/]+

起初,我尝试按照指南删除 csr 的开始行和结束行,并使其以换行符分隔,但我得到了同样的错误。然后,我尝试使用研讨会中的“mk-bulk.sh”并使用该 json 文件,该文件给出了相同的错误以及一个错误,指出该文件超出了 AWS CLI 函数的 1024 字节限制。这些指南来自 2018 年,所以情况可能有所改变,但它们是我能找到的最新的。非常感谢任何帮助,如果您希望我提供我的单行 json,请告诉我。

我正在使用的 CLI 通过 python 子进程运行,如下所示:

subprocess.call("aws iot start-thing-registration-task --template-body file://C:/Users/user/awsbulkregistration/provisioning-template.json --input-file-bucket S3Bucket --input-file-key file://%s --role-arn arn:aws:iam::ACCOUNT_ID:role/S3Bucket" % BUCKET_FILE)

BUCKET_FILE 为:C:/Users/user/awsbulkregistration/s3bucket1.json

我得到的完整错误是:

An error occurred (InvalidRequestException) when calling the StartThingRegistrationTask operation: 1 validation error detected: Value
'{
  "ThingName": "Device1", 
  "SerialNumber": "1", 
  "CSR":  "[redacted]"
}' at 'inputFileKey' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9!_.*'()-\/]+ 

标签: amazon-web-servicesaws-cliaws-iot

解决方案


好的,因此该文件需要位于 s3 存储桶中才能正常工作。我的错


推荐阅读