Menu
Amazon Relational Database Service
API Reference (API Version 2014-10-31)

DeleteDBInstance

The DeleteDBInstance action deletes a previously provisioned DB instance. When you delete a DB instance, all automated backups for that instance are deleted and cannot be recovered. Manual DB snapshots of the DB instance to be deleted by DeleteDBInstance are not deleted.

If you request a final DB snapshot the status of the Amazon RDS DB instance is deleting until the DB snapshot is created. The API action DescribeDBInstance is used to monitor the status of this operation. The action cannot be canceled or reverted once submitted.

Note that 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 the SkipFinalSnapshot parameter is set to true.

If the specified DB instance is part of an Amazon Aurora DB cluster, you cannot delete the DB instance if the following 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 call the PromoteReadReplicaDBCluster API action to promote the DB cluster so it's no longer a Read Replica. After the promotion completes, then call the DeleteDBInstance API action to delete the final instance in the DB cluster.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

DBInstanceIdentifier

The DB instance identifier for the DB instance to be deleted. This parameter isn't case-sensitive.

Constraints:

  • Must contain from 1 to 63 alphanumeric characters or hyphens

  • First character must be a letter

  • Cannot end with a hyphen or contain two consecutive hyphens

Type: String

Required: Yes

FinalDBSnapshotIdentifier

The DBSnapshotIdentifier of the new DBSnapshot created when SkipFinalSnapshot is set to false.

Note

Specifying this parameter and also setting the SkipFinalShapshot parameter to true results in an error.

Constraints:

  • Must be 1 to 255 alphanumeric characters

  • First character must be a letter

  • Cannot end with a hyphen or contain two consecutive hyphens

  • Cannot be specified when deleting a Read Replica.

Type: String

Required: No

SkipFinalSnapshot

Determines whether a final DB snapshot is created before the DB instance is deleted. If true is specified, no DBSnapshot is created. If false is specified, a DB snapshot is created before the DB instance is deleted.

Note that when a DB instance is in a failure state and has a status of 'failed', 'incompatible-restore', or 'incompatible-network', it can only be deleted when the SkipFinalSnapshot parameter is set to "true".

Specify true when deleting a Read Replica.

Note

The FinalDBSnapshotIdentifier parameter must be specified if SkipFinalSnapshot is false.

Default: false

Type: Boolean

Required: No

Response Elements

The following element is returned by the service.

DBInstance

Contains the result of a successful invocation of the following actions:

This data type is used as a response element in the DescribeDBInstances action.

Type: DBInstance object

Errors

For information about the errors that are common to all actions, see Common Errors.

DBInstanceNotFound

DBInstanceIdentifier does not refer to an existing DB instance.

HTTP Status Code: 404

DBSnapshotAlreadyExists

DBSnapshotIdentifier is already used by an existing snapshot.

HTTP Status Code: 400

InvalidDBClusterStateFault

The DB cluster is not in a valid state.

HTTP Status Code: 400

InvalidDBInstanceState

The specified DB instance is not in the available state.

HTTP Status Code: 400

SnapshotQuotaExceeded

Request would result in user exceeding the allowed number of DB snapshots.

HTTP Status Code: 400

Example

Sample Request

Copy
https://rds.us-east-1.amazonaws.com/ ?Action=DeleteDBInstance &DBInstanceIdentifier=mydatabase &SignatureMethod=HmacSHA256 &SignatureVersion=4 &SkipFinalSnapshot=true &Version=2014-09-01 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=AKIADQKE4SARGYLE/20131109/us-east-1/rds/aws4_request &X-Amz-Date=20131109T001924Z &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date &X-Amz-Signature=70e774e243c0fbb7ffe84029637005bf543e9e321cdf432c0b272be5687d32d8

Sample Response

Copy
<DeleteDBInstanceResponse xmlns="http://rds.amazonaws.com/doc/2014-09-01/"> <DeleteDBInstanceResult> <DBInstance> <BackupRetentionPeriod>7</BackupRetentionPeriod> <DBInstanceStatus>deleting</DBInstanceStatus> <MultiAZ>false</MultiAZ> <VpcSecurityGroups/> <DBInstanceIdentifier>mydatabase</DBInstanceIdentifier> <PreferredBackupWindow>08:14-08:44</PreferredBackupWindow> <PreferredMaintenanceWindow>fri:04:50-fri:05:20</PreferredMaintenanceWindow> <AvailabilityZone>us-east-1a</AvailabilityZone> <ReadReplicaDBInstanceIdentifiers/> <LatestRestorableTime>2013-11-09T00:15:00Z</LatestRestorableTime> <Engine>mysql</Engine> <PendingModifiedValues/> <LicenseModel>general-public-license</LicenseModel> <EngineVersion>5.6.13</EngineVersion> <Endpoint> <Port>3306</Port> <Address>mydatabase.cf037hpkuvjt.us-east-1.rds.amazonaws.com</Address> </Endpoint> <DBParameterGroups> <DBParameterGroup> <ParameterApplyStatus>in-sync</ParameterApplyStatus> <DBParameterGroupName>default.mysql5.6</DBParameterGroupName> </DBParameterGroup> </DBParameterGroups> <OptionGroupMemberships> <OptionGroupMembership> <OptionGroupName>default:mysql-5-6</OptionGroupName> <Status>in-sync</Status> </OptionGroupMembership> </OptionGroupMemberships> <PubliclyAccessible>true</PubliclyAccessible> <DBSecurityGroups> <DBSecurityGroup> <Status>active</Status> <DBSecurityGroupName>default</DBSecurityGroupName> </DBSecurityGroup> </DBSecurityGroups> <DBName>mysqldb</DBName> <AutoMinorVersionUpgrade>true</AutoMinorVersionUpgrade> <InstanceCreateTime>2011-04-28T23:33:54.909Z</InstanceCreateTime> <AllocatedStorage>100</AllocatedStorage> <MasterUsername>myawsuser</MasterUsername> <DBInstanceClass>db.m1.medium</DBInstanceClass> </DBInstance> </DeleteDBInstanceResult> <ResponseMetadata> <RequestId>7369556f-b70d-11c3-faca-6ba18376ea1b</RequestId> </ResponseMetadata> </DeleteDBInstanceResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: