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 API

The ID of the proxy mode that is used by the instances.

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: specifies to query instances that have expired.
  • False: specifies to query 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 {"key1":"value1"}

The tags that are added to the instances. Each tag is a key-value pair that consists of two parts: TagKey and TagValue. A maximum of five tags are allowed in a single request. Format: {"key1":"value1","key2":"value2"...}.

Response parameters

Parameter Type Example Description
Items Array of DBInstanceExpireTime

An array that consists of instances and their information.

DBInstanceExpireTime
DBInstanceDescription String Test database

The description of the instance.

DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the instance.

DBInstanceStatus String Running

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

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.
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 upon expiration.
  • LockByRestoration: The instance is automatically locked before a rollback.
  • 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.
PayType String Prepaid

The billing method of the instance. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
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.

RequestId String 1AD222E9-E606-4A42-BF6D-8A4442913CEF

The ID of the request.

TotalRecordCount Integer 200

The total number of entries.

Examples

Sample requests

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

Sample success responses

XML format

<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

{
    "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.