Skip to content

create_security_profile async

create_security_profile(
    security_profile_name: SecurityProfileName,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    security_profile_description: Optional[SecurityProfileDescription] = None,
    behaviors: Optional[Behaviors] = None,
    alert_targets: Optional[AlertTargets] = None,
    additional_metrics_to_retain: Optional[AdditionalMetricsToRetainList] = None,
    additional_metrics_to_retain_v2: Optional[AdditionalMetricsToRetainV2List] = None,
    tags: Optional[TagList] = None,
    metrics_export_config: Optional[MetricsExportConfig] = None,
) -> CreateSecurityProfileResponse

The IoT Device Defender detect feature will no longer be available to new customers starting August 31, 2026. If you would like to use the detect feature, sign up prior to August 31, 2026. To learn about alternatives to IoT Device Defender detect, see IoT Device Defender detect feature availability change in the IoT Device Defender Developer Guide. There is no change to IoT Device Defender audit availability.

Creates a Device Defender security profile.

Requires permission to access the CreateSecurityProfile action.

Parameters:

  • security_profile_name (SecurityProfileName) –

    The name you are giving to the security profile.

  • security_profile_description (Optional[SecurityProfileDescription], default: None ) –

    A description of the security profile.

  • behaviors (Optional[Behaviors], default: None ) –

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

  • alert_targets (Optional[AlertTargets], default: 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.

  • additional_metrics_to_retain (Optional[AdditionalMetricsToRetainList], default: None ) –

    Please use CreateSecurityProfileRequest$additionalMetricsToRetainV2 instead.

    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.

  • additional_metrics_to_retain_v2 (Optional[AdditionalMetricsToRetainV2List], default: None ) –

    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.

  • tags (Optional[TagList], default: None ) –

    Metadata that can be used to manage the security profile.

  • metrics_export_config (Optional[MetricsExportConfig], default: None ) –

    Specifies the MQTT topic and role ARN required for metric export.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def create_security_profile(
    self,
    security_profile_name: "capo_iot.types.security_profile_name.SecurityProfileName",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    security_profile_description: Optional[
        "capo_iot.types.security_profile_description.SecurityProfileDescription"
    ] = None,
    behaviors: Optional["capo_iot.types.behaviors.Behaviors"] = None,
    alert_targets: Optional["capo_iot.types.alert_targets.AlertTargets"] = None,
    additional_metrics_to_retain: Optional[
        "capo_iot.types.additional_metrics_to_retain_list.AdditionalMetricsToRetainList"
    ] = None,
    additional_metrics_to_retain_v2: Optional[
        "capo_iot.types.additional_metrics_to_retain_v2_list.AdditionalMetricsToRetainV2List"
    ] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
    metrics_export_config: Optional[
        "capo_iot.types.metrics_export_config.MetricsExportConfig"
    ] = None,
) -> (
    "capo_iot.types.create_security_profile_response.CreateSecurityProfileResponse"
):
    """<note> <p>The IoT Device Defender detect feature will no longer be available to new customers starting August 31, 2026. If you would like to use the detect feature, sign up prior to August 31, 2026. To learn about alternatives to IoT Device Defender detect, see IoT Device Defender detect feature availability change in the IoT Device Defender Developer Guide. There is no change to IoT Device Defender audit availability.</p> </note> <p>Creates a Device Defender security profile.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateSecurityProfile</a> action.</p>

    Args:
        security_profile_name: <p>The name you are giving to the security profile.</p>
        security_profile_description: <p>A description of the security profile.</p>
        behaviors: <p>Specifies the behaviors that, when violated by a device (thing), cause an alert.</p>
        alert_targets: <p>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.</p>
        additional_metrics_to_retain: <p> <i>Please use <a>CreateSecurityProfileRequest$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>
        additional_metrics_to_retain_v2: <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>
        tags: <p>Metadata that can be used to manage the security profile.</p>
        metrics_export_config: <p>Specifies the MQTT topic and role ARN required for metric export.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.create_security_profile_request.CreateSecurityProfileRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.create_security_profile_response.CreateSecurityProfileResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_security_profile

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.create_security_profile.async_create_security_profile(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSecurityProfile")
    )
    input_: capo_iot.types.create_security_profile_request.CreateSecurityProfileRequest = {
        "security_profile_name": security_profile_name
    }
    if security_profile_description is not None:
        input_["security_profile_description"] = security_profile_description
    if behaviors is not None:
        input_["behaviors"] = behaviors
    if alert_targets is not None:
        input_["alert_targets"] = alert_targets
    if additional_metrics_to_retain is not None:
        input_["additional_metrics_to_retain"] = additional_metrics_to_retain
    if additional_metrics_to_retain_v2 is not None:
        input_["additional_metrics_to_retain_v2"] = additional_metrics_to_retain_v2
    if tags is not None:
        input_["tags"] = tags
    if metrics_export_config is not None:
        input_["metrics_export_config"] = metrics_export_config

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output