All Products
Search
Document Center

Data Management:RegisterInstance

Last Updated:Mar 14, 2024

Registers a database instance in Data Management (DMS).

Operation description

Prerequisites: You are a DMS administrator or a database administrator (DBA). You can call the ListUsers or GetUser operation to query your user role from the RoleIdList parameter that is returned.

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
dms:RegisterInstanceRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TidlongNo

The ID of the tenant. You can call the GetUserActiveTenant operation to query the tenant ID.

3***
InstanceTypestringYes

The type of the database. 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 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)
RDS
NetworkTypestringYes

The network type of the database instance. Valid values:

  • CLASSIC: classic network
  • VPC: VPC
VPC
EnvTypestringYes

The type of the environment in which the database instance is deployed. Valid values:

  • product: 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 ECS instance on which the database instance is deployed.

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

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

Note This parameter is required if the InstanceSource parameter is set to VPC_IDC.
vpc-xxxxxxxxxxxxxxxxxxxxx
EcsRegionstringNo

The ID of the region in which the database instance resides.

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

The host address that is used to connect to the database instance.

172.XX.XXX.254
PortintegerYes

The port that is used to connect to the database instance.

3306
SidstringNo

The system ID (SID) of the database.

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

The account that is used to log on to the database.

dmstest
DatabasePasswordstringYes

The password that is used to log on to the database.

******
InstanceAliasstringYes

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

Test instance
DbaUidlongYes

The ID of the user who assumes the DBA role of the database instance. You can call the ListUsers or GetInstance operation to query the user ID.

22275482072787****
SafeRulestringYes

The name of the security rule set (GroupName) for the database instance. You can call the ListStandardGroups or GetInstance operation to query the name of the security rule set.

Test
QueryTimeoutintegerYes

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

60
ExportTimeoutintegerYes

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

600
DataLinkNamestringNo

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

Note
  • This parameter is required if 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 the lock-free schema change feature for the database instance. Valid values:

  • 0: disables the lock-free schema change feature.
  • 1: uses the online DDL of MySQL first.
  • 2: uses the lock-free schema change feature of DMS first.
Note Supported database types: ApsaraDB RDS for MySQL, PolarDB for MySQL, ApsaraDB MyBase for MySQL, and third-party MySQL databases.
2
UseDsqlintegerNo

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

  • 0: disables the cross-database query feature.
  • 1: enables the cross-database query feature.
Note Supported database types: MySQL, SQL Server, PostgreSQL, PolarDB for PostgreSQL (compatible with Oracle), and ApsaraDB for Redis.
1
SkipTestbooleanNo

Specifies whether to skip the connectivity test. Valid values:

  • true: skips the connectivity test
  • false: does not skip the connectivity test
true
EnableSellSitdstringNo
  • Y: enables the sensitive data protection feature
  • NULL or other: disables the sensitive data protection feature
Y
TemplateIdlongNo

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

31***
TemplateTypestringNo

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

INNER
DbaUidByStringstringNo

The ID of the user who assumes the DBA role of the database instance. If the user ID is a non-numeric value such as a role or an account, you can use this parameter to replace DbaUid.

22275482072787****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

F4E2A94B-604F-43FF-93E7-F4EE3DCF412E
ErrorCodestring

The error code returned if the request failed.

UnknownError
ErrorMessagestring

The error message 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": "F4E2A94B-604F-43FF-93E7-F4EE3DCF412E",
  "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
2023-11-07The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: DbaUidByString

Sample code for SDK for Python

The following sample code provides an example on how to register a database instance that is deployed in a data center connected over a 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
request = RegisterInstanceRequest()
# The ID of the tenant.
request.set_Tid(1)
# The host address that is used to connect to the database instance.
request.set_Host("192.168.16.113")
# The port that is used to connect to the database instance.
request.set_Port(3314)
# The type of the database. In this example, the parameter is set to MySQL.
request.set_InstanceType("MySQL")
# The source of the database instance. In this example, the parameter is set to VPC_IDC.
request.set_InstanceSource("VPC_IDC")
# The network type of the database instance. In this example, the parameter is set to 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 database instance")
# The ID of the region in which the database instance resides. Example: cn-hangzhou.
request.set_EcsRegion("Region ID of the database instance")
# request.set_Sid();
# The account that is used to log on to the database.
request.set_DatabaseUser("Logon account of the database")
# The password that is used to log on to the database.
request.set_DatabasePassword("Logon password of the database")
# The alias of the database instance. This alias helps you identify the database instance in DMS.
request.set_InstanceAlias("Alias of the database instance")
# The ID of the user who assumes the DBA role of the database instance. The user must be added to DMS Enterprise by using the console or the relevant API operation in advance.
request.set_DbaUid(-1)
request.set_SafeRule("Name of the security rule set that is configured in DMS Enterprise")
request.set_QueryTimeout(60)
request.set_ExportTimeout(600)
response = client.do_action_with_exception(request)
print response