[ aws . iot ]

validate-security-profile-behaviors

Description

Validates a Device Defender security profile behaviors specification.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  validate-security-profile-behaviors
--behaviors <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <value>]

Options

--behaviors (list)

Specifies the behaviors that, when violated by a device (thing), cause an alert.

JSON Syntax:

[
  {
    "name": "string",
    "metric": "string",
    "metricDimension": {
      "dimensionName": "string",
      "operator": "IN"|"NOT_IN"
    },
    "criteria": {
      "comparisonOperator": "less-than"|"less-than-equals"|"greater-than"|"greater-than-equals"|"in-cidr-set"|"not-in-cidr-set"|"in-port-set"|"not-in-port-set",
      "value": {
        "count": long,
        "cidrs": ["string", ...],
        "ports": [integer, ...]
      },
      "durationSeconds": integer,
      "consecutiveDatapointsToAlarm": integer,
      "consecutiveDatapointsToClear": integer,
      "statisticalThreshold": {
        "statistic": "string"
      }
    }
  }
  ...
]

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those 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. This may not be specified along with --cli-input-yaml.

--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. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

--cli-auto-prompt (boolean) Automatically prompt for CLI input parameters.

See ‘aws help’ for descriptions of global parameters.

Examples

Example 1: To validate the behaviors parameters for a security profile

The following validate-security-profile-behaviors example validates a well-formed and correct set of behaviors for an AWS IoT Device Defender security profile.

aws iot validate-security-profile-behaviors \
    --behaviors "[{\"name\":\"CellularBandwidth\",\"metric\":\"aws:message-byte-size\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":128},\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}},{\"name\":\"Authorization\",\"metric\":\"aws:num-authorization-failures\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":12},\"durationSeconds\":300,\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}}]"

Output:

{
    "valid": true,
    "validationErrors": []
}

Example 2: To validate incorrect behaviors parameters for a security profile

The following validate-security-profile-behaviors example validates a set of behaviors that contains an error for an AWS IoT Device Defender security profile.

aws iot validate-security-profile-behaviors \
    --behaviors "[{\"name\":\"CellularBandwidth\",\"metric\":\"aws:message-byte-size\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":128},\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}},{\"name\":\"Authorization\",\"metric\":\"aws:num-authorization-failures\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":12},\"durationSeconds\":300,\"consecutiveDatapointsToAlarm\":100000,\"consecutiveDatapointsToClear\":1}}]"

Output:

{
    "valid": false,
    "validationErrors": [
        {
            "errorMessage": "Behavior Authorization is malformed. consecutiveDatapointsToAlarm 100000 should be in range[1,10]"
        }
    ]
}

For more information, see Detect Commands in the AWS IoT Developer Guide.

Output

valid -> (boolean)

True if the behaviors were valid.

validationErrors -> (list)

The list of any errors found in the behaviors.

(structure)

Information about an error found in a behavior specification.

errorMessage -> (string)

The description of an error found in the behaviors.