All Products
Search
Document Center

Data Management:AddInstance

Last Updated:Nov 09, 2025

Adds a database instance to Data Management (DMS) and enable security hosting for the instance.

Operation description

You must be a database administrator (DBA) or a DMS administrator. For more information, see View system roles.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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
dms:AddInstancecreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TidlongNo

The ID of the tenant.

Note You can move the pointer over the profile picture in the upper-right corner of the DMS console to obtain the tenant ID.
23****
InstanceTypestringYes

The type of the database instance. For more information about the valid values of this parameter, see DbType parameter.

MySQL
InstanceSourcestringYes

The source of the database instance. Valid values:

  • PUBLIC_OWN: a self-managed database instance that is deployed on the Internet.
  • RDS: an ApsaraDB RDS instance.
  • ECS_OWN: a self-managed database instance that is deployed on an Elastic Compute Service (ECS) instance.
  • VPC_IDC: a self-managed database instance that is deployed in a data center connected over a virtual private cloud (VPC).
  • GATEWAY: a database instance connected by using a database gateway.
RDS
NetworkTypestringYes

The network type. Valid values:

  • CLASSIC: the classic network.
  • VPC
VPC
EnvTypestringYes

The type of the environment to which the database instance belongs. Valid values:

  • product: the production environment.
  • dev: development environment.
  • pre: pre-release environment.
  • test: test environment.
  • sit: system integration testing (SIT) environment.
  • uat: user acceptance testing (UAT) environment.
  • pet: stress testing environment.
  • stag: staging environment.
product
EcsInstanceIdstringNo

The ID of the instance. If your instance is a database instance connected by using a database gateway, specify the gateway ID for this parameter.

Note This parameter is required if InstanceSource is set to ECS_OWN or GATEWAY.
i-2zei9gs1t7h8l7ac****
VpcIdstringNo

The ID of the instance connected over a VPC.

Note This parameter is required if InstanceSource is set to VPC_IDC.
vpc-2zef4o1hu7ljd****
EcsRegionstringNo

The region in which the ECS instance resides.

Note This parameter is required if InstanceSource is set to RDS, ECS_OWN, GATEWAY, or VPC_IDC.
cn-hangzhou
HoststringYes

The endpoint that is used to connect to the database.

172.XX.XXX.254
PortintegerYes

The port that is used to connect to the database.

3306
SidstringNo

The system ID (SID) of the database instance.

Note This parameter is required if InstanceType is set to ORACLE.
testSid
DatabaseUserstringYes

The name of the database account.

testsdb
DatabasePasswordstringYes

The password of the database account.

test***
InstanceAliasstringYes

The alias of the database instance. Specify an alias that can help you identify the database instance in DMS.

DbaIdlongYes

The ID of the user who assumes the database administrator (DBA) role. You can call the ListUsers or GetInstance operation to obtain the value of this parameter.

27****
QueryTimeoutintegerYes

The timeout period for querying data from the database instance. Unit: seconds.

7200
ExportTimeoutintegerYes

The timeout period for exporting data from the database instance. Unit: seconds.

86400
EnableSellTruststringYes

Specifies whether to enable the security hosting feature for the database instance. Valid values:

  • Y: enables the security hosting feature for the database instance.
  • N: disables the security hosting feature for the database instance.
Y
EnableSellStablestringNo

Specifies whether to enable Stable Change for the database instance. Valid values:

  • Y: Enables Stable Change.
  • N: Disables Stable Change.
NULL
EnableSellCommonstringNo

Specifies whether to enable Security Collaboration for the database instance. Valid values:

  • Y: enables Security Collaboration.
  • N: disables Security Collaboration.
Y
SafeRulestringYes

The name of the security rule set for the database instance. This parameter is required if Security Collaboration is enabled. You can call the ListStandardGroups or GetInstance operation to obtain the name of the security rule set from GroupName.

EnableSellSitdstringNo

Specifies whether to enable sensitive data protection. Valid values:

  • Y: enables the sensitive data protection feature for the database instance.
  • N: disables the sensitive data protection feature for the database instance.
Y
DataLinkNamestringNo

The name of the database link for cross-database queries.

Note
  • This property must be specified when UseDsql is set to 1.

  • The name can contain only lowercase letters and underscores (_).

  • The name must be unique within a tenant.

dblink_test
DdlOnlineintegerNo

Specifies whether to enable Lock-free Schema Change. Valid values:

  • 0: does not enable lock-free schema change.
  • 1: uses the native online DDL operations of MySQL first.
  • 2: uses lock-free schema change first.
Note Supported databases include ApsaraDB RDS for MySQL, PolarDB for MySQL, ApsaraDB MyBase for MySQL, and third-party MySQL databases.
2
UseDsqlintegerNo

Specifies whether to enable cross-database query for the database instance. Valid values:

  • 0: does not enable cross-database query.
  • 1: enables cross-database query.
Note Supported databases include MySQL, SQL Server, PostgreSQL, PolarDB for Oracle, and Redis.
1
SkipTestbooleanNo

Specifies whether to skip the connectivity test. Valid values:

  • true
  • false
false
TemplateIdlongNo

The ID of the classification and grading template. You can call the ListClassificationTemplates operation to query the template ID.

31***
TemplateTypestringNo

The type of the classification and grading template. You can call the ListClassificationTemplates operation to query the template type.

INNER
UseSslintegerNo

Specifies whether to allow Data Management Service (DMS) to connect to the database instance by using SSL connections. Before you use SSL connections, make sure that the SSL encryption feature is enabled for the database instance. Valid values:

  • 0 (default): DMS automatically checks whether self-negotiation is enabled for the database instance. DMS automatically checks whether the SSL encryption feature is enabled for the database instance. If the SSL encryption feature is enabled, DMS connects to the database instance by using SSL connections. Otherwise, DMS connects to the database instance without encryption.
  • 1: DMS connects to the database instance by using SSL connections. This value is invalid if the SSL encryption feature is disabled for the database instance.
  • -1: DMS does not connect to the database instance by using SSL connections.
Note
  • This parameter is available only for a MySQL or Redis database instance.

  • SSL encrypts network connections at the transport layer to improve the security and integrity of data in transmission. However, SSL increases the response time of network connections.

0

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request. You can use the ID to query logs and troubleshoot issues.

0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931
ErrorCodestring

The error code that is returned if the request failed.

UnknownError
ErrorMessagestring

The error message that is returned if the request failed.

UnknownError
Successboolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
true

Examples

Sample success responses

JSONformat

{
  "RequestId": "0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931",
  "ErrorCode": "UnknownError",
  "ErrorMessage": "UnknownError",
  "Success": true
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-03-20The request parameters of the API has changedView Change Details