Abhijeet Kulkarni
Abhijeet Kulkarni

Reputation: 146

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?

Upvotes: 0

Views: 2234

Answers (1)

Adi
Adi

Reputation: 4230

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

Upvotes: 1

Related Questions