简体   繁体   中英

Aws Iot create rule error while creating new rule

I am creating a new rule using the following command

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

The content of myrule.json contents is

{
  "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()}"
      }
  }]
}

I am getting following error.

A client error (InvalidRequestException) occurred when calling the CreateTopicRule operation: 1 validation error detected: Value 'my-rule' at 'ruleName' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-zA-Z0-9_]+$

please can someone help?

The regex ^[a-zA-Z0-9_]+$ means you cannot use dashes(-) . Only underscore( _ ) is allowed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM