Deleting a DB instance or an Aurora DB cluster - Amazon Aurora

Deleting a DB instance or an Aurora DB cluster

You can delete individual DB instances in an Aurora DB cluster, the cluster itself, or both. To delete a DB instance, you specify the name of the instance. Depending on the method you use to delete a cluster, you either specify the name of the cluster or Aurora deletes the cluster automatically as part of deleting the final DB instance.

  • If the cluster has more than one instance, deleting one of the instances just reduces the computation capacity of the cluster. If you delete the primary instance from a cluster that has more than one instance, Aurora promotes one of the reader instances to take its place. Thus, usually you delete any reader instances from the cluster first.

  • When you use the AWS Management Console, deleting the final DB instance in a DB cluster also deletes the DB cluster and the data in the cluster volume.

  • When you use the AWS CLI or the RDS API, you can delete all the DB instances in the cluster without deleting the cluster itself. Your data remains in the cluster volume. Later, you can create one or more new DB instances to start using the cluster again.

Note

When the status for a DB instance is deleting, its CA certificate value doesn't appear in the RDS console or in output for AWS CLI commands or RDS API operations. For more information about CA certificates, see Using SSL/TLS to encrypt a connection to a DB cluster.

Deletion protection

You can enable deletion protection so that users can't delete a DB cluster. Deletion protection is enabled by default when you create a production DB cluster using the AWS Management Console. However, deletion protection is disabled by default if you create a cluster using the AWS CLI or API. Enabling or disabling deletion protection doesn't cause an outage. For more information about turning deletion protection on and off, see Modifying the DB cluster by using the console, CLI, and API.

Aurora enforces deletion protection for a DB cluster whether you perform the operation from the console, the CLI, or the API. If you try to delete a DB cluster that has deletion protection enabled, you can't do so. To be certain that you can delete the cluster, modify the cluster and disable deletion protection.

Aurora clusters with a single DB instance

If you try to delete the last DB instance in your Aurora cluster, the behavior depends on the method you use. You can delete the last DB instance using the AWS Management Console. Doing so also deletes the DB cluster. You can also delete the last DB instance through the AWS CLI or API, even if the DB cluster has deletion protection enabled. In this case, the DB cluster itself still exists and your data is preserved. You can access the data again by attaching a new DB instance to the cluster.

Aurora MySQL clusters that are read replicas

For Aurora MySQL, you can't delete a DB instance in a DB cluster if both of the following conditions are true:

  • The DB cluster is a read replica of another Aurora DB cluster.

  • The DB instance is the only instance in the DB cluster.

To delete a DB instance in this case, first promote the DB cluster so that it's no longer a read replica. After the promotion completes, you can delete the final DB instance in the DB cluster. For more information, see Replicating Amazon Aurora MySQL DB clusters across AWS Regions.

Deleting an empty Aurora cluster

If you use the AWS Management Console, Aurora automatically deletes your cluster when you delete the last DB instance in that cluster. Thus, the procedures for deleting an empty cluster only apply when you use the AWS CLI or the RDS API.

To delete an empty Aurora DB cluster by using the AWS CLI, call the delete-db-cluster command.

To delete an empty Aurora DB cluster by using the Amazon RDS API, call the DeleteDBInstance operation.

Deleting a DB instance

You can delete a DB instance using the AWS Management Console, the AWS CLI, or the RDS API. The time required to delete a DB instance can vary depending on the backup retention period (that is, how many backups to delete), how much data is deleted, and whether a final snapshot is taken.

Note

You can't delete a DB instance when deletion protection is enabled for it. For more information, see Deletion protection.

You can disable deletion protection for a DB instance by modifying its DB cluster. For more information, see Modifying an Amazon Aurora DB cluster.

To delete a DB instance

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://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. Enter delete me in the box.

  5. Choose Delete.

To delete a DB instance by using the AWS CLI, call the delete-db-instance command and specify the --db-instance-identifier value.

For Linux, macOS, or Unix:

aws rds delete-db-instance \ --db-instance-identifier mydbinstance

For Windows:

aws rds delete-db-instance ^ --db-instance-identifier mydbinstance

To delete a DB instance by using the Amazon RDS API, call the DeleteDBInstance operation and specify the DBInstanceIdentifier parameter.