---
title: "PATCH /security-profiles/{securityProfileName}"
method: PATCH
path: "/security-profiles/{securityProfileName}"
---

# PATCH /security-profiles/{securityProfileName}

`PATCH /security-profiles/{securityProfileName}`

Updates a Device Defender security profile.

Requires permission to access the [UpdateSecurityProfile](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions) action.

## Path parameters

- `securityProfileName` string, required

## Query parameters

- `expectedVersion` integer

## Request body

- object
  - `securityProfileDescription` string — A description of the security profile.
  - `behaviors` Behavior[] — Specifies the behaviors that, when violated by a device (thing), cause an alert.
    - `name` string, required — The name you've given to the behavior.
    - `metric` string — What is measured by the behavior.
    - `metricDimension` object — The dimension for a metric in your behavior. For example, using a <code>TOPIC_FILTER</code> dimension, you can narrow down the scope of the metric to only MQTT topics where the name matches the pattern specified in the dimension. This can't be used with custom metrics.
      - `dimensionName` string, required — A unique identifier for the dimension.
      - `operator` 'IN' | 'NOT_IN' — Defines how the <code>dimensionValues</code> of a dimension are interpreted. For example, for dimension type TOPIC_FILTER, the <code>IN</code> operator, a message will be counted only if its topic matches one of the topic filters. With <code>NOT_IN</code> operator, a message will be counted only if it doesn't match any of the topic filters. The operator is optional: if it's not provided (is <code>null</code>), it will be interpreted as <code>IN</code>.
    - `criteria` object — The criteria that determine if a device is behaving normally in regard to the <code>metric</code>.
      - `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' | 'in-set' | 'not-in-set' — <p>The operator that relates the thing measured (<code>metric</code>) to the criteria (containing a <code>value</code> or <code>statisticalThreshold</code>). Valid operators include:</p> <ul> <li> <p> <code>string-list</code>: <code>in-set</code> and <code>not-in-set</code> </p> </li> <li> <p> <code>number-list</code>: <code>in-set</code> and <code>not-in-set</code> </p> </li> <li> <p> <code>ip-address-list</code>: <code>in-cidr-set</code> and <code>not-in-cidr-set</code> </p> </li> <li> <p> <code>number</code>: <code>less-than</code>, <code>less-than-equals</code>, <code>greater-than</code>, and <code>greater-than-equals</code> </p> </li> </ul>
      - `value` object — The value to be compared with the <code>metric</code>.
        - `count` integer — If the <code>comparisonOperator</code> calls for a numeric value, use this to specify that numeric value to be compared with the <code>metric</code>.
        - `cidrs` Cidr[] — If the <code>comparisonOperator</code> calls for a set of CIDRs, use this to specify that set to be compared with the <code>metric</code>.
        - `ports` Port[] — If the <code>comparisonOperator</code> calls for a set of ports, use this to specify that set to be compared with the <code>metric</code>.
        - `number` number, double — The numeral value of a metric.
        - `numbers` Number[] — The numeral values of a metric.
        - `strings` StringValue[] — The string values of a metric.
      - `durationSeconds` integer — Use this to specify the time duration over which the behavior is evaluated, for those criteria that have a time dimension (for example, <code>NUM_MESSAGES_SENT</code>). For a <code>statisticalThreshhold</code> metric comparison, measurements from all devices are accumulated over this time duration before being used to calculate percentiles, and later, measurements from an individual device are also accumulated over this time duration before being given a percentile rank. Cannot be used with list-based metric datatypes.
      - `consecutiveDatapointsToAlarm` integer — If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm occurs. If not specified, the default is 1.
      - `consecutiveDatapointsToClear` integer — If an alarm has occurred and the offending device is no longer in violation of the behavior for the specified number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
      - `statisticalThreshold` object — A statistical ranking (percentile)that indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
        - `statistic` string — The percentile that resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (<code>durationSeconds</code>) from all reporting devices in your account and statistical ranks are calculated. Then, the measurements from a device are collected over the same period. If the accumulated measurements from the device fall above or below (<code>comparisonOperator</code>) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
      - `mlDetectionConfig` object — The configuration of an ML Detect
        - `confidenceLevel` 'LOW' | 'MEDIUM' | 'HIGH', required — The sensitivity of anomalous behavior evaluation. Can be <code>Low</code>, <code>Medium</code>, or <code>High</code>.
    - `suppressAlerts` boolean — Suppresses alerts.
  - `alertTargets` object — Where the alerts are sent. (Alerts are always sent to the console.)
  - `additionalMetricsToRetain` BehaviorMetric[] — <p> <i>Please use <a>UpdateSecurityProfileRequest$additionalMetricsToRetainV2</a> instead.</i> </p> <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's <code>behaviors</code>, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
  - `additionalMetricsToRetainV2` MetricToRetain[] — A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.
    - `metric` string, required — What is measured by the behavior.
    - `metricDimension` object — The dimension of a metric. This can't be used with custom metrics.
      - `dimensionName` string, required — A unique identifier for the dimension.
      - `operator` 'IN' | 'NOT_IN' — Defines how the <code>dimensionValues</code> of a dimension are interpreted. For example, for dimension type TOPIC_FILTER, the <code>IN</code> operator, a message will be counted only if its topic matches one of the topic filters. With <code>NOT_IN</code> operator, a message will be counted only if it doesn't match any of the topic filters. The operator is optional: if it's not provided (is <code>null</code>), it will be interpreted as <code>IN</code>.
  - `deleteBehaviors` boolean — If true, delete all <code>behaviors</code> defined for this security profile. If any <code>behaviors</code> are defined in the current invocation, an exception occurs.
  - `deleteAlertTargets` boolean — If true, delete all <code>alertTargets</code> defined for this security profile. If any <code>alertTargets</code> are defined in the current invocation, an exception occurs.
  - `deleteAdditionalMetricsToRetain` boolean — If true, delete all <code>additionalMetricsToRetain</code> defined for this security profile. If any <code>additionalMetricsToRetain</code> are defined in the current invocation, an exception occurs.

## Response `200`

Success

- UpdateSecurityProfileResponse
  - `securityProfileName` string — The name of the security profile that was updated.
  - `securityProfileArn` string — The ARN of the security profile that was updated.
  - `securityProfileDescription` string — The description of the security profile.
  - `behaviors` Behavior[] — Specifies the behaviors that, when violated by a device (thing), cause an alert.
    - `name` string, required — The name you've given to the behavior.
    - `metric` string — What is measured by the behavior.
    - `metricDimension` object — The dimension for a metric in your behavior. For example, using a <code>TOPIC_FILTER</code> dimension, you can narrow down the scope of the metric to only MQTT topics where the name matches the pattern specified in the dimension. This can't be used with custom metrics.
      - `dimensionName` string, required — A unique identifier for the dimension.
      - `operator` 'IN' | 'NOT_IN' — Defines how the <code>dimensionValues</code> of a dimension are interpreted. For example, for dimension type TOPIC_FILTER, the <code>IN</code> operator, a message will be counted only if its topic matches one of the topic filters. With <code>NOT_IN</code> operator, a message will be counted only if it doesn't match any of the topic filters. The operator is optional: if it's not provided (is <code>null</code>), it will be interpreted as <code>IN</code>.
    - `criteria` object — The criteria that determine if a device is behaving normally in regard to the <code>metric</code>.
      - `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' | 'in-set' | 'not-in-set' — <p>The operator that relates the thing measured (<code>metric</code>) to the criteria (containing a <code>value</code> or <code>statisticalThreshold</code>). Valid operators include:</p> <ul> <li> <p> <code>string-list</code>: <code>in-set</code> and <code>not-in-set</code> </p> </li> <li> <p> <code>number-list</code>: <code>in-set</code> and <code>not-in-set</code> </p> </li> <li> <p> <code>ip-address-list</code>: <code>in-cidr-set</code> and <code>not-in-cidr-set</code> </p> </li> <li> <p> <code>number</code>: <code>less-than</code>, <code>less-than-equals</code>, <code>greater-than</code>, and <code>greater-than-equals</code> </p> </li> </ul>
      - `value` object — The value to be compared with the <code>metric</code>.
        - `count` integer — If the <code>comparisonOperator</code> calls for a numeric value, use this to specify that numeric value to be compared with the <code>metric</code>.
        - `cidrs` Cidr[] — If the <code>comparisonOperator</code> calls for a set of CIDRs, use this to specify that set to be compared with the <code>metric</code>.
        - `ports` Port[] — If the <code>comparisonOperator</code> calls for a set of ports, use this to specify that set to be compared with the <code>metric</code>.
        - `number` number, double — The numeral value of a metric.
        - `numbers` Number[] — The numeral values of a metric.
        - `strings` StringValue[] — The string values of a metric.
      - `durationSeconds` integer — Use this to specify the time duration over which the behavior is evaluated, for those criteria that have a time dimension (for example, <code>NUM_MESSAGES_SENT</code>). For a <code>statisticalThreshhold</code> metric comparison, measurements from all devices are accumulated over this time duration before being used to calculate percentiles, and later, measurements from an individual device are also accumulated over this time duration before being given a percentile rank. Cannot be used with list-based metric datatypes.
      - `consecutiveDatapointsToAlarm` integer — If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm occurs. If not specified, the default is 1.
      - `consecutiveDatapointsToClear` integer — If an alarm has occurred and the offending device is no longer in violation of the behavior for the specified number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
      - `statisticalThreshold` object — A statistical ranking (percentile)that indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
        - `statistic` string — The percentile that resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (<code>durationSeconds</code>) from all reporting devices in your account and statistical ranks are calculated. Then, the measurements from a device are collected over the same period. If the accumulated measurements from the device fall above or below (<code>comparisonOperator</code>) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
      - `mlDetectionConfig` object — The configuration of an ML Detect
        - `confidenceLevel` 'LOW' | 'MEDIUM' | 'HIGH', required — The sensitivity of anomalous behavior evaluation. Can be <code>Low</code>, <code>Medium</code>, or <code>High</code>.
    - `suppressAlerts` boolean — Suppresses alerts.
  - `alertTargets` object — Where the alerts are sent. (Alerts are always sent to the console.)
  - `additionalMetricsToRetain` BehaviorMetric[] — <p> <i>Please use <a>UpdateSecurityProfileResponse$additionalMetricsToRetainV2</a> instead.</i> </p> <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the security profile's <code>behaviors</code>, but it is also retained for any metric specified here.</p>Use additionalMetricsToRetainV2.
  - `additionalMetricsToRetainV2` MetricToRetain[] — A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.
    - `metric` string, required — What is measured by the behavior.
    - `metricDimension` object — The dimension of a metric. This can't be used with custom metrics.
      - `dimensionName` string, required — A unique identifier for the dimension.
      - `operator` 'IN' | 'NOT_IN' — Defines how the <code>dimensionValues</code> of a dimension are interpreted. For example, for dimension type TOPIC_FILTER, the <code>IN</code> operator, a message will be counted only if its topic matches one of the topic filters. With <code>NOT_IN</code> operator, a message will be counted only if it doesn't match any of the topic filters. The operator is optional: if it's not provided (is <code>null</code>), it will be interpreted as <code>IN</code>.
  - `version` integer — The updated version of the security profile.
  - `creationDate` string, date-time — The time the security profile was created.
  - `lastModifiedDate` string, date-time — The time the security profile was last modified.

## Other responses

- `480` — InvalidRequestException
- `481` — ResourceNotFoundException
- `482` — VersionConflictException
- `483` — ThrottlingException
- `484` — InternalFailureException

---

[API](https://skmtc.net/aws/apis/iot.md) · [All operations](https://skmtc.net/aws/apis/iot/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/iot/versions/deef5c4b09f0/schema)
