Skip to content

modify_db_capacity_reservation async

modify_db_capacity_reservation(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_capacity_reservation_identifier: Optional[
        DBCapacityReservationIdentifier
    ] = None,
    capacity_per_availability_zone: Optional[IntegerOptional] = None,
    end_date_type: Optional[EndDateType] = None,
    end_date: Optional[TStamp] = None,
) -> ModifyDBCapacityReservationResponse

Modifies a DB capacity reservation. You can change the reserved capacity in each Availability Zone of the reservation, and you can change the end date of the reservation. You can't change the Availability Zones of an existing reservation.

The reservation must be in the active state. A future-dated reservation that hasn't started isn't modifiable, and neither is a reservation that Amazon RDS is already modifying.

You must specify CapacityPerAvailabilityZone, EndDateType, or EndDate. A request that specifies none of the three changes nothing, and Amazon RDS rejects it.

Parameters:

  • db_capacity_reservation_identifier (Optional[DBCapacityReservationIdentifier], default: None ) –

    The identifier or the name of the DB capacity reservation to modify. You can specify the identifier, which has the prefix dbcr-, or the reservation name.

  • capacity_per_availability_zone (Optional[IntegerOptional], default: None ) –

    The new number of DB instances to reserve in each Availability Zone of the reservation. Amazon RDS applies this number to every Availability Zone of the reservation.

    An increase reserves more capacity at the time of the request, so it can fail when the Amazon Web Services Region has insufficient capacity.

    This value multiplied by the number of Availability Zones counts against the DB instances quota for your Amazon Web Services account in the Amazon Web Services Region. Amazon RDS checks the quota only when you increase the value.

    Constraints:

    • Minimum 1.

    • Can't be less than the highest number of DB instances that use the reservation in any single Availability Zone of the reservation. That number includes a DB instance that holds a unit of reserved capacity for a pending modification. To find that number for an Availability Zone, subtract AvailableCapacity from ReservedCapacityPerAvailabilityZone.

    • During a capacity commitment, can't be less than CommittedCapacityPerAvailabilityZone.

  • end_date_type (Optional[EndDateType], default: None ) –

    The end date type for the reservation.

    Valid Values:

    • limited - The reservation has a specific end date. You must also specify EndDate.

    • unlimited - The reservation doesn't expire. Don't specify EndDate.

  • end_date (Optional[TStamp], default: None ) –

    The new end date for the reservation, in Universal Coordinated Time (UTC). Required when EndDateType is limited. Don't specify a value when EndDateType is unlimited.

    When you specify EndDate, you must also specify EndDateType.

    Constraints:

    • Must be a date and time in the future.

    • During a capacity commitment, must be at or after CommitmentEndDate.

Raises:

Examples:

To change the capacity and the end date of a DB capacity reservation The following example raises the reserved capacity to three DB instances in each Availability Zone of the reservation, and it sets an end date. Set EndDateType to limited to give the reservation an end date. Set EndDateType to unlimited to remove the end date, and specify no EndDate. Amazon RDS applies the modification asynchronously, and it moves the reservation to the pending state. Call DescribeDBCapacityReservations to check when the reservation returns to the active state with the new capacity.

>>> await client.modify_db_capacity_reservation(db_capacity_reservation_identifier='dbcr-7hqk2m9xv4t1bn6cz3ws8dj5fp0gyr2a', capacity_per_availability_zone=3, end_date_type='limited', end_date='2026-12-31T23:59:59Z')
Source code in docs_src/capo_rds/_services/async_rds.py
async def modify_db_capacity_reservation(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_capacity_reservation_identifier: Optional[
        "capo_rds.types.db_capacity_reservation_identifier.DBCapacityReservationIdentifier"
    ] = None,
    capacity_per_availability_zone: Optional[
        "capo_rds.types.integer_optional.IntegerOptional"
    ] = None,
    end_date_type: Optional["capo_rds.types.end_date_type.EndDateType"] = None,
    end_date: Optional["capo_rds.types.t_stamp.TStamp"] = None,
) -> "capo_rds.types.modify_db_capacity_reservation_response.ModifyDBCapacityReservationResponse":
    """<p>Modifies a DB capacity reservation. You can change the reserved capacity in each Availability Zone of the reservation, and you can change the end date of the reservation. You can't change the Availability Zones of an existing reservation.</p> <p>The reservation must be in the <code>active</code> state. A future-dated reservation that hasn't started isn't modifiable, and neither is a reservation that Amazon RDS is already modifying.</p> <p>You must specify <code>CapacityPerAvailabilityZone</code>, <code>EndDateType</code>, or <code>EndDate</code>. A request that specifies none of the three changes nothing, and Amazon RDS rejects it.</p>

    Args:
        db_capacity_reservation_identifier: <p>The identifier or the name of the DB capacity reservation to modify. You can specify the identifier, which has the prefix <code>dbcr-</code>, or the reservation name.</p>
        capacity_per_availability_zone: <p>The new number of DB instances to reserve in each Availability Zone of the reservation. Amazon RDS applies this number to every Availability Zone of the reservation.</p> <p>An increase reserves more capacity at the time of the request, so it can fail when the Amazon Web Services Region has insufficient capacity.</p> <p>This value multiplied by the number of Availability Zones counts against the DB instances quota for your Amazon Web Services account in the Amazon Web Services Region. Amazon RDS checks the quota only when you increase the value.</p> <p>Constraints:</p> <ul> <li> <p>Minimum 1.</p> </li> <li> <p>Can't be less than the highest number of DB instances that use the reservation in any single Availability Zone of the reservation. That number includes a DB instance that holds a unit of reserved capacity for a pending modification. To find that number for an Availability Zone, subtract <code>AvailableCapacity</code> from <code>ReservedCapacityPerAvailabilityZone</code>.</p> </li> <li> <p>During a capacity commitment, can't be less than <code>CommittedCapacityPerAvailabilityZone</code>.</p> </li> </ul>
        end_date_type: <p>The end date type for the reservation.</p> <p>Valid Values:</p> <ul> <li> <p> <code>limited</code> - The reservation has a specific end date. You must also specify <code>EndDate</code>.</p> </li> <li> <p> <code>unlimited</code> - The reservation doesn't expire. Don't specify <code>EndDate</code>.</p> </li> </ul>
        end_date: <p>The new end date for the reservation, in Universal Coordinated Time (UTC). Required when <code>EndDateType</code> is <code>limited</code>. Don't specify a value when <code>EndDateType</code> is <code>unlimited</code>.</p> <p>When you specify <code>EndDate</code>, you must also specify <code>EndDateType</code>.</p> <p>Constraints:</p> <ul> <li> <p>Must be a date and time in the future.</p> </li> <li> <p>During a capacity commitment, must be at or after <code>CommitmentEndDate</code>.</p> </li> </ul>

    Raises:
        capo_rds.errors.db_capacity_reservation_not_found_fault.DBCapacityReservationNotFoundFault: <p> <code>DBCapacityReservationIdentifier</code> doesn't refer to an existing DB capacity reservation.</p>
        capo_rds.errors.instance_quota_exceeded_fault.InstanceQuotaExceededFault: <p>The request would result in the user exceeding the allowed number of DB instances.</p>
        capo_rds.errors.insufficient_db_instance_capacity_fault.InsufficientDBInstanceCapacityFault: <p>The specified DB instance class isn't available in the specified Availability Zone.</p>
        capo_rds.errors.invalid_db_capacity_reservation_state_fault.InvalidDBCapacityReservationStateFault: <p>The DB capacity reservation isn't in a valid state.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To change the capacity and the end date of a DB capacity reservation
        The following example raises the reserved capacity to three DB instances in each Availability Zone of the reservation, and it sets an end date. Set EndDateType to limited to give the reservation an end date. Set EndDateType to unlimited to remove the end date, and specify no EndDate. Amazon RDS applies the modification asynchronously, and it moves the reservation to the pending state. Call DescribeDBCapacityReservations to check when the reservation returns to the active state with the new capacity.

        >>> await client.modify_db_capacity_reservation(db_capacity_reservation_identifier='dbcr-7hqk2m9xv4t1bn6cz3ws8dj5fp0gyr2a', capacity_per_availability_zone=3, end_date_type='limited', end_date='2026-12-31T23:59:59Z')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.modify_db_capacity_reservation_request.ModifyDBCapacityReservationRequest]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.modify_db_capacity_reservation_response.ModifyDBCapacityReservationResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.modify_db_capacity_reservation

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.modify_db_capacity_reservation.async_modify_db_capacity_reservation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyDBCapacityReservation")
    )
    input_: capo_rds.types.modify_db_capacity_reservation_request.ModifyDBCapacityReservationRequest = {}
    if db_capacity_reservation_identifier is not None:
        input_["db_capacity_reservation_identifier"] = (
            db_capacity_reservation_identifier
        )
    if capacity_per_availability_zone is not None:
        input_["capacity_per_availability_zone"] = capacity_per_availability_zone
    if end_date_type is not None:
        input_["end_date_type"] = end_date_type
    if end_date is not None:
        input_["end_date"] = end_date

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