AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Deletes a previously provisioned DB instance. When you delete a DB instance, all automated backups for that instance are deleted and can't be recovered. However, manual DB snapshots of the DB instance aren't deleted.
If you request a final DB snapshot, the status of the Amazon RDS DB instance is deleting
until the DB snapshot is created. This operation can't be canceled or reverted after
it begins. To monitor the status of this operation, use DescribeDBInstance
.
When a DB instance is in a failure state and has a status of failed
, incompatible-restore
,
or incompatible-network
, you can only delete it when you skip creation of the
final snapshot with the SkipFinalSnapshot
parameter.
If the specified DB instance is part of an Amazon Aurora DB cluster, you can't delete the DB instance if both of the following conditions are true:
The DB cluster is a read replica of another Amazon Aurora DB cluster.
The DB instance is the only instance in the DB cluster.
To delete a DB instance in this case, first use the PromoteReadReplicaDBCluster
operation to promote the DB cluster so that it's no longer a read replica. After the
promotion completes, use the DeleteDBInstance
operation to delete the final
instance in the DB cluster.
For RDS Custom DB instances, deleting the DB instance permanently deletes the EC2 instance and the associated EBS volumes. Make sure that you don't terminate or delete these resources before you delete the DB instance. Otherwise, deleting the DB instance and creation of the final snapshot might fail.
This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginDeleteDBInstance and EndDeleteDBInstance.
Namespace: Amazon.RDS
Assembly: AWSSDK.RDS.dll
Version: 3.x.y.z
public abstract Task<DeleteDBInstanceResponse> DeleteDBInstanceAsync( DeleteDBInstanceRequest request, CancellationToken cancellationToken )
Container for the necessary parameters to execute the DeleteDBInstance service method.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Exception | Condition |
---|---|
DBInstanceAutomatedBackupQuotaExceededException | 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 instance quota. |
DBInstanceNotFoundException | DBInstanceIdentifier doesn't refer to an existing DB instance. |
DBSnapshotAlreadyExistsException | DBSnapshotIdentifier is already used by an existing snapshot. |
InvalidDBClusterStateException | The requested operation can't be performed while the cluster is in this state. |
InvalidDBInstanceStateException | The DB instance isn't in a valid state. |
SnapshotQuotaExceededException | The request would result in the user exceeding the allowed number of DB snapshots. |
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5