2020/04/01 - AWS IoT - 5 new 7 updated api methods
Changes This release introduces Dimensions for AWS IoT Device Defender. Dimensions can be used in Security Profiles to collect and monitor fine-grained metrics.
Provides details about a dimension that is defined in your AWS account.
See also: AWS API Documentation
Request Syntax
client.describe_dimension( name='string' )
string
[REQUIRED]
The unique identifier for the dimension.
dict
Response Syntax
{ 'name': 'string', 'arn': 'string', 'type': 'TOPIC_FILTER', 'stringValues': [ 'string', ], 'creationDate': datetime(2015, 1, 1), 'lastModifiedDate': datetime(2015, 1, 1) }
Response Structure
(dict) --
name (string) --
The unique identifier for the dimension.
arn (string) --
The ARN (Amazon resource name) for the dimension.
type (string) --
The type of the dimension.
stringValues (list) --
The value or list of values used to scope the dimension. For example, for topic filters, this is the pattern used to match the MQTT topic name.
(string) --
creationDate (datetime) --
The date the dimension was created.
lastModifiedDate (datetime) --
The date the dimension was last modified.
Updates the definition for a dimension. You cannot change the type of a dimension after it is created (you can delete it and re-create it).
See also: AWS API Documentation
Request Syntax
client.update_dimension( name='string', stringValues=[ 'string', ] )
string
[REQUIRED]
A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.
list
[REQUIRED]
Specifies the value or list of values for the dimension. For TOPIC_FILTER dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").
(string) --
dict
Response Syntax
{ 'name': 'string', 'arn': 'string', 'type': 'TOPIC_FILTER', 'stringValues': [ 'string', ], 'creationDate': datetime(2015, 1, 1), 'lastModifiedDate': datetime(2015, 1, 1) }
Response Structure
(dict) --
name (string) --
A unique identifier for the dimension.
arn (string) --
The ARN (Amazon resource name) of the created dimension.
type (string) --
The type of the dimension.
stringValues (list) --
The value or list of values used to scope the dimension. For example, for topic filters, this is the pattern used to match the MQTT topic name.
(string) --
creationDate (datetime) --
The date and time, in milliseconds since epoch, when the dimension was initially created.
lastModifiedDate (datetime) --
The date and time, in milliseconds since epoch, when the dimension was most recently updated.
List the set of dimensions that are defined for your AWS account.
See also: AWS API Documentation
Request Syntax
client.list_dimensions( nextToken='string', maxResults=123 )
string
The token for the next set of results.
integer
The maximum number of results to retrieve at one time.
dict
Response Syntax
{ 'dimensionNames': [ 'string', ], 'nextToken': 'string' }
Response Structure
(dict) --
dimensionNames (list) --
A list of the names of the defined dimensions. Use DescribeDimension to get details for a dimension.
(string) --
nextToken (string) --
A token that can be used to retrieve the next set of results, or null if there are no additional results.
Removes the specified dimension from your AWS account.
See also: AWS API Documentation
Request Syntax
client.delete_dimension( name='string' )
string
[REQUIRED]
The unique identifier for the dimension that you want to delete.
dict
Response Syntax
{}
Response Structure
(dict) --
Create a dimension that you can use to limit the scope of a metric used in a security profile for AWS IoT Device Defender. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
See also: AWS API Documentation
Request Syntax
client.create_dimension( name='string', type='TOPIC_FILTER', stringValues=[ 'string', ], tags=[ { 'Key': 'string', 'Value': 'string' }, ], clientRequestToken='string' )
string
[REQUIRED]
A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.
string
[REQUIRED]
Specifies the type of dimension. Supported types: TOPIC_FILTER.
list
[REQUIRED]
Specifies the value or list of values for the dimension. For TOPIC_FILTER dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").
(string) --
list
Metadata that can be used to manage the dimension.
(dict) --
A set of key/value pairs that are used to manage the resource.
Key (string) --
The tag's key.
Value (string) --
The tag's value.
string
[REQUIRED]
Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, AWS SDKs will automatically generate a unique client request.
This field is autopopulated if not provided.
dict
Response Syntax
{ 'name': 'string', 'arn': 'string' }
Response Structure
(dict) --
name (string) --
A unique identifier for the dimension.
arn (string) --
The ARN (Amazon resource name) of the created dimension.
{'additionalMetricsToRetainV2': [{'metric': 'string', 'metricDimension': {'dimensionName': 'string', 'operator': 'IN | ' 'NOT_IN'}}], 'behaviors': {'metricDimension': {'dimensionName': 'string', 'operator': 'IN | NOT_IN'}}}
Creates a Device Defender security profile.
See also: AWS API Documentation
Request Syntax
client.create_security_profile( securityProfileName='string', securityProfileDescription='string', behaviors=[ { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, ], alertTargets={ 'string': { 'alertTargetArn': 'string', 'roleArn': 'string' } }, additionalMetricsToRetain=[ 'string', ], additionalMetricsToRetainV2=[ { 'metric': 'string', 'metricDimension': { 'dimensionName': 'string', 'operator': 'IN'|'NOT_IN' } }, ], tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The name you are giving to the security profile.
string
A description of the security profile.
list
Specifies the behaviors that, when violated by a device (thing), cause an alert.
(dict) --
A Device Defender security profile behavior.
name (string) -- [REQUIRED]
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) -- [REQUIRED]
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
dict
Specifies the destinations to which alerts are sent. (Alerts are always sent to the console.) Alerts are generated when a device (thing) violates a behavior.
(string) --
The type of alert target: one of "SNS".
(dict) --
A structure containing the alert target ARN and the role ARN.
alertTargetArn (string) -- [REQUIRED]
The ARN of the notification target to which alerts are sent.
roleArn (string) -- [REQUIRED]
The ARN of the role that grants permission to send alerts to the notification target.
list
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.
Note: This API field is deprecated. Please use CreateSecurityProfileRequest$additionalMetricsToRetainV2 instead.
(string) --
list
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.
(dict) --
The metric you want to retain. Dimensions are optional.
metric (string) -- [REQUIRED]
What is measured by the behavior.
metricDimension (dict) --
The dimension of a metric.
dimensionName (string) -- [REQUIRED]
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
list
Metadata that can be used to manage the security profile.
(dict) --
A set of key/value pairs that are used to manage the resource.
Key (string) --
The tag's key.
Value (string) --
The tag's value.
dict
Response Syntax
{ 'securityProfileName': 'string', 'securityProfileArn': 'string' }
Response Structure
(dict) --
securityProfileName (string) --
The name you gave to the security profile.
securityProfileArn (string) --
The ARN of the security profile.
{'additionalMetricsToRetainV2': [{'metric': 'string', 'metricDimension': {'dimensionName': 'string', 'operator': 'IN | ' 'NOT_IN'}}], 'behaviors': {'metricDimension': {'dimensionName': 'string', 'operator': 'IN | NOT_IN'}}}
Gets information about a Device Defender security profile.
See also: AWS API Documentation
Request Syntax
client.describe_security_profile( securityProfileName='string' )
string
[REQUIRED]
The name of the security profile whose information you want to get.
dict
Response Syntax
{ 'securityProfileName': 'string', 'securityProfileArn': 'string', 'securityProfileDescription': 'string', 'behaviors': [ { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, ], 'alertTargets': { 'string': { 'alertTargetArn': 'string', 'roleArn': 'string' } }, 'additionalMetricsToRetain': [ 'string', ], 'additionalMetricsToRetainV2': [ { 'metric': 'string', 'metricDimension': { 'dimensionName': 'string', 'operator': 'IN'|'NOT_IN' } }, ], 'version': 123, 'creationDate': datetime(2015, 1, 1), 'lastModifiedDate': datetime(2015, 1, 1) }
Response Structure
(dict) --
securityProfileName (string) --
The name of the security profile.
securityProfileArn (string) --
The ARN of the security profile.
securityProfileDescription (string) --
A description of the security profile (associated with the security profile when it was created or updated).
behaviors (list) --
Specifies the behaviors that, when violated by a device (thing), cause an alert.
(dict) --
A Device Defender security profile behavior.
name (string) --
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) --
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
alertTargets (dict) --
Where the alerts are sent. (Alerts are always sent to the console.)
(string) --
The type of alert target: one of "SNS".
(dict) --
A structure containing the alert target ARN and the role ARN.
alertTargetArn (string) --
The ARN of the notification target to which alerts are sent.
roleArn (string) --
The ARN of the role that grants permission to send alerts to the notification target.
additionalMetricsToRetain (list) --
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.
Note: This API field is deprecated. Please use DescribeSecurityProfileResponse$additionalMetricsToRetainV2 instead.
(string) --
additionalMetricsToRetainV2 (list) --
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.
(dict) --
The metric you want to retain. Dimensions are optional.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension of a metric.
dimensionName (string) --
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
version (integer) --
The version of the security profile. A new version is generated whenever the security profile is updated.
creationDate (datetime) --
The time the security profile was created.
lastModifiedDate (datetime) --
The time the security profile was last modified.
{'activeViolations': {'behavior': {'metricDimension': {'dimensionName': 'string', 'operator': 'IN | ' 'NOT_IN'}}}}
Lists the active violations for a given Device Defender security profile.
See also: AWS API Documentation
Request Syntax
client.list_active_violations( thingName='string', securityProfileName='string', nextToken='string', maxResults=123 )
string
The name of the thing whose active violations are listed.
string
The name of the Device Defender security profile for which violations are listed.
string
The token for the next set of results.
integer
The maximum number of results to return at one time.
dict
Response Syntax
{ 'activeViolations': [ { 'violationId': 'string', 'thingName': 'string', 'securityProfileName': 'string', 'behavior': { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, 'lastViolationValue': { 'count': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'lastViolationTime': datetime(2015, 1, 1), 'violationStartTime': datetime(2015, 1, 1) }, ], 'nextToken': 'string' }
Response Structure
(dict) --
activeViolations (list) --
The list of active violations.
(dict) --
Information about an active Device Defender security profile behavior violation.
violationId (string) --
The ID of the active violation.
thingName (string) --
The name of the thing responsible for the active violation.
securityProfileName (string) --
The security profile whose behavior is in violation.
behavior (dict) --
The behavior which is being violated.
name (string) --
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) --
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
lastViolationValue (dict) --
The value of the metric (the measurement) which caused the most recent violation.
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
lastViolationTime (datetime) --
The time the most recent violation occurred.
violationStartTime (datetime) --
The time the violation started.
nextToken (string) --
A token that can be used to retrieve the next set of results, or null if there are no additional results.
{'dimensionName': 'string'}
Lists the Device Defender security profiles you have created. You can use filters to list only those security profiles associated with a thing group or only those associated with your account.
See also: AWS API Documentation
Request Syntax
client.list_security_profiles( nextToken='string', maxResults=123, dimensionName='string' )
string
The token for the next set of results.
integer
The maximum number of results to return at one time.
string
A filter to limit results to the security profiles that use the defined dimension.
dict
Response Syntax
{ 'securityProfileIdentifiers': [ { 'name': 'string', 'arn': 'string' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
securityProfileIdentifiers (list) --
A list of security profile identifiers (names and ARNs).
(dict) --
Identifying information for a Device Defender security profile.
name (string) --
The name you have given to the security profile.
arn (string) --
The ARN of the security profile.
nextToken (string) --
A token that can be used to retrieve the next set of results, or null if there are no additional results.
{'violationEvents': {'behavior': {'metricDimension': {'dimensionName': 'string', 'operator': 'IN | ' 'NOT_IN'}}}}
Lists the Device Defender security profile violations discovered during the given time period. You can use filters to limit the results to those alerts issued for a particular security profile, behavior, or thing (device).
See also: AWS API Documentation
Request Syntax
client.list_violation_events( startTime=datetime(2015, 1, 1), endTime=datetime(2015, 1, 1), thingName='string', securityProfileName='string', nextToken='string', maxResults=123 )
datetime
[REQUIRED]
The start time for the alerts to be listed.
datetime
[REQUIRED]
The end time for the alerts to be listed.
string
A filter to limit results to those alerts caused by the specified thing.
string
A filter to limit results to those alerts generated by the specified security profile.
string
The token for the next set of results.
integer
The maximum number of results to return at one time.
dict
Response Syntax
{ 'violationEvents': [ { 'violationId': 'string', 'thingName': 'string', 'securityProfileName': 'string', 'behavior': { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, 'metricValue': { 'count': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'violationEventType': 'in-alarm'|'alarm-cleared'|'alarm-invalidated', 'violationEventTime': datetime(2015, 1, 1) }, ], 'nextToken': 'string' }
Response Structure
(dict) --
violationEvents (list) --
The security profile violation alerts issued for this account during the given time period, potentially filtered by security profile, behavior violated, or thing (device) violating.
(dict) --
Information about a Device Defender security profile behavior violation.
violationId (string) --
The ID of the violation event.
thingName (string) --
The name of the thing responsible for the violation event.
securityProfileName (string) --
The name of the security profile whose behavior was violated.
behavior (dict) --
The behavior which was violated.
name (string) --
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) --
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
metricValue (dict) --
The value of the metric (the measurement).
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
violationEventType (string) --
The type of violation event.
violationEventTime (datetime) --
The time the violation event occurred.
nextToken (string) --
A token that can be used to retrieve the next set of results, or null if there are no additional results.
{'additionalMetricsToRetainV2': [{'metric': 'string', 'metricDimension': {'dimensionName': 'string', 'operator': 'IN | ' 'NOT_IN'}}], 'behaviors': {'metricDimension': {'dimensionName': 'string', 'operator': 'IN | NOT_IN'}}}
Updates a Device Defender security profile.
See also: AWS API Documentation
Request Syntax
client.update_security_profile( securityProfileName='string', securityProfileDescription='string', behaviors=[ { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, ], alertTargets={ 'string': { 'alertTargetArn': 'string', 'roleArn': 'string' } }, additionalMetricsToRetain=[ 'string', ], additionalMetricsToRetainV2=[ { 'metric': 'string', 'metricDimension': { 'dimensionName': 'string', 'operator': 'IN'|'NOT_IN' } }, ], deleteBehaviors=True|False, deleteAlertTargets=True|False, deleteAdditionalMetricsToRetain=True|False, expectedVersion=123 )
string
[REQUIRED]
The name of the security profile you want to update.
string
A description of the security profile.
list
Specifies the behaviors that, when violated by a device (thing), cause an alert.
(dict) --
A Device Defender security profile behavior.
name (string) -- [REQUIRED]
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) -- [REQUIRED]
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
dict
Where the alerts are sent. (Alerts are always sent to the console.)
(string) --
The type of alert target: one of "SNS".
(dict) --
A structure containing the alert target ARN and the role ARN.
alertTargetArn (string) -- [REQUIRED]
The ARN of the notification target to which alerts are sent.
roleArn (string) -- [REQUIRED]
The ARN of the role that grants permission to send alerts to the notification target.
list
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.
Note: This API field is deprecated. Please use UpdateSecurityProfileRequest$additionalMetricsToRetainV2 instead.
(string) --
list
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.
(dict) --
The metric you want to retain. Dimensions are optional.
metric (string) -- [REQUIRED]
What is measured by the behavior.
metricDimension (dict) --
The dimension of a metric.
dimensionName (string) -- [REQUIRED]
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
boolean
If true, delete all behaviors defined for this security profile. If any behaviors are defined in the current invocation, an exception occurs.
boolean
If true, delete all alertTargets defined for this security profile. If any alertTargets are defined in the current invocation, an exception occurs.
boolean
If true, delete all additionalMetricsToRetain defined for this security profile. If any additionalMetricsToRetain are defined in the current invocation, an exception occurs.
integer
The expected version of the security profile. A new version is generated whenever the security profile is updated. If you specify a value that is different from the actual version, a VersionConflictException is thrown.
dict
Response Syntax
{ 'securityProfileName': 'string', 'securityProfileArn': 'string', 'securityProfileDescription': 'string', 'behaviors': [ { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, ], 'alertTargets': { 'string': { 'alertTargetArn': 'string', 'roleArn': 'string' } }, 'additionalMetricsToRetain': [ 'string', ], 'additionalMetricsToRetainV2': [ { 'metric': 'string', 'metricDimension': { 'dimensionName': 'string', 'operator': 'IN'|'NOT_IN' } }, ], 'version': 123, 'creationDate': datetime(2015, 1, 1), 'lastModifiedDate': datetime(2015, 1, 1) }
Response Structure
(dict) --
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 (list) --
Specifies the behaviors that, when violated by a device (thing), cause an alert.
(dict) --
A Device Defender security profile behavior.
name (string) --
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) --
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
alertTargets (dict) --
Where the alerts are sent. (Alerts are always sent to the console.)
(string) --
The type of alert target: one of "SNS".
(dict) --
A structure containing the alert target ARN and the role ARN.
alertTargetArn (string) --
The ARN of the notification target to which alerts are sent.
roleArn (string) --
The ARN of the role that grants permission to send alerts to the notification target.
additionalMetricsToRetain (list) --
A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the security profile's behaviors , but it is also retained for any metric specified here.
Note: This API field is deprecated. Please use UpdateSecurityProfileResponse$additionalMetricsToRetainV2 instead.
(string) --
additionalMetricsToRetainV2 (list) --
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.
(dict) --
The metric you want to retain. Dimensions are optional.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension of a metric.
dimensionName (string) --
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
version (integer) --
The updated version of the security profile.
creationDate (datetime) --
The time the security profile was created.
lastModifiedDate (datetime) --
The time the security profile was last modified.
{'behaviors': {'metricDimension': {'dimensionName': 'string', 'operator': 'IN | NOT_IN'}}}
Validates a Device Defender security profile behaviors specification.
See also: AWS API Documentation
Request Syntax
client.validate_security_profile_behaviors( behaviors=[ { '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': 123, 'cidrs': [ 'string', ], 'ports': [ 123, ] }, 'durationSeconds': 123, 'consecutiveDatapointsToAlarm': 123, 'consecutiveDatapointsToClear': 123, 'statisticalThreshold': { 'statistic': 'string' } } }, ] )
list
[REQUIRED]
Specifies the behaviors that, when violated by a device (thing), cause an alert.
(dict) --
A Device Defender security profile behavior.
name (string) -- [REQUIRED]
The name you have given to the behavior.
metric (string) --
What is measured by the behavior.
metricDimension (dict) --
The dimension for a metric in your behavior. For example, using a TOPIC_FILTER dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.
dimensionName (string) -- [REQUIRED]
A unique identifier for the dimension.
operator (string) --
Defines how the dimensionValues of a dimension are interpreted. For example, for DimensionType TOPIC_FILTER, with IN operator, a message will be counted only if its topic matches one of the topic filters. With NOT_IN 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 null ), it will be interpreted as IN .
criteria (dict) --
The criteria that determine if a device is behaving normally in regard to the metric .
comparisonOperator (string) --
The operator that relates the thing measured (metric ) to the criteria (containing a value or statisticalThreshold ).
value (dict) --
The value to be compared with the metric .
count (integer) --
If the comparisonOperator calls for a numeric value, use this to specify that numeric value to be compared with the metric .
cidrs (list) --
If the comparisonOperator calls for a set of CIDRs, use this to specify that set to be compared with the metric .
(string) --
ports (list) --
If the comparisonOperator calls for a set of ports, use this to specify that set to be compared with the metric .
(integer) --
durationSeconds (integer) --
Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time dimension (for example, NUM_MESSAGES_SENT ). For a statisticalThreshhold 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.
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 (dict) --
A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in compliance or in violation of the behavior.
statistic (string) --
The percentile which resolves to a threshold value by which compliance with a behavior is determined. Metrics are collected over the specified period (durationSeconds ) 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 (comparisonOperator ) the value associated with the percentile specified, then the device is considered to be in compliance with the behavior, otherwise a violation occurs.
dict
Response Syntax
{ 'valid': True|False, 'validationErrors': [ { 'errorMessage': 'string' }, ] }
Response Structure
(dict) --
valid (boolean) --
True if the behaviors were valid.
validationErrors (list) --
The list of any errors found in the behaviors.
(dict) --
Information about an error found in a behavior specification.
errorMessage (string) --
The description of an error found in the behaviors.