Skip to content

start_remediation_execution

start_remediation_execution(
    config_rule_name: ConfigRuleName,
    resource_keys: ResourceKeys,
    *,
    config_overrides: Optional[ConfigServiceClientConfig] = None,
) -> StartRemediationExecutionResponse

Runs an on-demand remediation for the specified Config rules against the last known remediation configuration. It runs an execution against the current state of your resources. Remediation execution is asynchronous.

You can specify up to 100 resource keys per request. An existing StartRemediationExecution call for the specified resource keys must complete before you can call the API again.

Parameters:

  • config_rule_name (ConfigRuleName) –

    The list of names of Config rules that you want to run remediation execution for.

  • resource_keys (ResourceKeys) –

    A list of resource keys to be processed with the current request. Each element in the list consists of the resource type and resource ID.

Raises:

  • InsufficientPermissionsException –

    Indicates one of the following errors:

    • For PutConfigRule, the rule cannot be created because the IAM role assigned to Config lacks permissions to perform the config:Put* action.

    • For PutConfigRule, the Lambda function cannot be invoked. Check the function ARN, and check the function's permissions.

    • For PutOrganizationConfigRule, organization Config rule cannot be created because you do not have permissions to call IAM GetRole action or create a service-linked role.

    • For PutConformancePack and PutOrganizationConformancePack, a conformance pack cannot be created because you do not have the following permissions:

      • You do not have permission to call IAM GetRole action or create a service-linked role.

      • You do not have permission to read Amazon S3 bucket or call SSM:GetDocument.

    • For PutServiceLinkedConfigurationRecorder, a service-linked configuration recorder cannot be created because you do not have the following permissions: IAM CreateServiceLinkedRole.

    • For PutConnector, a connector cannot be created because you do not have the following permissions: IAM CreateServiceLinkedRole.

  • InvalidParameterValueException –

    One or more of the specified parameters are not valid. Verify that your parameters are valid and try again.

  • NoSuchRemediationConfigurationException –

    You specified an Config rule without a remediation configuration.

  • UnknownServiceError –

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

Source code in docs_src/capo_config_service/_services/config_service.py
def start_remediation_execution(
    self,
    config_rule_name: "capo_config_service.types.config_rule_name.ConfigRuleName",
    resource_keys: "capo_config_service.types.resource_keys.ResourceKeys",
    *,
    config_overrides: Optional[ConfigServiceClientConfig] = None,
) -> "capo_config_service.types.start_remediation_execution_response.StartRemediationExecutionResponse":
    """<p>Runs an on-demand remediation for the specified Config rules against the last known remediation configuration. It runs an execution against the current state of your resources. Remediation execution is asynchronous.</p> <p>You can specify up to 100 resource keys per request. An existing StartRemediationExecution call for the specified resource keys must complete before you can call the API again.</p>

    Args:
        config_rule_name: <p>The list of names of Config rules that you want to run remediation execution for.</p>
        resource_keys: <p>A list of resource keys to be processed with the current request. Each element in the list consists of the resource type and resource ID. </p>

    Raises:
        capo_config_service.errors.insufficient_permissions_exception.InsufficientPermissionsException: <p>Indicates one of the following errors:</p> <ul> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html">PutConfigRule</a>, the rule cannot be created because the IAM role assigned to Config lacks permissions to perform the config:Put* action.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html">PutConfigRule</a>, the Lambda function cannot be invoked. Check the function ARN, and check the function's permissions.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConfigRule.html">PutOrganizationConfigRule</a>, organization Config rule cannot be created because you do not have permissions to call IAM <code>GetRole</code> action or create a service-linked role.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConformancePack.html">PutConformancePack</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConformancePack.html">PutOrganizationConformancePack</a>, a conformance pack cannot be created because you do not have the following permissions: </p> <ul> <li> <p>You do not have permission to call IAM <code>GetRole</code> action or create a service-linked role.</p> </li> <li> <p>You do not have permission to read Amazon S3 bucket or call SSM:GetDocument.</p> </li> </ul> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html">PutServiceLinkedConfigurationRecorder</a>, a service-linked configuration recorder cannot be created because you do not have the following permissions: IAM <code>CreateServiceLinkedRole</code>.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConnector.html">PutConnector</a>, a connector cannot be created because you do not have the following permissions: IAM <code>CreateServiceLinkedRole</code>.</p> </li> </ul>
        capo_config_service.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One or more of the specified parameters are not valid. Verify that your parameters are valid and try again.</p>
        capo_config_service.errors.no_such_remediation_configuration_exception.NoSuchRemediationConfigurationException: <p>You specified an Config rule without a remediation configuration.</p>
        capo_config_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_config_service.types.start_remediation_execution_request.StartRemediationExecutionRequest]",
    ) -> OperationResponse[
        "capo_config_service.types.start_remediation_execution_response.StartRemediationExecutionResponse"
    ]:
        import capo_config_service._operations.starling_dove_service.start_remediation_execution

        output, http_response = (
            capo_config_service._operations.starling_dove_service.start_remediation_execution.start_remediation_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartRemediationExecution")
    )
    input_: capo_config_service.types.start_remediation_execution_request.StartRemediationExecutionRequest = {
        "config_rule_name": config_rule_name,
        "resource_keys": resource_keys,
    }

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