How can I troubleshoot an error that I received when deleting an Amazon Aurora cluster?

Last updated: 2019-05-16

I want to delete an Amazon Aurora cluster, but:

  • I received an error message.
    - or -
  • The option to delete is unavailable (grayed out) in the Amazon Aurora console.

How can I troubleshoot this issue and delete my cluster?

Short Description

You can use the Amazon Relational Database Service (Amazon RDS) console or the AWS Command Line Interface (AWS CLI) to delete an Aurora cluster. For more information, see Deleting a DB Instance.

To delete an Aurora cluster using the AWS CLI, you must first delete all instances inside the cluster. After you delete all instances inside a cluster, you can then delete the cluster by using delete-db-cluster. If you delete the last instance in the cluster using the Amazon RDS console, the empty cluster is also automatically deleted.

Resolution

Before deleting a cluster, consider the following:

  • If you have a cluster with only one instance and you delete that instance using the Amazon RDS console, then both that instance and the cluster are deleted.
  • If you have a cluster with one writer instance and one or more reader instance/read replicas, and you delete the reader instance, then the writer instance and the cluster aren't affected. However, if you delete the writer instance, the reader instance is promoted as a writer. Then, the reader instance fails over, and this can cause downtime.

Deleting an RDS cluster using the RDS console

Follow these steps in the Amazon RDS console:

  1. Open the Amazon RDS console.
  2. Choose Clusters from the navigation pane, and then select the cluster.
  3. Choose Actions, and then choose Delete Cluster
  4. Note: If Delete Cluster is gray or unavailable, there might be an instance inside the cluster that you need to delete.

If you receive the following error: "This database has deletion protection option enabled, to be able to delete the last Aurora DB instance, modify the Aurora cluster and disable deletion protection," then follow these steps:

  1. Open the Amazon RDS console.
  2. Choose Clusters from the navigation pane, and then select the cluster.
  3. Choose Actions, and then choose Modify Cluster.
  4. Choose Disable deletion protection, and choose Continue.
  5. Choose Apply immediately.

Deleting an RDS cluster using the AWS CLI

Note: The following steps are applicable for both Aurora MySQL and Aurora PostgreSQL.

Delete an Aurora cluster by running a command similar to the following:

aws rds delete-db-cluster --db-cluster-identifier sample-cluster --final-db-snapshot-identifier mydbinstancefinal

Delete a read replica instance by running a command similar to the following:

aws rds delete-db-instance --db-instance-identifier mysql-aurora-replica --final-db-snapshot-identifier mydbinstancefinal2

If you receive an error message when trying to delete an Aurora using the AWS CLI, check the following:

InvalidDBClusterStateFault error

"An error occurred (InvalidDBClusterStateFault) when calling the DeleteDBCluster operation: Cluster cannot be deleted, it still contains DB instances in non-deleting state"

All instances associated with the cluster must be deleted before you can delete the cluster. Delete the instance by running a command similar to the following:

aws rds delete-db-instance --db-instance-identifier sample-instance --final-db-snapshot-identifier mydbinstancefinal

InvalidParameterCombination error

"An error occurred (InvalidParameterCombination) when calling the DeleteDBInstance operation: FinalDBSnapshotIdentifier cannot be specified when deleting a cluster instance"

This error warns you that you haven't taken a cluster-level snapshot before deleting the cluster. You can delete the instance and skip the final snapshot by running a command similar to the following:

aws rds delete-db-instance --db-instance-identifier test-replica --skip-final-snapshot

Note: To keep automated backups, add --no-delete-automated-backups. To delete automated backups, use --delete-automated-backups.

Cannot delete the last instance of the read replica DB cluster error

"Cannot delete the last instance of the read replica DB cluster. Promote the DB cluster to a standalone DB cluster in order to delete it"

Promote the read replica cluster by running a command similar to the following:

aws rds promote-read-replica-db-cluster --db-cluster-identifier rds-mysql-aurora-replica-cluster