Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . iot ]

replace-topic-rule

Description

Replaces the rule. You must specify all parameters for the new rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  replace-topic-rule
--rule-name <value>
--topic-rule-payload <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--rule-name (string)

The name of the rule.

--topic-rule-payload (structure)

The rule payload.

JSON Syntax:

{
  "sql": "string",
  "description": "string",
  "actions": [
    {
      "dynamoDB": {
        "tableName": "string",
        "roleArn": "string",
        "operation": "string",
        "hashKeyField": "string",
        "hashKeyValue": "string",
        "hashKeyType": "STRING"|"NUMBER",
        "rangeKeyField": "string",
        "rangeKeyValue": "string",
        "rangeKeyType": "STRING"|"NUMBER",
        "payloadField": "string"
      },
      "dynamoDBv2": {
        "roleArn": "string",
        "putItem": {
          "tableName": "string"
        }
      },
      "lambda": {
        "functionArn": "string"
      },
      "sns": {
        "targetArn": "string",
        "roleArn": "string",
        "messageFormat": "RAW"|"JSON"
      },
      "sqs": {
        "roleArn": "string",
        "queueUrl": "string",
        "useBase64": true|false
      },
      "kinesis": {
        "roleArn": "string",
        "streamName": "string",
        "partitionKey": "string"
      },
      "republish": {
        "roleArn": "string",
        "topic": "string",
        "qos": integer
      },
      "s3": {
        "roleArn": "string",
        "bucketName": "string",
        "key": "string",
        "cannedAcl": "private"|"public-read"|"public-read-write"|"aws-exec-read"|"authenticated-read"|"bucket-owner-read"|"bucket-owner-full-control"|"log-delivery-write"
      },
      "firehose": {
        "roleArn": "string",
        "deliveryStreamName": "string",
        "separator": "string"
      },
      "cloudwatchMetric": {
        "roleArn": "string",
        "metricNamespace": "string",
        "metricName": "string",
        "metricValue": "string",
        "metricUnit": "string",
        "metricTimestamp": "string"
      },
      "cloudwatchAlarm": {
        "roleArn": "string",
        "alarmName": "string",
        "stateReason": "string",
        "stateValue": "string"
      },
      "cloudwatchLogs": {
        "roleArn": "string",
        "logGroupName": "string"
      },
      "elasticsearch": {
        "roleArn": "string",
        "endpoint": "string",
        "index": "string",
        "type": "string",
        "id": "string"
      },
      "salesforce": {
        "token": "string",
        "url": "string"
      },
      "iotAnalytics": {
        "channelArn": "string",
        "channelName": "string",
        "roleArn": "string"
      },
      "iotEvents": {
        "inputName": "string",
        "messageId": "string",
        "roleArn": "string"
      },
      "iotSiteWise": {
        "putAssetPropertyValueEntries": [
          {
            "entryId": "string",
            "assetId": "string",
            "propertyId": "string",
            "propertyAlias": "string",
            "propertyValues": [
              {
                "value": {
                  "stringValue": "string",
                  "integerValue": "string",
                  "doubleValue": "string",
                  "booleanValue": "string"
                },
                "timestamp": {
                  "timeInSeconds": "string",
                  "offsetInNanos": "string"
                },
                "quality": "string"
              }
              ...
            ]
          }
          ...
        ],
        "roleArn": "string"
      },
      "stepFunctions": {
        "executionNamePrefix": "string",
        "stateMachineName": "string",
        "roleArn": "string"
      },
      "http": {
        "url": "string",
        "confirmationUrl": "string",
        "headers": [
          {
            "key": "string",
            "value": "string"
          }
          ...
        ],
        "auth": {
          "sigv4": {
            "signingRegion": "string",
            "serviceName": "string",
            "roleArn": "string"
          }
        }
      }
    }
    ...
  ],
  "ruleDisabled": true|false,
  "awsIotSqlVersion": "string",
  "errorAction": {
    "dynamoDB": {
      "tableName": "string",
      "roleArn": "string",
      "operation": "string",
      "hashKeyField": "string",
      "hashKeyValue": "string",
      "hashKeyType": "STRING"|"NUMBER",
      "rangeKeyField": "string",
      "rangeKeyValue": "string",
      "rangeKeyType": "STRING"|"NUMBER",
      "payloadField": "string"
    },
    "dynamoDBv2": {
      "roleArn": "string",
      "putItem": {
        "tableName": "string"
      }
    },
    "lambda": {
      "functionArn": "string"
    },
    "sns": {
      "targetArn": "string",
      "roleArn": "string",
      "messageFormat": "RAW"|"JSON"
    },
    "sqs": {
      "roleArn": "string",
      "queueUrl": "string",
      "useBase64": true|false
    },
    "kinesis": {
      "roleArn": "string",
      "streamName": "string",
      "partitionKey": "string"
    },
    "republish": {
      "roleArn": "string",
      "topic": "string",
      "qos": integer
    },
    "s3": {
      "roleArn": "string",
      "bucketName": "string",
      "key": "string",
      "cannedAcl": "private"|"public-read"|"public-read-write"|"aws-exec-read"|"authenticated-read"|"bucket-owner-read"|"bucket-owner-full-control"|"log-delivery-write"
    },
    "firehose": {
      "roleArn": "string",
      "deliveryStreamName": "string",
      "separator": "string"
    },
    "cloudwatchMetric": {
      "roleArn": "string",
      "metricNamespace": "string",
      "metricName": "string",
      "metricValue": "string",
      "metricUnit": "string",
      "metricTimestamp": "string"
    },
    "cloudwatchAlarm": {
      "roleArn": "string",
      "alarmName": "string",
      "stateReason": "string",
      "stateValue": "string"
    },
    "cloudwatchLogs": {
      "roleArn": "string",
      "logGroupName": "string"
    },
    "elasticsearch": {
      "roleArn": "string",
      "endpoint": "string",
      "index": "string",
      "type": "string",
      "id": "string"
    },
    "salesforce": {
      "token": "string",
      "url": "string"
    },
    "iotAnalytics": {
      "channelArn": "string",
      "channelName": "string",
      "roleArn": "string"
    },
    "iotEvents": {
      "inputName": "string",
      "messageId": "string",
      "roleArn": "string"
    },
    "iotSiteWise": {
      "putAssetPropertyValueEntries": [
        {
          "entryId": "string",
          "assetId": "string",
          "propertyId": "string",
          "propertyAlias": "string",
          "propertyValues": [
            {
              "value": {
                "stringValue": "string",
                "integerValue": "string",
                "doubleValue": "string",
                "booleanValue": "string"
              },
              "timestamp": {
                "timeInSeconds": "string",
                "offsetInNanos": "string"
              },
              "quality": "string"
            }
            ...
          ]
        }
        ...
      ],
      "roleArn": "string"
    },
    "stepFunctions": {
      "executionNamePrefix": "string",
      "stateMachineName": "string",
      "roleArn": "string"
    },
    "http": {
      "url": "string",
      "confirmationUrl": "string",
      "headers": [
        {
          "key": "string",
          "value": "string"
        }
        ...
      ],
      "auth": {
        "sigv4": {
          "signingRegion": "string",
          "serviceName": "string",
          "roleArn": "string"
        }
      }
    }
  }
}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To update a topic's rule definition

The following replace-topic-rule example updates the specified rule to send an SNS alert when soil moisture level readings are too low.

aws iot replace-topic-rule \
    --rule-name MyRPiLowMoistureAlertRule \
    --topic-rule-payload "{\"sql\": \"SELECT * FROM '$aws/things/MyRPi/shadow/update/accepted' WHERE state.reported.moisture = 'low'\", \"description\": \"Sends an alert when soil moisture level readings are too low.\",\"actions\": [{\"sns\":{\"targetArn\":\"arn:aws:sns:us-west-2:123456789012:MyRPiLowMoistureTopic\",\"roleArn\":\"arn:aws:iam::123456789012:role/service-role/MyRPiLowMoistureTopicRole\",\"messageFormat\": \"RAW\"}}],\"ruleDisabled\": false,\"awsIotSqlVersion\":\"2016-03-23\"}"

This command produces no output.

For more information, see Creating an AWS IoT Rule in the AWS IoT Developer Guide.

Output

None