You can call this operation to add a database instance to Data Management (DMS) Enterprise of your enterprise.

The administrator and database administrator (DBA) of DMS Enterprise can call this operation to add database instances to DMS Enterprise. To check the users with the administrator or DBA role, log on to the DMS Enterprise console and choose System Management > User Management.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Tid Long Yes -1

The ID of the tenant.

Note To query the ID, log on to the DMS Enterprise console and choose System Management > Instance Management or System Management > User Management. The ID of the tenant appears in the Service Specification section.
InstanceType String Yes MySQL

The type of the database instance. Valid values:

  • MySQL
  • SQLServer
  • PostgreSQL
  • Oracle
  • DRDS
  • OceanBase
  • Mongo
  • Redis
InstanceSource String Yes RDS

The source of the database instance. Valid values:

  • PUBLIC_OWN: an on-premises database built on the public network.
  • RDS: an ApsaraDB for RDS (RDS) instance.
  • ECS_OWN: an on-premises database built on an Elastic Compute Service (ECS) instance.
  • VPC_IDC: an on-premises database built in an Internet data center (IDC) in Virtual Private Cloud (VPC).
NetworkType String Yes VPC

The network type of the database instance. Valid values:

  • CLASSIC
  • VPC
EnvType String Yes product

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

  • product: the production environment.
  • dev: the test environment.
Host String Yes dmstest.rds.aliyun.com

The endpoint of the database instance.

Port Integer Yes 3306

The connection port of the database instance.

DatabaseUser String Yes dmstest

The logon username of the database instance.

DatabasePassword String Yes password

The logon password of the database instance.

InstanceAlias String Yes Test instance

The alias of the database instance. The alias helps you quickly find the required instance.

DbaUid Long Yes 12345678

The Alibaba Cloud unique ID (UID) of the database administrator (DBA) of the database instance.

Note To query the UID, log on to the DMS Enterprise console and choose System Management > User Management.
SafeRule String Yes Test use

The security rule of the database instance. Enter the name of the security rule for your enterprise.

Note To query a specified security rule, log on to the DMS Enterprise console and choose System Management > Security Rules. The security rule appears in the security rule list.
QueryTimeout Integer Yes 60

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

ExportTimeout Integer Yes 600

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

Action String Yes RegisterInstance

The operation that you want to perform. Set the value to RegisterInstance.

EcsInstanceId String No i-xxxxxxxxx

The ID of the ECS instance to which the database instance belongs.

Note You must specify this parameter if the InstanceSource parameter is set to ECS_OWN.
VpcId String No vpc-xxxxxxxxxxxxxxxxxxxxx

The ID of the VPC to which the database instance belongs.

Note You must specify this parameter if the InstanceSource parameter is set to VPC_IDC.
EcsRegion String No cn-hangzhou

The region where the database instance resides.

Note You must specify this parameter if the InstanceSource parameter is set to ECS_OWN or VPC_IDC.
Sid String No dmstest

The system ID (SID) of the database instance.

Note You must specify this parameter if the InstanceType parameter is set to PostgreSQL or Oracle.
DataLinkName String No dblink_test

The name of the data link for cross-database query.

DdlOnline Integer No 2

[Important] Specifies whether to enable the online data description language (DDL) service. Currently, this service is available only for the MySQL and PolarDB databases.

  • 0: The service is disabled.
  • 1: The native online DDL service prevails.
  • 2: Data change without table locking provided by DMS prevails.
UseDsql Integer No 1

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

  • 0: disabled
  • 1: enabled

Response parameters

Parameter Type Example Description
ErrorCode String 404

The error code.

ErrorMessage String The specified instance already exists.

The error message.

RequestId String F4E2A94B-604F-43FF-93E7-F4EE3DCF412E

The ID of the request.

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

Examples

Sample requests


http(s)://[Endpoint]/? Action=RegisterInstance
&Tid=-1
&InstanceType=MySQL
&InstanceSource=RDS
&NetworkType=VPC
&EnvType=product
&Host=dmstest.rds.aliyun.com
&Port=3306
&DatabaseUser=dmstest
&DatabasePassword=password
&InstanceAlias=Test instance
&DbaUid=12345678
&SafeRule=Test use
&QueryTimeout=60
&ExportTimeout=600
&<Common request parameters>

Sample success responses

XML format

<RegisterInstanceResponse>
      <RequestId>D4F02899-CE79-4DFD-9893-5217DA70B363</RequestId>
      <Success>true</Success>
</RegisterInstanceResponse>

JSON format

{
	"RequestId":"F4E2A94B-604F-43FF-93E7-F4EE3DCF412E",
	"Success":true
}

Error codes

For a list of error codes, visit the API Error Center.

Python SDK example

The following example shows how to add a database instance in VPC.


#coding=utf-8
from aliyunsdkcore.client import AcsClient
from aliyunsdkdms_enterprise.request.v20181101.RegisterInstanceRequest import RegisterInstanceRequest
client = AcsClient(
    "<your-access-key-id>",
    "<your-access-key-secret>",
    "<your-region-id>"
)
# Example of adding a database instance built in an IDC in VPC
request = RegisterInstanceRequest()
# The ID of the tenant.
request.set_Tid(1)
# The endpoint of the database instance.
request.set_Host("192.168.16.113")
# The connection port of the database instance.
request.set_Port(3314)
# The type of the database instance, for example, MySQL.
request.set_InstanceType("MySQL")
# The source of the database instance, for example, VPC_IDC.
request.set_InstanceSource("VPC_IDC")
# The network type of the database instance, for example, VPC.
request.set_NetworkType("VPC")
request.set_EnvType("PRODUCT")
# request.set_EcsInstanceId()
# The ID of the VPC to which the database instance belongs.
request.set_VpcId("VPC ID of the instance")
# The region where the database instance resides, for example, cn-hangzhou.
request.set_EcsRegion("Region ID of the instance")
# request.set_Sid();
# The logon username of the database instance.
request.set_DatabaseUser("Logon username of the instance")
# The logon password of the database instance.
request.set_DatabasePassword("Logon password of the instance")
# The alias of the database instance.
request.set_InstanceAlias("Alias of the instance")
# The Alibaba Cloud UID of the DBA of the database instance. This user must be added in the DMS Enterprise console or through the RegisterUser operation in advance.
request.set_DbaUid(-1)
request.set_SafeRule("Name of the security rule configured in the DMS Enterprise console")
request.set_QueryTimeout(60)
request.set_ExportTimeout(600)
response = client.do_action_with_exception(request)
print response