You can call the DescribeDBInstancesByExpireTime operation to query ApsaraDB RDS instances based on a specific expiration date and time.

Note This operation is available only for subscription instances.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeDBInstancesByExpireTime

The operation that you want to perform. Set the value to DescribeDBInstancesByExpireTime.

RegionId String No cn-hangzhou

The region ID of the instances. You can call the DescribeRegions operation to query the most recent region list.

proxyId String No N/A

A deprecated parameter.

ExpirePeriod Integer No 180

The number of remaining days for which the instances are available. Valid values: 0 to 180.

Expired Boolean No True

Specifies whether to query instances that have expired. Valid values:

  • True: queries instances that have expired.
  • False: queries instances that have not expired.
PageSize Integer No 30

The number of entries to return on each page. Valid values: 1 to 100.

Default value: 30.

PageNumber Integer No 1

The number of the page to return. Valid values: any non-zero positive integer.

Default value: 1.

Tags String No null

The tags that are added to the instances. Each tag is a key-value pair that consists of two parts: TagKey and TagValue. You can specify a maximum of five tags in the following format for each request: {"key1":"value1","key2":"value2"...}.

Response parameters

Parameter Type Example Description
RequestId String 1AD222E9-E606-4A42-BF6D-8A4442913CEF

The ID of the request.

PageNumber Integer 1

The page number of the returned page. Valid values: any non-zero positive integer.

Default value: 1.

PageRecordCount Integer 2

The number of instances returned on the current page.

TotalRecordCount Integer 200

The total number of entries.

Items Array of DBInstanceExpireTime

An array that consists of the information about the instances that are returned.

DBInstanceExpireTime
ExpireTime String 2019-03-27T16:00:00Z

The expiration date and time of the instance. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Note Pay-as-you-go instances never expire.
PayType String Prepaid

The billing method of the instance. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the instance.

DBInstanceStatus String Running

The status of the instance. For more information, see Instance state table.

DBInstanceDescription String Test database

The description of the instance.

LockMode String Unlock

The lock mode of the instance. Valid values:

  • Unlock: The instance is not locked.
  • ManualLock: The instance is manually locked.
  • LockByExpiration: The instance is automatically locked after it expires.
  • LockByRestoration: The instance is automatically locked before it is rolled back.
  • LockByDiskQuota: The instance is automatically locked after its storage capacity is exhausted.
  • LockReadInstanceByDiskQuota: The instance is a read-only instance and is automatically locked after its storage capacity is exhausted.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DescribeDBInstancesByExpireTime
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeDBInstancesByExpireTimeResponse>
    <TotalRecordCount>200</TotalRecordCount>
    <PageRecordCount>2</PageRecordCount>
    <RequestId>1AD222E9-E606-4A42-BF6D-8A4442913CEF</RequestId>
    <PageNumber>1</PageNumber>
    <Items>
        <DBInstanceExpireTime>
            <DBInstanceStatus>Running</DBInstanceStatus>
            <DBInstanceId>rm-uf6wjk5xxxxxxx</DBInstanceId>
            <PayType>Prepaid</PayType>
            <LockMode>Unlock</LockMode>
            <ExpireTime>2019-03-27T16:00:00Z</ExpireTime>
            <DBInstanceDescription>Test database</DBInstanceDescription>
        </DBInstanceExpireTime>
    </Items>
</DescribeDBInstancesByExpireTimeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalRecordCount" : "200",
  "PageRecordCount" : "2",
  "RequestId" : "1AD222E9-E606-4A42-BF6D-8A4442913CEF",
  "PageNumber" : "1",
  "Items" : {
    "DBInstanceExpireTime" : [ {
      "DBInstanceStatus" : "Running",
      "DBInstanceId" : "rm-uf6wjk5xxxxxxx",
      "PayType" : "Prepaid",
      "LockMode" : "Unlock",
      "ExpireTime" : "2019-03-27T16:00:00Z",
      "DBInstanceDescription": "Test database"
    } ]
  }
}

Error codes

For a list of error codes, visit the API Error Center.