Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ Instance Management/ Changing the Billing Mode from Pay-per-Use to Yearly/Monthly
Updated on 2026-04-10 GMT+08:00

Changing the Billing Mode from Pay-per-Use to Yearly/Monthly

Function

This API is used to change the billing mode of pay-per-use instances to yearly/monthly. Before calling this API:

Debugging

You can debug this API in API Explorer.

Authorization

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the permission listed below is required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    gaussdb:instance:changeDemandToPeriod

    ReadWrite

    instance

    -

    gaussdb:instance:changeDemandToPeriod

    -

URI

PUT /v3/{project_id}/instances/change-charge-mode

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Parameter

Mandatory

Type

Description

entity_ids

Yes

Array of strings

Definition

IDs of instances that need to be changed to yearly/monthly billing.

Constraints

N/A

charge_info

Yes

Object

Definition

Yearly/Monthly subscription information. For details, see Table 2.

Constraints

N/A

Table 2 Data structure description of the charge_info field

Parameter

Mandatory

Type

Description

period_type

Yes

String

Definition

Period type.

Constraints

N/A

Range

  • year: yearly subscription
  • month: monthly subscription

Default Value

N/A

period_num

Yes

Integer

Definition

Number of months or years of the subscription.

Constraints

N/A

Range

  • If period_type is set to month, the value ranges from 1 to 9.
  • If period_type is set to year, the value ranges from 1 to 3.

When a floating-point value is used, the value is automatically truncated to an integer.

Default Value

N/A

is_auto_renew

No

Boolean

Definition

Whether to enable auto-renewal.

Constraints

N/A

Range

  • true: Automatic renewal is enabled.
  • false: Automatic renewal is disabled.

Default Value

false

is_auto_pay

No

Boolean

Definition

Whether to enable automatic payment.

Constraints

N/A

Range

  • true: The order will be automatically paid.
  • false: The order will be manually paid.

Default Value

false

Response Parameters

Table 3 Parameter description

Parameter

Type

Description

order_ids

Array of strings

Definition

Order IDs.

Example Request

Changing the billing mode of an instance from pay-per-use to yearly/monthly

PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/599628f2665841b2a66fa2780fadc025/instances/change-charge-mode
{
    "entity_ids": ["xxxxxxin14"],
    "charge_info":  {
        "period_type": "month",
        "period_num": 1,
        "is_auto_renew": false,
        "is_auto_pay": false
    }
}

Example Response

A yearly/monthly subscription order generated for the instance.

{
    "order_ids": ["CSXXXXXXX"]
}

Status Codes

Error Codes

For details, see Error Codes.