Domain name for API request: postgres.tencentcloudapi.com.
This API is used to create and initialize one or more TencentDB for PostgreSQL instances.
A maximum of 100 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: CreateInstances. |
Version | Yes | String | Common Params. The value used for this API: 2017-03-12. |
Region | No | String | Common Params. This parameter is not required for this API. |
Zone | Yes | String | Primary AZ of the instance in the format of ap-guangzhou-3 . To support multiple AZs, add information of the primary and standby AZs in the DBNodeSet.N field.The information of AZ can be obtained from the Zone field in the return value of the DescribeZones API. |
SpecCode | Yes | String | Purchasable code, which can be obtained from the SpecCode field in the return value of the DescribeClasses API. |
Storage | Yes | Integer | Instance storage capacity in GB |
InstanceCount | Yes | Integer | The number of instances to be purchased at a time. Value range: 1-10. To purchase more than 10 instances each time, you can make multiple calls. |
Period | Yes | Integer | Validity period in months.1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 24 , 36 .1 . |
Charset | Yes | String | Instance character set. Valid values: UTF8 LATIN1 |
AdminName | Yes | String | Username of the instance root account, which has the following rules:postgres .pg_ . |
AdminPassword | Yes | String | Password of the instance root account, which must contain 8-32 characters (above 12 characters preferably). It cannot begin with "/", and must contain the following 4 types of characters. |
DBMajorVersion | No | String | The major PostgreSQL version number, which can be queried by the DescribeDBVersions API. Valid values: 10 , 11 , 12 , 13 , 14 , 15 .When only this parameter is specified, an instance running the latest kernel version of the latest minor version will be created based on this major version. You must pass in at least one of the following parameters: DBMajorVersion , DBVersion , DBKernelVersion. If you don't need a minor version, just pass in DBMajorVersion`. |
DBVersion | No | String | Number of the major PostgreSQL community version and minor version, which can be queried by the DescribeDBVersions API. If it is specified, an instance running the latest kernel version will be created based on the community minor version. You must pass in at least one of the following parameters: DBMajorVersion , DBVersion , DBKernelVersion`. |
DBKernelVersion | No | String | PostgreSQL kernel version number, which can be queried by the DescribeDBVersions API. PostgreSQL kernel version number. If it is specified, an instance running the specified kernel version will be created. Passing in this parameter in other scenarios is not supported.This parameter is only used to specify a kernel version, which serves no other purposes. |
InstanceChargeType | No | String | Instance billing mode. Valid values:PREPAID : Monthly subscriptionPOSTPAID_BY_HOUR : Pay-as-you-goDefault value: PREPAID . |
VpcId | No | String | VPC ID in the format of vpc-xxxxxxx . To obtain valid VPC IDs, you can log in to the console or call DescribeVpcEx and look for the unVpcId fields in the response. |
SubnetId | No | String | VPC subnet ID in the format of subnet-xxxxxxxx , u200cwhich can be obtained in the console or from the unSubnetId field in the return value of the DescribeSubnets API. |
DBNodeSet.N | No | Array of DBNode | Deployment information of the instance node, which will display the information of each AZ when the instance node is deployed across multiple AZs. The information of AZ can be obtained from the Zone field in the return value of the DescribeZones API. |
AutoRenewFlag | No | Integer | Auto-renewal flag. Valid values:0 : Manual renewal.1 : Automatic renewal.Default value: 0 . |
AutoVoucher | No | Integer | Whether to use vouchers automatically. Valid values:0 : No.1 : Yes.Default value: 0 . |
VoucherIds.N | No | Array of String | Voucher ID list. Currently, you can specify only one voucher. |
ProjectId | No | Integer | Project ID |
ActivityId | No | Integer | Campaign ID |
Name | No | String | Instance name, which can contain up to 60 letters, digits, hyphens, and symbols (_-). If this parameter is not specified, "Unnamed" will be displayed by default. |
TagList.N | No | Array of Tag | The information of tags to be bound with the instance, which is left empty by default. This parameter can be obtained from the Tags field in the return value of the DescribeTags API. |
SecurityGroupIds.N | No | Array of String | Security group of the instance, which can be obtained from the sgld field in the return value of the DescribeSecurityGroups API. If this parameter is not specified, the default security group will be bound. |
NeedSupportTDE | No | Integer | Whether to support TDE. Valid values:0 : No.1 : Yes.Default value: 0 .For more information, see [TDE]u200d(https://www.tencentcloud.com/document/product/409/47765). |
KMSKeyId | No | String | KeyId of custom key, which is required if you select custom key encryption. It is also the unique CMK identifier. For more information on creating KeyId , see Enabling TDE. |
KMSRegion | No | String | The region where the KMS service is enabled. When KMSRegion is left empty, the current region will be selected by default. If the current region does not support KMS, you must select another region that does.For more information on KMSRegion , see Enabling TDE. |
DBEngine | No | String | Database engines. Valid values:postgresql : TencentDB for PostgreSQLmssql_compatible : MSSQL compatible-TencentDB for PostgreSQLDefault value: postgresql . |
DBEngineConfig | No | String | Configuration information of database engine in the following format: {"$key1":"$value1", "$key2":"$value2"} Valid values: mssql_compatible engine: migrationMode : Database mode. Valid values: single-db (single-database mode), multi-db (multi-database mode). Default value: single-db .defaultLocale : Default locale, which can’t be modified after the initialization. Default value: en_US . Valid values:"af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN". serverCollationName : Default collation name, which can’t be modified after the initialization. Default value: "bbf_unicode_general_ci_as". Valid values: "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。 |
SyncMode | No | String | Primary-standby sync mode. Valid values: Semi-sync Async Default value for the primary instance: Semi-sync .Default value for the standby instance: Async . |
NeedSupportIpv6 | No | Integer | Whether IPv6 is supported.0 : No.1 : Yes.Default value: 0 . |
Parameter Name | Type | Description |
---|---|---|
DealNames | Array of String | Order number list. Each instance corresponds to an order number. |
BillId | String | Bill ID of frozen fees |
DBInstanceIdSet | Array of String | ID set of instances which have been created successfully. The parameter value will be returned only when the pay-as-you-go billing mode is used. |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
This example shows you how to create an instance running the latest kernel of PostgreSQL 12.4.
POST / HTTP/1.1
Host: postgres.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateInstances
<Common request parameters>
{
"InstanceCount": "1",
"AutoRenewFlag": "1",
"AdminName": "test2313",
"Zone": "ap-guangzhou-2",
"AdminPassword": " xxxxxxx",
"DBVersion": "12.4",
"DBEngine": "postgresql",
"Storage": "10",
"Period": "1",
"SpecCode": "cdb.pg.z1.2g",
"InstanceChargeType": "prepaid",
"AutoVoucher": "0",
"Charset": "UTF8"
}
{
"Response": {
"RequestId": "6ace8140-6b9e-4e81-a8ad-ef3f92b2aa90",
"DealNames": [
"20180119110001"
],
"DBInstanceIdSet": [
"postgres-xxxxx"
],
"BillId": "123"
}
}
This example shows you how to create a multi-AZ deployed instance running the latest kernel of PostgreSQL 12.
POST / HTTP/1.1
Host: postgres.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateInstances
<Common request parameters>
{
"InstanceCount": "1",
"AutoRenewFlag": "1",
"DBMajorVersion": "12",
"Zone": "ap-guangzhou-2",
"AdminPassword": " xxxxxxx",
"Charset": "UTF8",
"Storage": "10",
"Period": "1",
"SpecCode": "cdb.pg.z1.2g",
"InstanceChargeType": "prepaid",
"AutoVoucher": "0",
"DBNodeSet": [
{
"Role": "Standby",
"Zone": "ap-guangzhou-3"
},
{
"Role": "Primary",
"Zone": "ap-guangzhou-2"
}
],
"AdminName": "test2313"
}
{
"Response": {
"RequestId": "6ace8140-6b9e-4e81-a8ad-ef3f92b2aa90",
"DealNames": [
"20180119110001"
],
"DBInstanceIdSet": [
"postgres-xxxxx"
],
"BillId": "123"
}
}
This example shows you how to create a PostgreSQL instance running kernel v12.4_r1.0.
POST / HTTP/1.1
Host: postgres.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateInstances
<Common request parameters>
{
"InstanceCount": "1",
"AutoRenewFlag": "1",
"AdminName": "test2313",
"Zone": "ap-guangzhou-2",
"AdminPassword": " xxxxxxx",
"Charset": "UTF8",
"Storage": "10",
"Period": "1",
"SpecCode": "cdb.pg.z1.2g",
"DBKernelVersion": "v12.4_r1.0",
"DBEngine": "postgresql",
"InstanceChargeType": "prepaid",
"AutoVoucher": "0"
}
{
"Response": {
"RequestId": "6ace8140-6b9e-4e81-a8ad-ef3f92b2aa90",
"DealNames": [
"20180119110001"
],
"DBInstanceIdSet": [
"postgres-xxxxx"
],
"BillId": "123"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
AuthFailure.UnauthorizedOperation | Authentication failed. |
FailedOperation.AllocateQuotasError | Failed to request a quota for resource tags. |
FailedOperation.CamAuthFailed | CAM authentication failed. |
FailedOperation.CamSigAndAuthError | Authentication failed. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.CdbCgwConnectError | Failed to get project information. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.CreateBasicNetworkDeniedError | Classic network creation is unsupported. |
FailedOperation.CreateOrderFailed | Failed to create the renewal order. |
FailedOperation.DatabaseAccessError | Failed to access database management service. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.DatabaseAffectedError | Data operation failed. Please contact customer service. |
FailedOperation.FailedOperationError | Operation failed. Please try again later. |
FailedOperation.FlowCreateError | Failed to create a task. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.GetSubnetError | Failed to query VPC subnets. |
FailedOperation.GetVpcInfoError | Failed to query VPC information. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.InvalidTradeOperate | Billing error. Corresponding purchase/renewal/configuration change operations are not allowed for the current instance. |
FailedOperation.PayOrderFailed | Failed to make order payment. |
FailedOperation.QueryPriceFailed | Failed to query the price. |
FailedOperation.QuerySpecError | Failed to query specifications. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.QueryVpcFailed | Failed to query VPC. |
FailedOperation.QueryVpcFalied | Failed to get VPC details. |
FailedOperation.ServiceAccessError | Failed to access internal service. Please try again later. If the problem persists, please contact customer service. |
FailedOperation.StorageMemoryCheckError | The memory and storage capacity to which an instance is upgraded should be higher than its original memory and storage capacity. |
FailedOperation.TradeCreateError | Failed to request the billing platform to create an order. |
FailedOperation.TradePayOrdersError | Failed to request to pay for the order. |
InternalError.CgwError | CGW error. |
InternalError.CnsError | Basic network error. |
InternalError.DBError | Backend database execution error. |
InternalError.DfwError | DFW error. |
InternalError.FlowError | Failed to create the flow. |
InternalError.InternalHttpServerError | An exception occurred while executing the request. |
InternalError.SystemError | System error. When this error occurs, please contact customer service for assistance. |
InternalError.UnknownError | Unknown error. When this error occurs, please contact customer service for assistance. |
InternalError.VpcError | VPC error. |
InvalidParameter | Parameter error. |
InvalidParameter.ParameterCheckError | Failed to check the parameter. |
InvalidParameter.TradeAccessDeniedError | Incorrect PID |
InvalidParameter.VpcNotFoundError | Failed to query VPC information. |
InvalidParameterValue.AccountExist | The current account already exists. |
InvalidParameterValue.BadSpec | The instance specification to upgrade to is not purchasable. |
InvalidParameterValue.CharsetNotFoundError | Incorrect database character set |
InvalidParameterValue.DataConvertError | Failed to convert data format. Please contact customer service. |
InvalidParameterValue.IllegalInstanceChargeType | Incorrect billing mode. |
InvalidParameterValue.IllegalProjectId | Invalid ProjectId . |
InvalidParameterValue.IllegalRegion | Invalid Region parameter. |
InvalidParameterValue.IllegalZone | Invalid Zone parameter. |
InvalidParameterValue.InterfaceNameNotFound | Incorrect ACTION . |
InvalidParameterValue.InvalidAccountError | Invalid account. The account name is case-insensitive, must contain 1-16 characters comprised of letters, digits, underscores, and should neither be "postgres" nor start with a digit or "pg_". |
InvalidParameterValue.InvalidAccountFormat | Incorrect account format. |
InvalidParameterValue.InvalidAccountName | The current account name cannot be a reserved character. |
InvalidParameterValue.InvalidCharset | Incorrect database character set. Currently, only UTF8 and LATIN1 are supported. |
InvalidParameterValue.InvalidInstanceNum | The number of purchased instances exceeds the limit. |
InvalidParameterValue.InvalidOrderNum | Billing error. Invalid order type ID. |
InvalidParameterValue.InvalidParameterValueError | Incorrect parameter value |
InvalidParameterValue.InvalidPasswordFormat | Incorrect password format. |
InvalidParameterValue.InvalidPasswordLengthError | Invalid password. The password length does not meet the requirements. |
InvalidParameterValue.InvalidPasswordValueError | Invalid password. The password must contain uppercase letters, lowercase letters, digits, and symbols (()`~!@#$%^&*-+=_ |
InvalidParameterValue.InvalidPid | Incorrect PID parameter. |
InvalidParameterValue.InvalidZoneIdError | Invalid availability zone. |
InvalidParameterValue.ParameterCharacterError | Invalid parameter. The parameter can contain only letters, digits, underscores, and hyphens. |
InvalidParameterValue.ParameterHandleError | Failed to process the parameter. Please check if the parameter value is valid. |
InvalidParameterValue.ParameterLengthLimitError | The length of parameter exceeds the limit. |
InvalidParameterValue.ParameterOutRangeError | Invalid parameter values. |
InvalidParameterValue.RegionNotSupported | The current region is not supported. |
InvalidParameterValue.SpecNotRecognizedError | Failed to identify the specification ({{1}}). |
InvalidParameterValue.StructParseFailed | An error occurred while parsing parameters. |
InvalidPid | Incorrect PID parameter. |
OperationDenied.CamDeniedError | This operation cannot be performed. |
OperationDenied.InstanceStatusLimitOpError | This operation cannot be performed on an instance in this status. |
OperationDenied.UserNotAuthenticatedError | You need to verify your identity to make a purchase. |
OperationDenied.VpcDeniedError | You do not have the permission to operate the VPC. |
ResourceInsufficient.ResourceNotEnough | There are not enough resources to purchase instances of this specification in the current region. |
ResourceUnavailable.InvalidInstanceStatus | Incorrect instance status. |
ResourceUnavailable.ResourceNoPermission | No permission for the VPC. |
ResourceUnavailable.VpcResourceNotFound | Failed to get the information of the VPC where the instance resides. |
UnauthorizedOperation.UserHasNoRealnameAuthentication | Unverified user. |
UnknownError | Unknown error. When this error occurs, please contact customer service for assistance. |
Was this page helpful?