You need to enable JavaScript to run this app.
RDS for PostgreSQL

RDS for PostgreSQL

Copy page
Download PDF
Managing instances
CreateDBInstance
Copy page
Download PDF
CreateDBInstance
Call CreateDBInstance API to create an instance.​
Request type​
Asynchronous request.​
Debug​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
​
Parameter​
Type​
Required?​
Example​
Description​
DBEngineVersion​
String​
Yes​
PostgreSQL_12​
Compatible version. Values:​
  • PostgreSQL_11: PostgreSQL 11.​
  • PostgreSQL_12: PostgreSQL 12.​
  • PostgreSQL_13: PostgreSQL 13.​
  • PostgreSQL_14: PostgreSQL 14.​
  • PostgreSQL_15: PostgreSQL 15.​
  • PostgreSQL_16: PostgreSQL 16.​
  • PostgreSQL_17: PostgreSQL 17.​
tip​
If you need to enable TDE encryption, only PostgreSQL 17 is supported.​
NodeInfo​
Array of NodeInfoObject​
Yes​
Refer to the request example.​
Instance specification configuration. There is exactly one primary node and one secondary node, with 0 to 10 optional read-only nodes.​
StorageType​
String​
Yes​
LocalSSD​
Instance storage type. Fixed value LocalSSD (local SSD disk).​
StorageSpace​
Integer​
No​
100​
Instance storage space​
tip​
Different specifications have different storage space value ranges. For detailed information on storage space value ranges, refer to Product specifications. Unit is GB, with increments of 10 GB.​
VpcId​
String​
Yes​
vpc-2gdgzrrl5icjk50ztyz6b****​
Use this parameter to specify the virtual private cloud used by the instance.​
tip​
  • If you use ECS to connect to the PostgreSQL instance, the virtual private cloud must be the same as that of the ECS instance. Otherwise, the ECS instance cannot connect to the PostgreSQL instance through the private network.​
  • You can call the DescribeVpcs API to query available virtual private clouds.​
  • You can call the CreateVpc API to create a new virtual private cloud.​
SubnetId​
String​
Yes​
subnet-30uhx4w39n75s7r2qr0lq****​
Subnet ID.​
tip​
  • Only subnets in the availability zone where the instance is located can be selected.​
  • You can call the DescribeSubnets API to query all subnet information within the specified virtual private cloud and availability zone.​
  • You can call the CreateSubnet API to create a new subnet.​
AllowListIds​
Array of String​
No​
[​
"acl-fdd6293f300143f2a4932bb483c8****",​
"acl-ded4c0b707e44efd8f0dbc4e88f5****"​
]​
Allowlist ID. To associate multiple allowlists, separate the allowlist IDs with a comma (,). An instance can associate up to 100 allowlists.​
InstanceName​
String​
No​
Name123​
Instance name rules:​
  • It cannot start with a digit or hyphen.​
  • It can only contain Chinese characters, letters, digits, underscores (_) and hyphens (-).​
  • Length must be between 1 and 128.​
MaintenanceWindow​
No​
Refer to the request example.​
The maintenance window for the instance.​
ProjectName​
String​
No​
Test​
Affiliated project. The default value is the default project.​
Tags​
Array of TagObject​
No​
[{​
"Key": "test",​
"Value": "123"​
}]​
Array of tag objects.​
tip​
Supports passing multiple sets of tag key-value objects at once, separated by commas (,). Each time, you can pass up to 20 sets of tag key-value pairs simultaneously, and each instance can bind up to 50 tags.​
ChargeInfo​
Object of ChargeInfoObject​
Yes​
{​
"ChargeType": "PostPaid"​
}​
Payment method.​
TDEEnable​
Boolean​
No​
true​
Enable TDE encryption? Values:​
  • true: enable TDE encryption.​
  • false: disable TDE encryption (default).​
tip​
  • TDE encryption is currently in invitation-only testing. To use it, submit a ticket.​
  • TDE encryption cannot be disabled once enabled.​
KMSTrn​
String​
No​
trn:kms:cn-beijing:210xxxx:keyrings/testxxxx/keys/testxxxx​
KMS key ring TRN. Format: trn:kms:<region>:<account_id>:keyrings/<ring_name>/keys/<key_name>.​
tip​
When EnableTDE is true, this parameter is required.​
​
NodeInfoObject​
​
Parameter​
Type​
Required?​
Example​
Description​
NodeId​
String​
No​
postgres-ca7b7019****​
Node ID. You can call the DescribeDBInstanceDetail API to query.​
tip​
Required when modifying node specification and deleting nodes (ModifyDBInstancesSpec).​
ZoneId​
String​
Yes​
cn-beijing-a​
The availability zone where the node is located. You can call the DescribeAvailabilityZones API to query it.​
tip​
  • Required when creating an instance (CreateDBInstance), restoring to a new instance (RestoreToNewInstance), and adding or modifying nodes (ModifyDBInstancesSpec).​
  • Primary, secondary, and read-only nodes can be deployed in different availability zones within the same region.​
NodeType​
String​
Yes​
Primary​
Node type, with values:​
  • Primary: Primary node.​
  • Secondary: indicates the secondary node.​
  • ReadOnly: Read-only node.​
NodeSpec​
String​
Yes​
rds.postgres.1c2g​
Node specification. Query specifications available for sale via DescribeDBInstanceSpecs API.​
NodeOperateType​
String​
No​
Create​
Operation type. Range:​
  • Create: add.​
  • Delete: delete.​
  • Modify: modify.​
