Skip to content

start_db_instance

start_db_instance(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_instance_identifier: Optional[String] = None,
    db_capacity_reservation_identifier: Optional[
        DBCapacityReservationIdentifier
    ] = None,
) -> StartDBInstanceResult

Starts an Amazon RDS DB instance that was stopped using the Amazon Web Services console, the stop-db-instance CLI command, or the StopDBInstance operation.

For more information, see Starting an Amazon RDS DB instance That Was Previously Stopped in the Amazon RDS User Guide.

This command doesn't apply to RDS Custom, Aurora MySQL, and Aurora PostgreSQL. For Aurora DB clusters, use StartDBCluster instead.

Parameters:

  • db_instance_identifier (Optional[String], default: None ) –

    The user-supplied instance identifier.

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

    The identifier or the name of the DB capacity reservation for the DB instance to use after it starts. You can specify the identifier, which has the prefix dbcr-, or the reservation name.

    Specify this parameter when the DB instance stopped using a reservation, or when you want the DB instance to use a different reservation.

    If you omit this parameter, and the DB instance kept a DB capacity reservation when it stopped, Amazon RDS starts the DB instance in that reservation.

    If that reservation is deleted, ended, or cancelled, the DB instance still starts. Amazon RDS starts the DB instance outside the reservation, on unreserved capacity, and it charges on-demand prices for the DB instance.

    If that reservation has no available capacity in the Availability Zone of the DB instance, the request fails. Amazon RDS doesn't start the DB instance, and it doesn't wait for capacity in that Availability Zone. Specify a reservation that has available capacity in that Availability Zone, or retry the request after the reservation has available capacity.

    Constraints:

    • The reservation must be in the active state.

    • The reservation must reserve capacity for the DB instance class and the engine of the DB instance.

    • The reservation must cover the Availability Zone of the DB instance, and it must have available capacity in that Availability Zone.

Raises:

Examples:

To start a DB instance The following example starts the specified DB instance.

>>> client.start_db_instance(db_instance_identifier='test-instance')
Source code in docs_src/capo_rds/_services/rds.py
def start_db_instance(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_instance_identifier: Optional["capo_rds.types.string.String"] = None,
    db_capacity_reservation_identifier: Optional[
        "capo_rds.types.db_capacity_reservation_identifier.DBCapacityReservationIdentifier"
    ] = None,
) -> "capo_rds.types.start_db_instance_result.StartDBInstanceResult":
    """<p>Starts an Amazon RDS DB instance that was stopped using the Amazon Web Services console, the stop-db-instance CLI command, or the <code>StopDBInstance</code> operation.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_StartInstance.html"> Starting an Amazon RDS DB instance That Was Previously Stopped</a> in the <i>Amazon RDS User Guide.</i> </p> <note> <p>This command doesn't apply to RDS Custom, Aurora MySQL, and Aurora PostgreSQL. For Aurora DB clusters, use <code>StartDBCluster</code> instead.</p> </note>

    Args:
        db_instance_identifier: <p>The user-supplied instance identifier.</p>
        db_capacity_reservation_identifier: <p>The identifier or the name of the DB capacity reservation for the DB instance to use after it starts. You can specify the identifier, which has the prefix <code>dbcr-</code>, or the reservation name.</p> <p>Specify this parameter when the DB instance stopped using a reservation, or when you want the DB instance to use a different reservation.</p> <p>If you omit this parameter, and the DB instance kept a DB capacity reservation when it stopped, Amazon RDS starts the DB instance in that reservation.</p> <p>If that reservation is deleted, ended, or cancelled, the DB instance still starts. Amazon RDS starts the DB instance outside the reservation, on unreserved capacity, and it charges on-demand prices for the DB instance.</p> <p>If that reservation has no available capacity in the Availability Zone of the DB instance, the request fails. Amazon RDS doesn't start the DB instance, and it doesn't wait for capacity in that Availability Zone. Specify a reservation that has available capacity in that Availability Zone, or retry the request after the reservation has available capacity.</p> <p>Constraints:</p> <ul> <li> <p>The reservation must be in the <code>active</code> state.</p> </li> <li> <p>The reservation must reserve capacity for the DB instance class and the engine of the DB instance.</p> </li> <li> <p>The reservation must cover the Availability Zone of the DB instance, and it must have available capacity in that Availability Zone.</p> </li> </ul>

    Raises:
        capo_rds.errors.authorization_not_found_fault.AuthorizationNotFoundFault: <p>The specified CIDR IP range or Amazon EC2 security group might not be authorized for the specified DB security group.</p> <p>Or, RDS might not be authorized to perform necessary actions using IAM on your behalf.</p>
        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.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing DB cluster.</p>
        capo_rds.errors.db_instance_not_found_fault.DBInstanceNotFoundFault: <p> <code>DBInstanceIdentifier</code> doesn't refer to an existing DB instance.</p>
        capo_rds.errors.db_subnet_group_does_not_cover_enough_a_zs.DBSubnetGroupDoesNotCoverEnoughAZs: <p>Subnets in the DB subnet group should cover at least two Availability Zones unless there is only one Availability Zone.</p>
        capo_rds.errors.db_subnet_group_not_found_fault.DBSubnetGroupNotFoundFault: <p> <code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</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.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The requested operation can't be performed while the cluster is in this state.</p>
        capo_rds.errors.invalid_db_instance_state_fault.InvalidDBInstanceStateFault: <p>The DB instance isn't in a valid state.</p>
        capo_rds.errors.invalid_subnet.InvalidSubnet: <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
        capo_rds.errors.invalid_vpc_network_state_fault.InvalidVPCNetworkStateFault: <p>The DB subnet group doesn't cover all Availability Zones after it's created because of users' change.</p>
        capo_rds.errors.kms_key_not_accessible_fault.KMSKeyNotAccessibleFault: <p>An error occurred accessing an Amazon Web Services KMS key.</p>
        capo_rds.errors.vpc_encryption_control_violation_exception.VpcEncryptionControlViolationException: <p>The operation violates VPC encryption control settings. Make sure that your DB instance type supports the Nitro encryption-in-transit capability, or modify your VPC's encryption controls to not enforce encryption-in-transit.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To start a DB instance
        The following example starts the specified DB instance.

        >>> client.start_db_instance(db_instance_identifier='test-instance')
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.start_db_instance_message.StartDBInstanceMessage]",
    ) -> OperationResponse[
        "capo_rds.types.start_db_instance_result.StartDBInstanceResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.start_db_instance

        output, http_response = (
            capo_rds._operations.amazon_rd_sv19.start_db_instance.start_db_instance(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_rds.types.start_db_instance_result.StartDBInstanceResult",
    ) -> dict[str, Any]:
        import capo_rds.types.start_db_instance_result

        return capo_rds.types.start_db_instance_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartDBInstance", redact_output=_redact_output),
    )
    input_: capo_rds.types.start_db_instance_message.StartDBInstanceMessage = {}
    if db_instance_identifier is not None:
        input_["db_instance_identifier"] = db_instance_identifier
    if db_capacity_reservation_identifier is not None:
        input_["db_capacity_reservation_identifier"] = (
            db_capacity_reservation_identifier
        )

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