Skip to content

remove_key_replication_regions

remove_key_replication_regions(
    key_identifier: KeyArnOrKeyAliasType,
    replication_regions: Regions,
    *,
    config_overrides: Optional[PaymentCryptographyClientConfig] = None,
) -> RemoveKeyReplicationRegionsOutput

Removes Replication Regions from an existing Amazon Web Services Payment Cryptography key, disabling the key's availability for cryptographic operations in the specified Amazon Web Services Regions.

When you remove Replication Regions, the key material is securely deleted from those regions and can no longer be used for cryptographic operations there. This operation is irreversible for the specified Amazon Web Services Regions. For more information, see Multi-Region key replication.

Ensure that no active cryptographic operations or applications depend on the key in the regions you're removing before performing this operation.

Cross-account use: This operation supports cross-account use when the key has a resource-based policy that grants access. For more information, see Resource-based policies.

Related operations:

Parameters:

  • key_identifier (KeyArnOrKeyAliasType) –

    The key identifier (ARN or alias) of the key from which to remove replication regions.

    This key must exist and have replication enabled in the specified regions.

  • replication_regions (Regions) –

    The list of Amazon Web Services Regions to remove from the key's replication configuration.

    The key will no longer be available for cryptographic operations in these regions after removal. Ensure no active operations depend on the key in these regions before removal.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

    This exception is thrown when the caller lacks the necessary IAM permissions to perform the requested operation. Verify that your IAM policy includes the required permissions for the specific Amazon Web Services Payment Cryptography action you're attempting.

  • ConflictException –

    This request can cause an inconsistent state for the resource.

    The requested operation conflicts with the current state of the resource. For example, attempting to delete a key that is currently being used, or trying to create a resource that already exists.

  • InternalServerException –

    The request processing has failed because of an unknown error, exception, or failure.

    This indicates a server-side error within the Amazon Web Services Payment Cryptography service. If this error persists, contact support for assistance.

  • ResourceNotFoundException –

    The request was denied due to resource not found.

    The specified key, alias, or other resource does not exist in your account or region. Verify that the resource identifier is correct and that the resource exists in the expected region.

  • ServiceQuotaExceededException –

    This request would cause a service quota to be exceeded.

    You have reached the maximum number of keys, aliases, or other resources allowed in your account. Review your current usage and consider deleting unused resources or requesting a quota increase.

  • ThrottlingException –

    The request was denied due to request throttling.

    You have exceeded the rate limits for Amazon Web Services Payment Cryptography API calls. Implement exponential backoff and retry logic in your application to handle throttling gracefully.

  • ValidationException –

    The request was denied due to an invalid request error.

    One or more parameters in your request are invalid. Check the parameter values, formats, and constraints specified in the API documentation.

  • UnknownServiceError –

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

Source code in docs_src/capo_payment_cryptography/_services/payment_cryptography.py
def remove_key_replication_regions(
    self,
    key_identifier: "capo_payment_cryptography.types.key_arn_or_key_alias_type.KeyArnOrKeyAliasType",
    replication_regions: "capo_payment_cryptography.types.regions.Regions",
    *,
    config_overrides: Optional[PaymentCryptographyClientConfig] = None,
) -> "capo_payment_cryptography.types.remove_key_replication_regions_output.RemoveKeyReplicationRegionsOutput":
    """<p>Removes Replication Regions from an existing Amazon Web Services Payment Cryptography key, disabling the key's availability for cryptographic operations in the specified Amazon Web Services Regions.</p> <p>When you remove Replication Regions, the key material is securely deleted from those regions and can no longer be used for cryptographic operations there. This operation is irreversible for the specified Amazon Web Services Regions. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-multi-region-replication.html">Multi-Region key replication</a>.</p> <important> <p>Ensure that no active cryptographic operations or applications depend on the key in the regions you're removing before performing this operation.</p> </important> <p> <b>Cross-account use:</b> This operation supports cross-account use when the key has a resource-based policy that grants access. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/security_iam_resource-based-policies.html">Resource-based policies</a>.</p> <p> <b>Related operations:</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_AddKeyReplicationRegions.html">AddKeyReplicationRegions</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DisableDefaultKeyReplicationRegions.html">DisableDefaultKeyReplicationRegions</a> </p> </li> </ul>

    Args:
        key_identifier: <p>The key identifier (ARN or alias) of the key from which to remove replication regions.</p> <p>This key must exist and have replication enabled in the specified regions.</p>
        replication_regions: <p>The list of Amazon Web Services Regions to remove from the key's replication configuration.</p> <p>The key will no longer be available for cryptographic operations in these regions after removal. Ensure no active operations depend on the key in these regions before removal.</p>

    Raises:
        capo_payment_cryptography.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p> <p>This exception is thrown when the caller lacks the necessary IAM permissions to perform the requested operation. Verify that your IAM policy includes the required permissions for the specific Amazon Web Services Payment Cryptography action you're attempting.</p>
        capo_payment_cryptography.errors.conflict_exception.ConflictException: <p>This request can cause an inconsistent state for the resource.</p> <p>The requested operation conflicts with the current state of the resource. For example, attempting to delete a key that is currently being used, or trying to create a resource that already exists.</p>
        capo_payment_cryptography.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception, or failure.</p> <p>This indicates a server-side error within the Amazon Web Services Payment Cryptography service. If this error persists, contact support for assistance.</p>
        capo_payment_cryptography.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was denied due to resource not found.</p> <p>The specified key, alias, or other resource does not exist in your account or region. Verify that the resource identifier is correct and that the resource exists in the expected region.</p>
        capo_payment_cryptography.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This request would cause a service quota to be exceeded.</p> <p>You have reached the maximum number of keys, aliases, or other resources allowed in your account. Review your current usage and consider deleting unused resources or requesting a quota increase.</p>
        capo_payment_cryptography.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p> <p>You have exceeded the rate limits for Amazon Web Services Payment Cryptography API calls. Implement exponential backoff and retry logic in your application to handle throttling gracefully.</p>
        capo_payment_cryptography.errors.validation_exception.ValidationException: <p>The request was denied due to an invalid request error.</p> <p>One or more parameters in your request are invalid. Check the parameter values, formats, and constraints specified in the API documentation.</p>
        capo_payment_cryptography.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_payment_cryptography.types.remove_key_replication_regions_input.RemoveKeyReplicationRegionsInput]",
    ) -> OperationResponse[
        "capo_payment_cryptography.types.remove_key_replication_regions_output.RemoveKeyReplicationRegionsOutput"
    ]:
        import capo_payment_cryptography._operations.payment_cryptography_control_plane.remove_key_replication_regions

        output, http_response = (
            capo_payment_cryptography._operations.payment_cryptography_control_plane.remove_key_replication_regions.remove_key_replication_regions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RemoveKeyReplicationRegions")
    )
    input_: capo_payment_cryptography.types.remove_key_replication_regions_input.RemoveKeyReplicationRegionsInput = {
        "key_identifier": key_identifier,
        "replication_regions": replication_regions,
    }

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