tip​
  • In the CreateDBInstance and RestoreToNewInstance APIs, this field can only be set to Create.​
  • When modifying instance configuration, the specified NodeOperateType must be passed in for the involved nodes.​
​
MaintenanceWindowObject​
​
Parameter​
Type​
Required?​
Example​
Description​
DayKind​
String​
Yes​
Week​
The granularity of the maintenance cycle, with values of Week.​
DayOfWeekMaintenanceTime​
Array of DayOfWeekObject​
No​
Refer to the sample.​
Details of the instance maintenance window.​
​
DayOfWeekObject​
​
Parameter​
Type​
Required?​
Example​
Description​
DayOfWeek​
String​
Yes​
Monday,Tuesday​
Specify the maintainable day for the instance each week. Multiple selections allowed.​
  • Monday: Monday.​
  • Tuesday: Tuesday.​
  • Wednesday: Wednesday.​
  • Thursday: Thursday.​
  • Friday: Friday.​
  • Saturday: Saturday.​
  • Sunday: Sunday.​
tip​
If this value is not specified or empty, it defaults to all seven days of the week.​
MaintenanceWindowStartTime​
String​
Yes​
22:00Z​
The instance's start time within the maintenance window on the maintainable day. Format: HH:mmZ (UTC time).​
tip​
Currently, only start times between 16:00Z and 20:00Z are supported for the maintenance window.​
Period​
Integer​
Yes​
6​
Duration of the instance's maintenance window on a maintainable day.​
tip​
The duration is at least 2 hours and at most 6 hours.​
​
TagObject​
​
Parameter​
Type​
Required?​
Example​
Description​
Key​
String​
Yes​
abc​
Tag key. Naming rules are as follows:​
  • It cannot start with any case-insensitive variation of the prefix volc:. volc: is a system-reserved tag key and is forbidden to use.​
  • It can only contain language characters, numbers, spaces, and English symbols (_, ., :, /, =, +, -, and @).​
  • The length must be between 1 and 128 characters.​
tip​
  • The number of tags created at one time cannot exceed 20.​
  • Tag keys cannot be duplicated under a single instance.​
Value​
String​
No​
3​
Tag value. The naming rules are as follows:​
  • It can only contain language characters, numbers, spaces, and English symbols (_, ., :, /, =, +, -, and @).​
  • Nullable. Length must be between 0 and 256 characters.​
​
ChargeInfoObject​
​
Parameter​
Type​
Required?​
Example​
Description​
ChargeType​
String​
Yes​
PostPaid​
Payment type. Values:​
  • PostPaid: pay-as-you-go.​
  • PrePaid: subscription (default).​
AutoRenew​
Boolean​
No​
true​
Is automatic renewal enabled for the prepaid scenario?​
  • yes: automatic renewal.​
  • false: no automatic renewal (default).​
PeriodUnit​
String​
No​
Month​
Purchase period for prepaid scenarios.​
  • Month: monthly (default).​
  • Year: subscription.​
Period​
Integer​
No​
1​
Subscription duration in a prepaid scenario. default value: 1.​
Number​
Integer​
No​
1​
Instance purchase quantity. Acceptable integer values range from 1 to 20, with a default of 1.​
tip​
When ChargeInfoObject is referenced by the RestoreToNewInstance API, Number can only be set to 1.​
​
Response parameters​
​
Parameter​
Type​
Example​
Description​
InstanceId​
String​
postgres-21a3333b****​
Instance ID.​
OrderId​
String​
Order634971667632428****​
Order ID.​
​
Example​
Sample request​
​
POST /?Action=CreateDBInstance&Version=2022-01-01 HTTP/1.1​
Content-Type: application/json​
Host: rds-postgresql.cn-beijing.volcengineapi.com​
X-Date: 20231002T101010Z​
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_postgresql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****​
{​
"DBEngineVersion": "PostgreSQL_12",​
"StorageType": "LocalSSD",​
"StorageSpace": 20,​
"VpcId": "vpc-2gdgzrrl5icjk50ztyz6b****",​
"InstanceName": "Name123",​
"ChargeInfo": {​
"ChargeType": "PostPaid",​
"Number": 1​
},​
"ProjectName": "default",​
"SubnetId": "subnet-30uhx4w39n75s7r2qr0lq****",​
"NodeInfo": [​
{​
"ZoneId": "cn-beijing-a",​
"NodeSpec": "rds.postgres.1c2g",​
"NodeType": "Primary",​
"NodeOperateType": "Create"​
},​
{​
"ZoneId": "cn-beijing-a",​
"NodeSpec": "rds.postgres.1c2g",​
"NodeType": "Secondary",​
"NodeOperateType": "Create"​
}​
],​
"Tags": [​
{​
"Key": "test",​
"Value": "123"​
}​
],​
"MaintenanceWindow": {​
"DayKind": "Week",​
"DayOfWeekMaintenanceTime": [​
{​
"Period": 6,​
"DayOfWeek": "Monday,Tuesday",​
"MaintenanceWindowStartTime": "16:00Z"​
}​
]​
}​
}​
​
Sample response​
​
{​
"ResponseMetadata": {​
"RequestId": "20230801104043BEB227FB89B5F73A1436",​
"Action": "CreateDBInstance",​
"Version": "2022-01-01",​
"Service": "rds_postgresql",​
"Region": "cn-beijing"​
},​
"Result": {​
"InstanceId": "postgres-21a3333b****",​
"OrderId": "Order634971667632428****"​
}​
}​
​
Last updated: 2026.06.05 10:46:06