Skip to content

enable_security_hub

enable_security_hub(
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    tags: Optional[TagMap] = None,
    enable_default_standards: Optional[Boolean] = None,
    control_finding_generator: Optional[ControlFindingGenerator] = None,
) -> EnableSecurityHubResponse

Enables Security Hub CSPM for your account in the current Region or the Region you specify in the request.

When you enable Security Hub CSPM, you grant to Security Hub CSPM the permissions necessary to gather findings from other services that are integrated with Security Hub CSPM.

When you use the EnableSecurityHub operation to enable Security Hub CSPM, you also automatically enable the following standards:

  • Center for Internet Security (CIS) Amazon Web Services Foundations Benchmark v1.2.0

  • Amazon Web Services Foundational Security Best Practices

Other standards are not automatically enabled.

To opt out of automatically enabled standards, set EnableDefaultStandards to false.

After you enable Security Hub CSPM, to enable a standard, use the BatchEnableStandards operation. To disable a standard, use the BatchDisableStandards operation.

To learn more, see the setup information in the Security Hub CSPM User Guide.

Parameters:

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

    The tags to add to the hub resource when you enable Security Hub CSPM.

  • enable_default_standards (Optional[Boolean], default: None ) –

    Whether to enable the security standards that Security Hub CSPM has designated as automatically enabled. If you don't provide a value for EnableDefaultStandards, it is set to true. To not enable the automatically enabled standards, set EnableDefaultStandards to false.

  • control_finding_generator (Optional[ControlFindingGenerator], default: None ) –

    This field, used when enabling Security Hub CSPM, specifies whether the calling account has consolidated control findings turned on. If the value for this field is set to SECURITY_CONTROL, Security Hub CSPM generates a single finding for a control check even when the check applies to multiple enabled standards.

    If the value for this field is set to STANDARD_CONTROL, Security Hub CSPM generates separate findings for a control check when the check applies to multiple enabled standards.

    The value for this field in a member account matches the value in the administrator account. For accounts that aren't part of an organization, the default value of this field is SECURITY_CONTROL if you enabled Security Hub CSPM on or after February 23, 2023.

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action specified in the request.

  • InternalException –

    Internal server error.

  • InvalidAccessException –

    The account doesn't have permission to perform this action.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.

  • ResourceConflictException –

    The resource specified in the request conflicts with an existing resource.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To activate Security Hub The following example activates the Security Hub service in the requesting AWS account. The service is activated in the current AWS Region or the Region that you specify in the request. Some standards are automatically turned on in your account unless you opt out. To determine which standards are automatically turned on, see the Security Hub documentation.

>>> client.enable_security_hub(tags={'Department': 'Security'}, enable_default_standards=True)
Source code in docs_src/capo_securityhub/_services/security_hub.py
def enable_security_hub(
    self,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    tags: Optional["capo_securityhub.types.tag_map.TagMap"] = None,
    enable_default_standards: Optional[
        "capo_securityhub.types.boolean.Boolean"
    ] = None,
    control_finding_generator: Optional[
        "capo_securityhub.types.control_finding_generator.ControlFindingGenerator"
    ] = None,
) -> (
    "capo_securityhub.types.enable_security_hub_response.EnableSecurityHubResponse"
):
    """<p>Enables Security Hub CSPM for your account in the current Region or the Region you specify in the request.</p> <p>When you enable Security Hub CSPM, you grant to Security Hub CSPM the permissions necessary to gather findings from other services that are integrated with Security Hub CSPM.</p> <p>When you use the <code>EnableSecurityHub</code> operation to enable Security Hub CSPM, you also automatically enable the following standards:</p> <ul> <li> <p>Center for Internet Security (CIS) Amazon Web Services Foundations Benchmark v1.2.0</p> </li> <li> <p>Amazon Web Services Foundational Security Best Practices</p> </li> </ul> <p>Other standards are not automatically enabled. </p> <p>To opt out of automatically enabled standards, set <code>EnableDefaultStandards</code> to <code>false</code>.</p> <p>After you enable Security Hub CSPM, to enable a standard, use the <code>BatchEnableStandards</code> operation. To disable a standard, use the <code>BatchDisableStandards</code> operation.</p> <p>To learn more, see the <a href="https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-settingup.html">setup information</a> in the <i>Security Hub CSPM User Guide</i>.</p>

    Args:
        tags: <p>The tags to add to the hub resource when you enable Security Hub CSPM.</p>
        enable_default_standards: <p>Whether to enable the security standards that Security Hub CSPM has designated as automatically enabled. If you don't provide a value for <code>EnableDefaultStandards</code>, it is set to <code>true</code>. To not enable the automatically enabled standards, set <code>EnableDefaultStandards</code> to <code>false</code>.</p>
        control_finding_generator: <p>This field, used when enabling Security Hub CSPM, specifies whether the calling account has consolidated control findings turned on. If the value for this field is set to <code>SECURITY_CONTROL</code>, Security Hub CSPM generates a single finding for a control check even when the check applies to multiple enabled standards.</p> <p>If the value for this field is set to <code>STANDARD_CONTROL</code>, Security Hub CSPM generates separate findings for a control check when the check applies to multiple enabled standards.</p> <p>The value for this field in a member account matches the value in the administrator account. For accounts that aren't part of an organization, the default value of this field is <code>SECURITY_CONTROL</code> if you enabled Security Hub CSPM on or after February 23, 2023.</p>

    Raises:
        capo_securityhub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action specified in the request.</p>
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_access_exception.InvalidAccessException: <p>The account doesn't have permission to perform this action.</p>
        capo_securityhub.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.</p>
        capo_securityhub.errors.resource_conflict_exception.ResourceConflictException: <p>The resource specified in the request conflicts with an existing resource.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To activate Security Hub
        The following example activates the Security Hub service in the requesting AWS account. The service is activated in the current AWS Region or the Region that you specify in the request. Some standards are automatically turned on in your account unless you opt out. To determine which standards are automatically turned on, see the Security Hub documentation.

        >>> client.enable_security_hub(tags={'Department': 'Security'}, enable_default_standards=True)
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.enable_security_hub_request.EnableSecurityHubRequest]",
    ) -> OperationResponse[
        "capo_securityhub.types.enable_security_hub_response.EnableSecurityHubResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.enable_security_hub

        output, http_response = (
            capo_securityhub._operations.security_hub_api_service.enable_security_hub.enable_security_hub(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("EnableSecurityHub")
    )
    input_: capo_securityhub.types.enable_security_hub_request.EnableSecurityHubRequest = {}
    if tags is not None:
        input_["tags"] = tags
    if enable_default_standards is not None:
        input_["enable_default_standards"] = enable_default_standards
    if control_finding_generator is not None:
        input_["control_finding_generator"] = control_finding_generator

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output