Switch an ApsaraDB RDS for PostgreSQL instance from pay-as-you-go to serverless when your workloads fluctuate significantly or when you want computing resources to scale automatically. Serverless instances improve resource utilization and reduce O&M overhead by eliminating manual capacity management.
For an overview of serverless instances and their use cases, see Overview of serverless ApsaraDB RDS for PostgreSQL instances.
Prerequisites
Before you begin, make sure your instance meets all of the following requirements. You can verify them on the instance details page in the ApsaraDB RDS console.
Instance requirements:
| Requirement | Accepted value |
|---|---|
| Status | Running |
| Major engine version | PostgreSQL 14 or later |
| Edition | Basic Edition or High-Availability Edition |
| Billing method | Pay-as-you-go |
| Storage type | PL1 ESSDs or premium performance disks |
| Minor engine version | 20231030 or later, with no babelfish suffix |
| Instance role | Primary instance with no read-only instances attached |
The following features must all be disabled: database proxy, SSL encryption, disk encryption, and connection pool (PgBouncer).
If your instance uses the subscription billing method, change it to pay-as-you-go first.
Account requirements:
The AliyunServiceRoleForRdsPgsqlOnEcs and AliyunServiceRoleForRDSProxyOnEcs service-linked roles must exist for your Alibaba Cloud account. If they have not been created, see Appendix: View and create a service-linked role.
Before you switch
Switching limit: You can switch between pay-as-you-go and serverless at most once every 24 hours.
Connection interruption: The conversion causes a brief connection interruption. Make sure your application is configured to reconnect automatically.
Zone resource availability: The conversion fails if serverless instances are unavailable or if resources are insufficient in the zone where your instance resides.
RCU capacity: Set the maximum number of RDS Capacity Units (RCUs) to a value greater than or equal to the current CPU core count of your instance. For example, if your instance has 4 CPU cores, set the maximum RCUs to 4 or more. This ensures the serverless instance can match the performance of your current provisioned instance at peak load.
Change the billing method
Go to the Instances page. In the top navigation bar, select a region. Find your instance and click its ID.
On the Basic Information page, in the Configuration Information section, click Change to Serverless.

On the buy page, configure RDS Capacity Units (RCUs) and Switching Time. In the Advanced Settings section, configure Scaling Policy and Automatic Stop and Restart.
For details about each configuration option, see Create a serverless ApsaraDB RDS for PostgreSQL instance.
Read and accept the Terms of Service, click Confirm Order, confirm the information in the dialog box that appears, and then click OK. During the conversion, the instance status changes to Upgrading/Downgrading. After the conversion is complete, the instance status changes to Running.
FAQ
Why does a new purchase order appear on the Expenses And Costs > Orders > My Orders page after the switch?
The conversion works by creating a new serverless instance internally and then switching your original instance to it. This process generates a new purchase order. After the switch completes, your instance ID stays the same and billing follows serverless pricing rules.
Why does the instance status remain unchanged after a successful payment?
This usually means the conversion failed because of insufficient resources in the zone where your instance resides. Migrate the instance to another zone and then retry the billing method change.
API reference
Use the ModifyDBInstanceSpec API operation to change the billing method programmatically.
| Parameter | Value |
|---|---|
PayType | Serverless |
DBInstanceClass | pg.n2.serverless.1c (Basic Edition) or pg.n2.serverless.2c (High-Availability Edition) |
Leave all other parameters (such as storage space) blank or keep their original values. These parameters cannot be modified during the conversion.
For the full API reference, see ModifyDBInstanceSpec.
Appendix: View and create a service-linked role
Before changing the billing method, verify that the AliyunServiceRoleForRdsPgsqlOnEcs and AliyunServiceRoleForRDSProxyOnEcs service-linked roles exist for your Alibaba Cloud account.
Log on to the Resource Access Management (RAM) console with your Alibaba Cloud account.
In the left navigation pane, choose Identities > Roles.
In the search box to the right of Create Role, search for AliyunServiceRoleForRdsPgsqlOnEcs and AliyunServiceRoleForRDSProxyOnEcs.
If both roles are found, they have already been created. No further action is needed.
If either role is missing, follow the steps below to create it.
Click Create Role.
In the upper-right corner of the Create Role page, click Create Service Linked Role.

On the Create Service Linked Role page, select AliyunServiceRoleForRdsPgsqlOnEcs for Select Service and click Create Service Linked Role.
The services available under Select Service depend on the options displayed in the console.

Repeat the preceding steps to create the AliyunServiceRoleForRDSProxyOnEcs service-linked role.