0

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?

Alexis N-o
  • 3,954
  • 26
  • 34
  • The caracter `-` is forbidden in the `--rule-name` option. Try `aws iot create-topic-rule --rule-name my_rule --topic-rule-payload file://myrule.json` – Alexis N-o May 18 '16 at 02:50
  • i tried this aws iot create-topic-rule --rule-name myrule --topic-rule-payload file://myrule.json i am getting following error Parameter validation failed: Unknown parameter in topicRulePayload: "awsIotSqlVersion", must be one of: sql, description, actions, ruleDisabled – Abhijeet Kulkarni May 18 '16 at 05:16

1 Answers1

1

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

Adi
  • 4,149
  • 4
  • 25
  • 41