delete_db_cluster
async
¶
delete_db_cluster(
*,
config_overrides: Optional[AsyncRDSClientConfig] = None,
db_cluster_identifier: Optional[String] = None,
skip_final_snapshot: Optional[Boolean] = None,
final_db_snapshot_identifier: Optional[String] = None,
delete_automated_backups: Optional[BooleanOptional] = None,
delete_db_instances: Optional[BooleanOptional] = None,
) -> DeleteDBClusterResult
The DeleteDBCluster action deletes a previously provisioned DB cluster. When you delete a DB cluster, all automated backups for that DB cluster are deleted and can't be recovered. Manual DB cluster snapshots of the specified DB cluster are not deleted.
If you're deleting a Multi-AZ DB cluster with read replicas, all cluster members are terminated and read replicas are promoted to standalone instances.
To delete an Amazon Aurora DB cluster and all of its DB instances in a single call, set DeleteDBInstances to true. Otherwise, delete each DB instance in the DB cluster before you delete the DB cluster.
For more information on Amazon Aurora, see What is Amazon Aurora? in the Amazon Aurora User Guide.
For more information on Multi-AZ DB clusters, see Multi-AZ DB cluster deployments in the Amazon RDS User Guide.
Parameters:
-
db_cluster_identifier(Optional[String], default:None) –The DB cluster identifier for the DB cluster to be deleted. This parameter isn't case-sensitive.
Constraints:
-
Must match an existing DBClusterIdentifier.
-
-
skip_final_snapshot(Optional[Boolean], default:None) –Specifies whether to skip the creation of a final DB cluster snapshot before RDS deletes the DB cluster. If you set this value to
true, RDS doesn't create a final DB cluster snapshot. If you set this value tofalseor don't specify it, RDS creates a DB cluster snapshot before it deletes the DB cluster. By default, this parameter is disabled, so RDS creates a final DB cluster snapshot.If
SkipFinalSnapshotis disabled, you must specify a value for theFinalDBSnapshotIdentifierparameter. -
final_db_snapshot_identifier(Optional[String], default:None) –The DB cluster snapshot identifier of the new DB cluster snapshot created when
SkipFinalSnapshotis disabled.If you specify this parameter and also skip the creation of a final DB cluster snapshot with the
SkipFinalShapshotparameter, the request results in an error.Constraints:
-
Must be 1 to 255 letters, numbers, or hyphens.
-
First character must be a letter
-
Can't end with a hyphen or contain two consecutive hyphens
-
-
delete_automated_backups(Optional[BooleanOptional], default:None) –Specifies whether to remove automated backups immediately after the DB cluster is deleted. This parameter isn't case-sensitive. The default is to remove automated backups immediately after the DB cluster is deleted, unless the Amazon Web Services Backup policy specifies a point-in-time restore rule.
-
delete_db_instances(Optional[BooleanOptional], default:None) –Specifies whether to delete all DB instances in the DB cluster together with the DB cluster. If you set this value to
true, RDS deletes every DB instance in the DB cluster and then deletes the DB cluster. You don't need to callDeleteDBInstancefor each DB instance first. If you set this value tofalseor don't specify it, RDS deletes the DB cluster only after you delete each of its DB instances.You must have permission to call
DeleteDBInstanceon every DB instance in the DB cluster. If RDS can't delete a DB instance in the DB cluster, the request fails and RDS doesn't delete the DB cluster or any of its DB instances.Constraints:
-
You can't specify this parameter for a DB cluster that is a member of an Aurora global database. Remove the DB cluster from the global database first.
-
You can't specify this parameter for an Aurora Limitless Database DB cluster.
-
Deletion protection must be turned off for the DB cluster.
-
No DB instance in the DB cluster can be in the
deletingstate or be switching over, be the blue DB instance of an active blue/green deployment, or have an active zero-ETL integration. -
No DB instance in the DB cluster can be the source of an Aurora read replica DB cluster, or have a read replica that is being created or a cross-Region read replica that is being restored.
-
The DB cluster can't be in the
stoppingstate.
If the DB cluster doesn't contain any DB instances, RDS deletes the DB cluster the same way as when you don't specify this parameter.
Default:
falseValid for Cluster Type: Aurora MySQL and Aurora PostgreSQL DB clusters only
-
Raises:
-
DBClusterAutomatedBackupQuotaExceededFault–The quota for retained automated backups was exceeded. This prevents you from retaining any additional automated backups. The retained automated backups quota is the same as your DB cluster quota.
-
DBClusterNotFoundFault–DBClusterIdentifierdoesn't refer to an existing DB cluster. -
DBClusterSnapshotAlreadyExistsFault–The user already has a DB cluster snapshot with the given identifier.
-
InvalidDBClusterSnapshotStateFault–The supplied value isn't a valid DB cluster snapshot state.
-
InvalidDBClusterStateFault–The requested operation can't be performed while the cluster is in this state.
-
InvalidGlobalClusterStateFault–The global cluster is in an invalid state and can't perform the requested operation.
-
KMSKeyNotAccessibleFault–An error occurred accessing an Amazon Web Services KMS key.
-
SnapshotQuotaExceededFault–The request would result in the user exceeding the allowed number of DB snapshots.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To delete a DB cluster The following example deletes the DB cluster named mycluster and takes a final snapshot named mycluster-final-snapshot. The status of the DB cluster is available while the snapshot is being taken.
>>> await client.delete_db_cluster(db_cluster_identifier='mycluster', skip_final_snapshot=False, final_db_snapshot_identifier='mycluster-final-snapshot')
To delete a DB cluster and all of its DB instances
The following example deletes the Aurora DB cluster named sample-cluster and all of the DB instances in it in a single call.
>>> await client.delete_db_cluster(db_cluster_identifier='sample-cluster', delete_db_instances=True, skip_final_snapshot=True)
Source code in docs_src/capo_rds/_services/async_rds.py
4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 | |