

# CancelDBCapacityReservation
<a name="API_CancelDBCapacityReservation"></a>

Cancels a DB capacity reservation. Amazon RDS changes the state of the reservation to `cancelled` and stops reporting available capacity for it. Amazon RDS then releases the reserved capacity.

A DB instance that uses the reservation keeps running. It continues on unreserved capacity, and Amazon RDS doesn't stop it or modify it. However, Amazon RDS no longer reserves capacity for the DB instance. If Amazon RDS later moves the DB instance to different hardware, for example during hardware maintenance, that move can fail when the Amazon Web Services Region has insufficient capacity for the DB instance class.

You can't cancel a reservation in the `active` state during a capacity commitment. The response of `DescribeDBCapacityReservations` reports the end of the commitment in `CommitmentInfo`.

Constraints:
+ The reservation must be in the `active`, `assessing`, or `delayed` state.
+ The reservation must not be past its end date.

## Request Parameters
<a name="API_CancelDBCapacityReservation_RequestParameters"></a>

 For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

 ** DBCapacityReservationIdentifier **   
The identifier or the name of the DB capacity reservation to cancel. You can specify the identifier, which has the prefix `dbcr-`, or the reservation name.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 63.  
Pattern: `[a-z](?:-?[a-z0-9]+){0,15}`   
Required: Yes

## Response Elements
<a name="API_CancelDBCapacityReservation_ResponseElements"></a>

The following element is returned by the service.

 ** DBCapacityReservation **   
Contains the details of the canceled DB capacity reservation.  
Type: [DBCapacityReservation](API_DBCapacityReservation.md) object

## Errors
<a name="API_CancelDBCapacityReservation_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** DBCapacityReservationNotFound **   
 `DBCapacityReservationIdentifier` doesn't refer to an existing DB capacity reservation.  
HTTP Status Code: 404

 ** InvalidDBCapacityReservationState **   
The DB capacity reservation isn't in a valid state.  
HTTP Status Code: 400

## See Also
<a name="API_CancelDBCapacityReservation_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for C\+\+](https://docs.amazonaws.cn/goto/SdkForCpp/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for Python (Boto3)](https://docs.amazonaws.cn/goto/boto3/rds-2014-10-31/CancelDBCapacityReservation) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/rds-2014-10-31/CancelDBCapacityReservation) 