CfnSecurityProfile
- class aws_cdk.aws_iot.CfnSecurityProfile(scope, id, *, additional_metrics_to_retain_v2=None, alert_targets=None, behaviors=None, security_profile_description=None, security_profile_name=None, tags=None, target_arns=None)
Bases:
CfnResource
A CloudFormation
AWS::IoT::SecurityProfile
.Use the
AWS::IoT::SecurityProfile
resource to create a Device Defender security profile. For API reference, see CreateSecurityProfile and for general information, see Detect .- CloudformationResource:
AWS::IoT::SecurityProfile
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-securityprofile.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot cfn_security_profile = iot.CfnSecurityProfile(self, "MyCfnSecurityProfile", additional_metrics_to_retain_v2=[iot.CfnSecurityProfile.MetricToRetainProperty( metric="metric", # the properties below are optional metric_dimension=iot.CfnSecurityProfile.MetricDimensionProperty( dimension_name="dimensionName", # the properties below are optional operator="operator" ) )], alert_targets={ "alert_targets_key": iot.CfnSecurityProfile.AlertTargetProperty( alert_target_arn="alertTargetArn", role_arn="roleArn" ) }, behaviors=[iot.CfnSecurityProfile.BehaviorProperty( name="name", # the properties below are optional criteria=iot.CfnSecurityProfile.BehaviorCriteriaProperty( comparison_operator="comparisonOperator", consecutive_datapoints_to_alarm=123, consecutive_datapoints_to_clear=123, duration_seconds=123, ml_detection_config=iot.CfnSecurityProfile.MachineLearningDetectionConfigProperty( confidence_level="confidenceLevel" ), statistical_threshold=iot.CfnSecurityProfile.StatisticalThresholdProperty( statistic="statistic" ), value=iot.CfnSecurityProfile.MetricValueProperty( cidrs=["cidrs"], count="count", number=123, numbers=[123], ports=[123], strings=["strings"] ) ), metric="metric", metric_dimension=iot.CfnSecurityProfile.MetricDimensionProperty( dimension_name="dimensionName", # the properties below are optional operator="operator" ), suppress_alerts=False )], security_profile_description="securityProfileDescription", security_profile_name="securityProfileName", tags=[CfnTag( key="key", value="value" )], target_arns=["targetArns"] )
Create a new
AWS::IoT::SecurityProfile
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
additional_metrics_to_retain_v2 (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,MetricToRetainProperty
,Dict
[str
,Any
]]],None
]) – A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile’sbehaviors
, but it’s also retained for any metric specified here. Can be used with custom metrics; can’t be used with dimensions.alert_targets (
Union
[IResolvable
,Mapping
[str
,Union
[IResolvable
,AlertTargetProperty
,Dict
[str
,Any
]]],None
]) – 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.behaviors (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,BehaviorProperty
,Dict
[str
,Any
]]],None
]) – Specifies the behaviors that, when violated by a device (thing), cause an alert.security_profile_description (
Optional
[str
]) – A description of the security profile.security_profile_name (
Optional
[str
]) – The name you gave to the security profile.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Metadata that can be used to manage the security profile.target_arns (
Optional
[Sequence
[str
]]) – The ARN of the target (thing group) to which the security profile is attached.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::IoT::SecurityProfile'
- additional_metrics_to_retain_v2
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’s also retained for any metric specified here. Can be used with custom metrics; can’t be used with dimensions.
- alert_targets
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.
- attr_security_profile_arn
The Amazon Resource Name (ARN) of the security profile.
- CloudformationAttribute:
SecurityProfileArn
- behaviors
Specifies the behaviors that, when violated by a device (thing), cause an alert.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- security_profile_description
A description of the security profile.
- security_profile_name
The name you gave to the security profile.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Metadata that can be used to manage the security profile.
- target_arns
The ARN of the target (thing group) to which the security profile is attached.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
AlertTargetProperty
- class CfnSecurityProfile.AlertTargetProperty(*, alert_target_arn, role_arn)
Bases:
object
A structure containing the alert target ARN and the role ARN.
- Parameters:
alert_target_arn (
str
) – The Amazon Resource Name (ARN) of the notification target to which alerts are sent.role_arn (
str
) – The ARN of the role that grants permission to send alerts to the notification target.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot alert_target_property = iot.CfnSecurityProfile.AlertTargetProperty( alert_target_arn="alertTargetArn", role_arn="roleArn" )
Attributes
- alert_target_arn
The Amazon Resource Name (ARN) of the notification target to which alerts are sent.
- role_arn
The ARN of the role that grants permission to send alerts to the notification target.
BehaviorCriteriaProperty
- class CfnSecurityProfile.BehaviorCriteriaProperty(*, comparison_operator=None, consecutive_datapoints_to_alarm=None, consecutive_datapoints_to_clear=None, duration_seconds=None, ml_detection_config=None, statistical_threshold=None, value=None)
Bases:
object
The criteria by which the behavior is determined to be normal.
- Parameters:
comparison_operator (
Optional
[str
]) – The operator that relates the thing measured (metric
) to the criteria (containing avalue
orstatisticalThreshold
). Valid operators include: -string-list
:in-set
andnot-in-set
-number-list
:in-set
andnot-in-set
-ip-address-list
:in-cidr-set
andnot-in-cidr-set
-number
:less-than
,less-than-equals
,greater-than
, andgreater-than-equals
consecutive_datapoints_to_alarm (
Union
[int
,float
,None
]) – 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.consecutive_datapoints_to_clear (
Union
[int
,float
,None
]) – 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.duration_seconds (
Union
[int
,float
,None
]) – Use this to specify the time duration over which the behavior is evaluated, for those criteria that have a time dimension (for example,NUM_MESSAGES_SENT
). For astatisticalThreshhold
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.ml_detection_config (
Union
[IResolvable
,MachineLearningDetectionConfigProperty
,Dict
[str
,Any
],None
]) – The confidence level of the detection model.statistical_threshold (
Union
[IResolvable
,StatisticalThresholdProperty
,Dict
[str
,Any
],None
]) – 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.value (
Union
[IResolvable
,MetricValueProperty
,Dict
[str
,Any
],None
]) – The value to be compared with themetric
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot behavior_criteria_property = iot.CfnSecurityProfile.BehaviorCriteriaProperty( comparison_operator="comparisonOperator", consecutive_datapoints_to_alarm=123, consecutive_datapoints_to_clear=123, duration_seconds=123, ml_detection_config=iot.CfnSecurityProfile.MachineLearningDetectionConfigProperty( confidence_level="confidenceLevel" ), statistical_threshold=iot.CfnSecurityProfile.StatisticalThresholdProperty( statistic="statistic" ), value=iot.CfnSecurityProfile.MetricValueProperty( cidrs=["cidrs"], count="count", number=123, numbers=[123], ports=[123], strings=["strings"] ) )
Attributes
- comparison_operator
The operator that relates the thing measured (
metric
) to the criteria (containing avalue
orstatisticalThreshold
).Valid operators include:
string-list
:in-set
andnot-in-set
number-list
:in-set
andnot-in-set
ip-address-list
:in-cidr-set
andnot-in-cidr-set
number
:less-than
,less-than-equals
,greater-than
, andgreater-than-equals
- consecutive_datapoints_to_alarm
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.
- consecutive_datapoints_to_clear
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.
- duration_seconds
Use this to specify the time duration over which the behavior is evaluated, for those criteria that 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. Cannot be used with list-based metric datatypes.
- ml_detection_config
The confidence level of the detection model.
- statistical_threshold
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.
- value
The value to be compared with the
metric
.
BehaviorProperty
- class CfnSecurityProfile.BehaviorProperty(*, name, criteria=None, metric=None, metric_dimension=None, suppress_alerts=None)
Bases:
object
A Device Defender security profile behavior.
- Parameters:
name (
str
) – The name you’ve given to the behavior.criteria (
Union
[IResolvable
,BehaviorCriteriaProperty
,Dict
[str
,Any
],None
]) – The criteria that determine if a device is behaving normally in regard to themetric
.metric (
Optional
[str
]) – What is measured by the behavior.metric_dimension (
Union
[IResolvable
,MetricDimensionProperty
,Dict
[str
,Any
],None
]) – The dimension of the metric.suppress_alerts (
Union
[bool
,IResolvable
,None
]) – The alert status. If you set the value totrue
, alerts will be suppressed.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot behavior_property = iot.CfnSecurityProfile.BehaviorProperty( name="name", # the properties below are optional criteria=iot.CfnSecurityProfile.BehaviorCriteriaProperty( comparison_operator="comparisonOperator", consecutive_datapoints_to_alarm=123, consecutive_datapoints_to_clear=123, duration_seconds=123, ml_detection_config=iot.CfnSecurityProfile.MachineLearningDetectionConfigProperty( confidence_level="confidenceLevel" ), statistical_threshold=iot.CfnSecurityProfile.StatisticalThresholdProperty( statistic="statistic" ), value=iot.CfnSecurityProfile.MetricValueProperty( cidrs=["cidrs"], count="count", number=123, numbers=[123], ports=[123], strings=["strings"] ) ), metric="metric", metric_dimension=iot.CfnSecurityProfile.MetricDimensionProperty( dimension_name="dimensionName", # the properties below are optional operator="operator" ), suppress_alerts=False )
Attributes
- criteria
The criteria that determine if a device is behaving normally in regard to the
metric
.
- metric
What is measured by the behavior.
- metric_dimension
The dimension of the metric.
- name
The name you’ve given to the behavior.
- suppress_alerts
The alert status.
If you set the value to
true
, alerts will be suppressed.
MachineLearningDetectionConfigProperty
- class CfnSecurityProfile.MachineLearningDetectionConfigProperty(*, confidence_level=None)
Bases:
object
The
MachineLearningDetectionConfig
property type controls confidence of the machine learning model.- Parameters:
confidence_level (
Optional
[str
]) – The model confidence level. There are three levels of confidence,"high"
,"medium"
, and"low"
. The higher the confidence level, the lower the sensitivity, and the lower the alarm frequency will be.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot machine_learning_detection_config_property = iot.CfnSecurityProfile.MachineLearningDetectionConfigProperty( confidence_level="confidenceLevel" )
Attributes
- confidence_level
The model confidence level.
There are three levels of confidence,
"high"
,"medium"
, and"low"
.The higher the confidence level, the lower the sensitivity, and the lower the alarm frequency will be.
MetricDimensionProperty
- class CfnSecurityProfile.MetricDimensionProperty(*, dimension_name, operator=None)
Bases:
object
The dimension of the metric.
- Parameters:
dimension_name (
str
) – The name of the dimension.operator (
Optional
[str
]) – Operators are constructs that perform logical operations. Valid values areIN
andNOT_IN
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot metric_dimension_property = iot.CfnSecurityProfile.MetricDimensionProperty( dimension_name="dimensionName", # the properties below are optional operator="operator" )
Attributes
- dimension_name
The name of the dimension.
- operator
Operators are constructs that perform logical operations.
Valid values are
IN
andNOT_IN
.
MetricToRetainProperty
- class CfnSecurityProfile.MetricToRetainProperty(*, metric, metric_dimension=None)
Bases:
object
The metric you want to retain.
Dimensions are optional.
- Parameters:
metric (
str
) – A standard of measurement.metric_dimension (
Union
[IResolvable
,MetricDimensionProperty
,Dict
[str
,Any
],None
]) – The dimension of the metric.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot metric_to_retain_property = iot.CfnSecurityProfile.MetricToRetainProperty( metric="metric", # the properties below are optional metric_dimension=iot.CfnSecurityProfile.MetricDimensionProperty( dimension_name="dimensionName", # the properties below are optional operator="operator" ) )
Attributes
- metric
A standard of measurement.
- metric_dimension
The dimension of the metric.
MetricValueProperty
- class CfnSecurityProfile.MetricValueProperty(*, cidrs=None, count=None, number=None, numbers=None, ports=None, strings=None)
Bases:
object
The value to be compared with the
metric
.- Parameters:
cidrs (
Optional
[Sequence
[str
]]) – If thecomparisonOperator
calls for a set of CIDRs, use this to specify that set to be compared with themetric
.count (
Optional
[str
]) – If thecomparisonOperator
calls for a numeric value, use this to specify that numeric value to be compared with themetric
.number (
Union
[int
,float
,None
]) – The numeric values of a metric.numbers (
Union
[IResolvable
,Sequence
[Union
[int
,float
]],None
]) – The numeric value of a metric.ports (
Union
[IResolvable
,Sequence
[Union
[int
,float
]],None
]) – If thecomparisonOperator
calls for a set of ports, use this to specify that set to be compared with themetric
.strings (
Optional
[Sequence
[str
]]) – The string values of a metric.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot metric_value_property = iot.CfnSecurityProfile.MetricValueProperty( cidrs=["cidrs"], count="count", number=123, numbers=[123], ports=[123], strings=["strings"] )
Attributes
- cidrs
If the
comparisonOperator
calls for a set of CIDRs, use this to specify that set to be compared with themetric
.
- count
If the
comparisonOperator
calls for a numeric value, use this to specify that numeric value to be compared with themetric
.
- number
The numeric values of a metric.
- numbers
The numeric value of a metric.
- ports
If the
comparisonOperator
calls for a set of ports, use this to specify that set to be compared with themetric
.
- strings
The string values of a metric.
StatisticalThresholdProperty
- class CfnSecurityProfile.StatisticalThresholdProperty(*, statistic=None)
Bases:
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.
- Parameters:
statistic (
Optional
[str
]) – The percentile that 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.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_iot as iot statistical_threshold_property = iot.CfnSecurityProfile.StatisticalThresholdProperty( statistic="statistic" )
Attributes
- statistic
The percentile that 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.