All Products
Search
Document Center

ApsaraDB for MongoDB:CreateDBInstance

Last Updated:Sep 06, 2024

Creates or clones an ApsaraDB for MongoDB replica set instance.

Operation description

Make sure that you fully understand the billing methods and pricing of ApsaraDB for MongoDB before you call this operation.

For more information about the instance types of ApsaraDB for MongoDB instances, see Instance types.

To create sharded cluster instances, you can call the CreateShardingDBInstance operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dds:CreateDBInstancecreate
  • Instance
    acs:dds:{#regionId}:{#accountId}:dbinstance/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

ETnLKlblzczshOTUbOCz****
ZoneIdstringNo

The zone ID of the instance. You can call the DescribeRegions operation to query the most recent zone list.

cn-hangzhou-g
EngineVersionstringYes

The version of the database engine. Valid values:

  • 6.0
  • 5.0
  • 4.4
  • 4.2
  • 4.0
Note When you call this operation to clone an instance or restore an instance from the recycle bin, set the value of this parameter to the engine version of the source instance.
4.4
DBInstanceClassstringYes

The instance type. You can also call the DescribeAvailableResource operation to query the instance type.

dds.mongo.standard
DBInstanceStorageintegerYes

The storage capacity of the instance. Unit: GB.

The values that can be specified for this parameter vary based on the instance types. For more information, see Replica set instance types.

10
DBInstanceDescriptionstringNo

The name of the instance. The name of the instance must meet the following requirements:

  • The name must start with a letter.
  • The name can contain digits, letters, underscores (_), and hyphens (-).
  • The name must be 2 to 256 characters in length.
test
SecurityIPListstringNo

The IP addresses in an IP address whitelist. Multiple IP addresses are separated by commas (,), and each IP address in the IP address whitelist must be unique. The following types of values are supported:

  • 0.0.0.0/0
  • IP addresses, such as 10.23.12.24.
  • Classless Inter-Domain Routing (CIDR) blocks, such as 10.23.12.0/24. In this case, /24 indicates that the prefix of each IP address is 24-bit long. You can replace 24 with a value within the range of 1 to 32.
Note
  • A maximum of 1,000 IP addresses or CIDR blocks can be configured for each instance.
  • If you enter 0.0.0.0/0, all IP addresses can access the instance. This may introduce security risks to the instance. Proceed with caution.
  • 192.168.xx.xx,192.168.xx.xx
    AccountPasswordstringNo

    The password of the root account. The password must meet the following requirements:

    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
    • Special characters include ! # $ % ^ & * ( ) _ + - =
    • The password of the account must be 8 to 32 characters in length.
    123456Aa
    PeriodintegerNo

    The subscription period of the instance. Unit: months.

    Valid values: 1 to 9, 12, 24, 36, and 60.

    Note When you set the ChargeType parameter to PrePaid, this parameter is valid and required.
    1
    ChargeTypestringNo

    The billing method of the instance. Valid values:

    • PostPaid: pay-as-you-go. This is the default value.
    • PrePaid: subscription.
    Note If you set this parameter to PrePaid, you must also specify the Period parameter.
    PrePaid
    NetworkTypestringNo

    The network type of the instance. Valid value:

    VPC: Virtual Private Cloud (VPC)

    VPC
    VpcIdstringYes

    The ID of the VPC.

    vpc-bp175iuvg8nxqraf2****
    VSwitchIdstringYes

    The ID of the vSwitch to which the instance is connected.

    vsw-bp1gzt31twhlo0sa5****
    SrcDBInstanceIdstringNo

    The ID of the source instance.

    Note When you call this operation to clone an instance, this parameter is required. The BackupId or RestoreTime parameter is also required. When you call this operation to restore an instance from the recycle bin, this parameter is required. The BackupId or RestoreTime parameter is not required.
    dds-bp1ee12ad351****
    BackupIdstringNo

    The ID of the backup set. You can call the DescribeBackups operation to query the backup set ID.

    Note When you call this operation to clone an instance based on the backup set, this parameter is required. The SrcDBInstanceId parameter is also required.
    32994****
    RestoreTimestringNo

    The point in time to which the instance is restored, which must be within seven days. The time is displayed in the yyyy-MM-ddTHH:mm:ssZ format (UTC time).

    Note When you call this operation to restore an instance to the specified time, this parameter is required. The SrcDBInstanceId parameter is also required.
    2022-03-13T12:11:14Z
    BusinessInfostringNo

    The business information. This is an additional parameter.

    {“ActivityId":"000000000"}
    AutoRenewstringNo

    Specifies whether to enable auto-renewal for the instance. Default value: false. Valid values:

    • true: The instance is automatically renewed.
    • false: The instance is manually renewed.
    Note This parameter is valid and optional when the ChargeType parameter is set to PrePaid.
    true
    DatabaseNamesstringNo

    The name of the database.

    Note When you call this operation to clone an instance, you can set this parameter to specify the database to clone. Otherwise, all databases of the instance are cloned.
    mongodbtest
    CouponNostringNo

    Specifies whether to use coupons. Default value: null. Valid values:

    • default or null: uses coupons.
    • youhuiquan_promotion_option_id_for_blank: does not use coupons.
    youhuiquan_promotion_option_id_for_blank
    StorageEnginestringNo

    The storage engine of the instance. Set the value to WiredTiger.

    Note
  • If you call this operation to clone an instance or restore an instance from the recycle bin, set this parameter to the storage engine of the source instance.
  • For more information about the limits on database versions and storage engines of an instance, see MongoDB versions and storage engines.
  • WiredTiger
    ReplicationFactorstringNo

    The number of nodes in the replica set instance. Default value: 3. Valid values:

    • 3
    • 5
    • 7
    3
    ReadonlyReplicasstringNo

    The number of read-only nodes in the replica set instance. Default value: 0. Valid values: 0 to 5.

    0
    EnginestringNo

    The database engine of the instance. Set the value to MongoDB.

    MongoDB
    StorageTypestringNo

    The storage type of the instance. Valid values:

    • cloud_essd1 :ESSD PL1.
    • cloud_essd2: ESSD PL2.
    • cloud_essd3: ESSD PL3.
    • local_ssd: local SSD.
    cloud_essd1
    SecondaryZoneIdstringNo

    The zone where the secondary node resides for multi-zone deployment. Valid values:

    • cn-hangzhou-g: Hangzhou Zone G.
    • cn-hangzhou-h: Hangzhou Zone H.
    • cn-hangzhou-i: Hangzhou Zone I.
    • cn-hongkong-b: Hongkong Zone B.
    • cn-hongkong-c: Hongkong Zone C.
    • cn-hongkong-d: Hongkong Zone D.
    • cn-wulanchabu-a: Ulanqab Zone A.
    • cn-wulanchabu-b: Ulanqab Zone B.
    • cn-wulanchabu-c: Ulanqab Zone C.
    • ap-southeast-1a: Singapore Zone A.
    • ap-southeast-1b: Singapore Zone B.
    • ap-southeast-1c: Singapore Zone C.
    • ap-southeast-5a: Jakarta Zone A.
    • ap-southeast-5b: Jakarta Zone B.
    • ap-southeast-5c: Jakarta Zone C.
    • eu-central-1a: Frankfurt Zone A.
    • eu-central-1b: Frankfurt Zone B.
    • eu-central-1c: Frankfurt Zone C.
    Note
  • This parameter is valid and required when the EngineVersion parameter is set to 4.4 or 5.0.
  • The value of this parameter cannot be the same as the value of the ZoneId or HiddenZoneId parameter.
  • cn-hangzhou-h
    HiddenZoneIdstringNo

    The zone where the hidden node resides for multi-zone deployment. Valid values:

    • cn-hangzhou-g: Hangzhou Zone G.
    • cn-hangzhou-h: Hangzhou Zone H.
    • cn-hangzhou-i: Hangzhou Zone I.
    • cn-hongkong-b: Hongkong Zone B.
    • cn-hongkong-c: Hongkong Zone C.
    • cn-hongkong-d: Hongkong Zone D.
    • cn-wulanchabu-a: Ulanqab Zone A.
    • cn-wulanchabu-b: Ulanqab Zone B.
    • cn-wulanchabu-c: Ulanqab Zone C.
    • ap-southeast-1a: Singapore Zone A.
    • ap-southeast-1b: Singapore Zone B.
    • ap-southeast-1c: Singapore Zone C.
    • ap-southeast-5a: Jakarta Zone A.
    • ap-southeast-5b: Jakarta Zone B.
    • ap-southeast-5c: Jakarta Zone C.
    • eu-central-1a: Frankfurt Zone A.
    • eu-central-1b: Frankfurt Zone B.
    • eu-central-1c: Frankfurt Zone C.
    Note
  • This parameter is valid and required when the EngineVersion parameter is set to 4.4 or 5.0.
  • The value of this parameter cannot be the same as the value of the ZoneId or SecondaryZoneId parameter.
  • cn-hangzhou-i
    Tagarray<object>No

    The custom tags added to the instance.

    objectNo

    The custom tags added to the instance.

    KeystringNo

    The key of the tag.

    Note N specifies the serial number of the tag. For example, Tag.1.Key specifies the key of the first tag and Tag.2.Key specifies the key of the second tag.
    testdatabase
    ValuestringNo

    The value of the tag.

    Note N specifies the serial number of the tag. For example, Tag.1.Value specifies the value of the first tag and Tag.2.Value specifies the value of the second tag.
    apitest
    GlobalSecurityGroupIdsstringNo

    The global IP address whitelist template name of the instance. Multiple IP address whitelist template names are separated by commas (,) and each template name must be unique. (The template feature is available only in canary release.)

    g-qxieqf40xjst1ngp****
    EncryptedbooleanNo

    Specifies whether to enable disk encryption.

    true
    EncryptionKeystringNo

    The ID of the custom key.

    2axxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    ProvisionedIopslongNo

    The provisioned IOPS. Valid values: 0 to 50000.

    1960

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    The ID of the request.

    D8F1D721-6439-4257-A89C-F1E8E9C9****
    DBInstanceIdstring

    The ID of the instance.

    dds-bp144a7f2db8****
    OrderIdstring

    The ID of the order.

    21077576248****

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "D8F1D721-6439-4257-A89C-F1E8E9C9****",
      "DBInstanceId": "dds-bp144a7f2db8****",
      "OrderId": "21077576248****"
    }

    Error codes

    HTTP status codeError codeError messageDescription
    400SecurityRisk.AuthVerificationwe have detected a risk with your default payment method. An email and notification has been sent to you. Please re-submit your order before after verificaiton.-
    400MissingParameterPeriod is mandatory for this action.-
    400ORDER.ACCOUNT_INFORMATION_INCOMPLETEYour information is incomplete. Complete your information before ordering.-
    400InvalidClientToken.MalformedSpecified parameter ClientToken is not valid.-
    400InvalidDBInstanceDescription.MalformedSpecified parameter DBInstanceDescription is not valid.Invalid node name.
    400InvalidSecurityIPListLength.MalformedThe quota of security ip exceeds.-
    400InsufficientBalanceYour account does not have enough balance.The payment failed. Please add another payment method. You can also top up or add funds to your account.
    400QuotaExceed.AfterpayInstanceLiving afterpay instances quota exceeded.-
    400InvalidCapacity.NotFoundThe Capacity provided does not exist in our records.The specified storage capacity is invalid. Specify a storage capacity within a valid range. Unit: MB.
    400ResourceNotAvailableResource you requested is not available for finance user.-
    400IdempotentParameterMismatchRequest uses a client token in a previous request but is not identical to that request.The specified ClientToken parameter is already in use. Specify a client token that has not been used. The ClientToken value is generated by the client and must be unique among different requests. The value can be up to 64 ASCII characters in length and cannot contain non-ASCII characters.
    400InvalidSecurityIPList.MalformedThe specified parameter "SecurityIPList" is not valid.-
    400InvalidSecurityIPList.DuplicateThe Security IP address is not in the available range or occupied.-
    400InvalidSecurityIPListLength.MalformedThe quota of security ip exceeds.-
    400InvalidDBInstanceStorage.ValueNotSupportedThe specified parameter DBInstanceStorage is not valid.-
    400InvalidAccountPassword.MalformedSpecified parameter AccountPassword is not valid.-
    400TokenServiceErrorDuplicate ClientToken request.-
    400Zone.ClosedThe specified zone is closed.-
    400PRICE.ORIGIN_PRICE_ERRORThe origin price error.-
    400NO_AVAILABLE_PAYMENT_METHODNo payment method is specified for your account. We recommend that you add a payment method.-
    400InvalidEcsImage.NotFoundSpecified ecs image does not exist.-
    400SaleValidateNoSpecificCodeFailedSpecified Storage or Version or InstanceClass is invalid.-
    400Trade_Not_Support_Async_PayTrade not support async pay.-
    400InvalidZoneldThe specified primary zone, secondary zone and hidden zone cannot be the same.The parameters of the primary zone, secondary zone and hidden zone cannot be the same.
    400SameZoneIdThe specified primary zone, secondary zone require two different zones.The specified primary zone, secondary zone require two different zones.
    403RealNameAuthenticationErrorYour account has not passed the real-name authentication yet.Real-name verification has not been completed for the Alibaba Cloud account. Complete real-name verification and try again.
    403RegionUnauthorizedThere is no authority to create instance in the specified region.-
    403OperationDeniedThe resource is out of usage.-
    403InvalidEngineVersionInRegion.NotAvailableThe EngineVersion in the Region is not available.-
    403InvalidBackupLogStatusCurrent backup log enable status does not support this operation.-
    403IncorrectBackupSetStateCurrent backup set state does not support operations.The latest backup set is not ready. Please try again later.
    404InvalidBackup.NotFoundThe available backup does not exist in recovery time.-

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2024-07-15The Error code has changedView Change Details
    2024-04-18The Error code has changedView Change Details
    2024-03-13The Error code has changedView Change Details
    2024-01-12The Error code has changedView Change Details
    2023-11-03The Error code has changedView Change Details
    2023-08-24The Error code has changed. The request parameters of the API has changedView Change Details
    2023-08-01The Error code has changed. The request parameters of the API has changedView Change Details
    2023-06-05The Error code has changed. The request parameters of the API has changedView Change Details