Deleting a DB instance - Amazon Relational Database Service (original) (raw)

You can delete a DB instance using the AWS Management Console, the AWS CLI, or the RDS API. If you want to delete a DB instance in an Aurora DB cluster, see Deleting Aurora DB clusters and DB instances.

Topics

Prerequisites for deleting a DB instance

Before you try to delete your DB instance, make sure that deletion protection is turned off. By default, deletion protection is turned on for a DB instance that was created with the console.

If your DB instance has deletion protection turned on, you can turn it off by modifying your instance settings. Choose Modify in the database details page or call the modify-db-instance command. This operation doesn't cause an outage. For more information, see Settings for DB instances.

Considerations when deleting a DB instance

Deleting a DB instance has an effect on instance recoverability, backup availability, and read replica status. Consider the following issues:

Deleting a DB instance

You can delete a DB instance using the AWS Management Console, the AWS CLI, or the RDS API. You must do the following:

Note

You can't delete a DB instance when deletion protection is turned on. For more information, see Prerequisites for deleting a DB instance.

To delete a DB instance
  1. Sign in to the AWS Management Console and open the Amazon RDS console athttps://console.aws.amazon.com/rds/.
  2. In the navigation pane, choose Databases, and then choose the DB instance that you want to delete.
  3. For Actions, choose Delete.
  4. To create a final DB snapshot for the DB instance, choose Create final snapshot?.
  5. If you chose to create a final snapshot, enter the Final snapshot name.
  6. To retain automated backups, choose Retain automated backups.
  7. Enter delete me in the box.
  8. Choose Delete.

To find the instance IDs of the DB instances in your account, call the describe-db-instances command:

aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier]' --output text

To delete a DB instance by using the AWS CLI, call the delete-db-instance command with the following options:

Example With a final snapshot and no retained automated backups

For Linux, macOS, or Unix:

aws rds delete-db-instance \
    --db-instance-identifier mydbinstance \
    --final-db-snapshot-identifier mydbinstancefinalsnapshot \
    --delete-automated-backups

For Windows:

aws rds delete-db-instance ^
    --db-instance-identifier mydbinstance ^
    --final-db-snapshot-identifier mydbinstancefinalsnapshot ^
    --delete-automated-backups
Example With retained automated backups and no final snapshot

For Linux, macOS, or Unix:

aws rds delete-db-instance \
    --db-instance-identifier mydbinstance \
    --skip-final-snapshot \
    --no-delete-automated-backups

For Windows:

aws rds delete-db-instance ^
    --db-instance-identifier mydbinstance ^
    --skip-final-snapshot ^
    --no-delete-automated-backups

To delete a DB instance by using the Amazon RDS API, call the DeleteDBInstance operation with the following parameters: