The automatic start and stop feature reduces costs for serverless ApsaraDB RDS for PostgreSQL instances by suspending the instance when no connections are active and resuming it automatically when a new connection arrives.
How it works
If no connections are established to the instance within 10 minutes, the instance is automatically suspended. While suspended, the instance consumes no RDS Capacity Units (RCUs) and incurs no computing fees. When a connection is established to a suspended instance, the instance resumes automatically.
Fees depend on the instance state:
| Instance state | Computing fees | Storage fees |
|---|---|---|
| Suspending | Charged | Charged |
| Suspended | Free of charge | Charged |
| Starting | Free of charge | Charged |
| Running | Charged | Charged |
The automatic start and stop feature affects only computing fees. Storage fees apply in all states, including when the instance is suspended.
Prerequisites
Before you begin, make sure that:
The billing method of your RDS instance is Serverless. This feature applies only to serverless ApsaraDB RDS for PostgreSQL instances.
Potential impacts
When a suspended instance resumes, connections are established after the instance finishes starting. This may introduce an access delay of up to several minutes. Set your application's connection timeout to a value long enough to accommodate the resume time.
A suspended instance with automatic start and stop enabled cannot be manually started. To force-start a suspended instance, disable the automatic start and stop feature. The instance resumes immediately after you disable the feature.
Enable automatic start and stop
For a new instance: Enable the feature during instance creation. For instructions, see Create a serverless ApsaraDB RDS for PostgreSQL instance.
For an existing instance:
Go to the Instances page. In the top navigation bar, select the region where the instance resides, then click the instance ID.
In the Configuration Information section, click Modify Scaling Settings.
Click Advanced Settings, select Enable from the Automatic Stop and Restart drop-down list, and click OK.
Disable automatic start and stop
Go to the Instances page. In the top navigation bar, select the region where the instance resides, then click the instance ID.
In the Configuration Information section, click Modify Scaling Settings.
Click Advanced Settings, select Disable from the Automatic Stop and Restart drop-down list, and click OK.
API reference
To configure the automatic start and stop feature via API, call the ModifyDBInstanceSpec operation with the following parameters:
| Parameter | Description | Example |
|---|---|---|
DBInstanceId | The ID of the serverless RDS instance. | pgm-**** |
PayType | The billing method. Set to Serverless. | Serverless |
Direction | The configuration change type. Set to Serverless. | Serverless |
ServerlessConfiguration.AutoPause | Whether to enable the feature. Set to true to enable or false to disable. The default value is false. | true |
What's next
To adjust the range of RCUs available to the instance during peak and off-peak hours, see Change the scaling range of RCUs.
To control how the instance handles scaling operations and balance performance against availability, see Change the scaling policy of RCUs. The default scaling policy is Do Not Execute Forcefully, which avoids service interruptions. Change the policy to Execute Forcefully only when higher performance is required over continuous availability.