2016-05-17 58 views
0

我使用下面的命令創建一個新的規則AWS IOT創建規則的錯誤,同時創造新的規則

aws iot create-topic-rule --rule-name my-rule --topic-rule-payload file://myrule.json 

myrule.json內容的內容是

{ 
    "sql": "SELECT * FROM 'iot/test'", 
    "ruleDisabled": false, 
    "awsIotSqlVersion": "2016-03-23-beta", 
    "actions": [{ 
     "dynamoDB": { 
      "tableName": "my-dynamodb-table", 
      "roleArn": "arn:aws:iam::12345*****:role/my-iot-role", 
      "hashKeyField": "topic", 
      "hashKeyValue": "${topic(2)}", 
      "rangeKeyField": "timestamp", 
      "rangeKeyValue": "${timestamp()}" 
     } 
    }] 
} 

我收到以下錯誤。 1個確認檢測到的錯誤:調用 CreateTopicRule操作時發生

客戶端錯誤(InvalidRequestException)值 「我的規則」在「RULENAME」未能滿足約束:會員必須 滿足正則表達式模式:^ [a-zA-Z0-9 _] + $

請問有人可以幫忙嗎?

+0

'--rule-name'選項禁止使用字符'-'。嘗試'aws iot create-topic-rule --rule-name my_rule --topic-rule-payload file:// myrule.json' –

+0

我試過這個aws創建主題規則--rule-name myrule --topic -rule-payload file://myrule.json 我收到以下錯誤 參數驗證失敗: topicRulePayload中的未知參數:「awsIotSqlVersion」,必須是以下值之一:sql,description,actions,ruleDisabled –

回答

0

正則表達式^ [a-zA-Z0-9 _] + $表示不能使用破折號( - )。只允許使用下劃線(_)