This topic uses ApsaraDB RDS as an example to describe how to connect an exclusive resource group for Data Integration to a data store that is deployed in a virtual private cloud (VPC).
Prerequisites
- An ApsaraDB RDS for MySQL instance is purchased. In this example, the ApsaraDB RDS for MySQL instance uses MySQL 5.7. You can configure the instance based on your business needs. For more information, see Create an ApsaraDB RDS for MySQL instance.
- A database is created in the ApsaraDB RDS for MySQL instance. The username and password that are used to log on to the database are obtained. For more information, see Create accounts and databases for an ApsaraDB RDS for MySQL instance.
- A VPC is created. For more information, see Create a VPC.
- A vSwitch is created. For more information, see Create a vSwitch.
- A security group is created. For more information, see Create a security group.
Background information
Procedure
- Obtain the information about the ApsaraDB RDS for MySQL instance.When you configure a connection to a database in the ApsaraDB RDS for MySQL instance, you must provide the instance ID, database name, username, and password.
- Log on to the ApsaraDB RDS console.
- In the left-side navigation pane, click Instances.
- On the Instances page, find the required instance and obtain the instance ID.
- Find the required instance and click Manage.
- In the left-side navigation pane, click Databases. On the page that appears, find the database to which you want to create a connection and obtain the database name.
- In the left-side navigation pane, click Accounts. Then, obtain the username of the account that you can use to connect to the database. You can enter the username when you create a connection to the database.
- Create an exclusive resource group for Data Integration.
- Log on to the DataWorks console.
- Select a region. In the left-side navigation pane, click Resource Groups.
- On the Exclusive Resource Groups tab, click Create a dedicated resource group.
- In the Create a dedicated resource group panel, set the Resource Group Type parameter to Exclusive Resource Groups for Data Integration. Then, click Purchase next to Order Number to go to the buy page.
- On the buy page, set the Region, Type, Exclusive data integration resources, Units, and Duration parameters as required. Then, click Buy Now.In this example, the ApsaraDB RDS for MySQL instance is purchased in the China (Shanghai) region. Therefore, you must set the Region parameter to China (Shanghai). You can select specifications for the exclusive resource group for Data Integration based on your needs. For more information, see Performance metrics and billing standards of exclusive resource groups for Data Integration.
- After you confirm that the order information is correct, read and agree to DataWorks Exclusive Resources Agreement of Service by selecting the check box and click Pay.
- Go back to the Create a dedicated resource group panel and set the parameters as required.
Parameter Description Resource Group Type The type of the resource group. In this example, select Exclusive Resource Groups for Data Integration. Resource Group Name The name of the resource group. The name must be unique within all resource groups of a tenant. Note A tenant indicates an Alibaba Cloud account. Multiple RAM users may exist for a tenant.Resource Group Description The description of the resource group. Order Number The order number of the exclusive resources that you purchase. - Click OK.
- Bind the exclusive resource group for Data Integration to the VPC.
- On the Exclusive Resource Groups tab of the Resource Groups page, find the exclusive resource group for Data Integration and click Add VPC Binding.Notice Before you bind the exclusive resource group for Data Integration to the VPC as a RAM user, make sure that the RAM user is authorized to access the ApsaraDB RDS for MySQL instance.
- Click Add Binding in the upper-right corner. In the Add VPC Binding panel, set the parameters as required.
Parameter Description Resource Group Name Select the resource group that you want to bind to the VPC from the Resource Group Name drop-down list. VPC Select the VPC where the ApsaraDB RDS for MySQL instance is deployed from the VPC drop-down list. VSwitch Select the vSwitch where the ApsaraDB RDS for MySQL instance resides from the VSwitch drop-down list. Security Groups Select the required security group from the Security Groups drop-down list. - Click OK.
- On the Exclusive Resource Groups tab of the Resource Groups page, find the exclusive resource group for Data Integration and click Add VPC Binding.
- Optional:Add a route to the VPC.The exclusive resource group for Data Integration must be in the same zone as the ApsaraDB RDS for MySQL instance. If they are in the same zone, skip this step. If they are in different zones, you must add a route.
- On the Exclusive Resource Groups tab, find the exclusive resource group for Data Integration and click Add VPC Binding.
- Find the required resource group and click Custom Route.
- In the Custom Route panel, click Add Route.
- In the Add Route dialog box, set the parameters as required.
Parameter Description Destination Type The data store in this example is deployed in the VPC. Set this parameter to VPC. Destination VPC The region and name of the VPC where the data store is deployed. Note This parameter is displayed only when the Destination Type parameter is set to VPC.Connection Method Valid values: Switch, Fixed IP Address, and CIDR Block. In this example, set this parameter to Switch. Destination VSwitch Select a specific vSwitch in the VPC as the destination vSwitch for routing. Routing By default, the value cannot be changed. - Click Generate Route.
- Add the elastic IP address (EIP) and the elastic network interface (ENI) IP address
of the exclusive resource group for Data Integration to the whitelist that allows
access to the ApsaraDB RDS for MySQL instance.
- On the Exclusive Resource Groups tab, find the exclusive resource group for Data Integration and click View Information.
- In the Exclusive Resource Groups dialog box, view the EIP that is indicated by the EIPAddress parameter.
- On the Exclusive Resource Groups tab of the Resource Groups page, find the exclusive resource group for Data Integration and click Add VPC Binding.
- On the details page of the resource group, view the ENI IP address in the ENI IP Address column.
- Log on to the ApsaraDB RDS console.
- In the upper-left corner of the Instances page, check whether the selected region is the region where the ApsaraDB RDS for MySQL instance resides. If not, select the required region. Find the ApsaraDB RDS for MySQL instance and click Manage.
- In the left-side navigation pane, click Data Security.
- On the Data Security page, click Create Whitelist.
- In the Create Whitelist dialog box, set the parameters as required and click Add.
Parameter Description Network Isolation Mode By default, the value cannot be changed. Whitelist Name The name of the whitelist. The name must comply with the following conventions: - It consists of lowercase letters, digits, and underscores (_).
- It must start with a lowercase letter and end with a digit or lowercase letter.
- It must be 2 to 32 characters in length.
IP Addresses Use the EIP and ENI IP address of the exclusive resource group for Data Integration.
- Create a connection to the specified database in the ApsaraDB RDS for MySQL instance
and test the connectivity.
- Log on to the DataWorks console.
- In the left-side navigation pane, click Workspaces.
- After you select the region where the required workspace resides, find the workspace and click Data Integration.
- In the left-side navigation pane, click Connection to go to the Data Source page.
- On the Data Source page, click New data source in the upper-right corner.
- In the Add data source dialog box, select MySQL as the connection type.
- In the Add MySQL data source dialog box, set the parameters as required.You can set the Data source type parameter to Alibaba Cloud instance mode or Connection string mode. In this example, select Alibaba Cloud instance mode.
Parameter Description Data source type The type of the connection. Set this parameter to Alibaba Cloud instance mode. Data Source Name The name of the connection. The name can contain letters, digits, and underscores (_), and must start with a letter. Data source description The description of the connection. The description can be up to 80 characters in length. Environment Valid values: Development and Production. Note This parameter is displayed only when the workspace is in standard mode.Region The region of the ApsaraDB RDS for MySQL instance. RDS instance ID The ID of the ApsaraDB RDS for MySQL instance. RDS instance account ID The ID of the Alibaba Cloud account that is used to purchase the ApsaraDB RDS for MySQL instance. Log on to the DataWorks console. Move the pointer over the profile picture in the upper-right corner and select Security Settings. Then, view the ID of your Alibaba Cloud account. Database name The name of the database. User name The username that is used to log on to the database. Password The password that is used to log on to the database. - On the Data Integration tab, find the required resource group and click Test connectivity.
- After the connection passes the connectivity test, click Complete.