Prepare the environment

更新时间: 2026-04-16 03:40:17

To complete this tutorial, prepare the required E-MapReduce (EMR) cluster and DataWorks workspace, and configure your environment.

Business background

Developing better business strategies requires analyzing user profile data from website behavior, including the geographical and social attributes of user groups. Scheduled analysis of this data enables fine-grained management of website traffic.

Before you begin

To follow this tutorial, read the introduction to the user profile analysis experiment to understand the overall workflow.

Notes

  • This tutorial provides the user information and website access data required for the exercises. You can use this data directly.

  • The data provided in this tutorial is for hands-on practice with DataWorks only. All data is mock data.

  • This tutorial uses Data Studio (new version) for data transformation.

Prepare the EMR environment

In this tutorial, you will create an EMR cluster and integrate it with DataWorks to run data processing tasks. The following table describes the key configuration parameters. For detailed steps on how to create an EMR cluster, see Create a cluster.

Parameter

Value

Region

China (Shanghai)

Business Scenario

Data Lake

Product Version

Select the latest version.

Optional Services

Select components based on your business needs. This tutorial requires Hive and OSS-HDFS.

Metadata

DLF Unified Metadata

Root Storage Directory of Cluster

Select an OSS-HDFS instance. If the drop-down list is empty, click Create OSS-HDFS instance.

Note

If you plan to develop EMR tasks in DataWorks, read Best practices for configuring DataWorks on EMR clusters before creating an EMR cluster.

Prepare the DataWorks environment

Before using DataWorks for development, ensure that you have activated it. For more information, see Activate DataWorks.

Step 1: Create a workspace

If you already have a workspace (new version) in the China (Shanghai) region, you can skip this step and use your existing workspace.

  1. Log on to the DataWorks console, switch the region to China (Shanghai) in the top navigation bar, and click Work space in the left navigation bar to go to the workspace list page.

  2. Click Create Workspace to create a Standard Mode workspace that Use Data Studio (New Version) (Isolate Development and Production Environments).

    Note

    After February 18, 2025, when an Alibaba Cloud account activates DataWorks and creates a workspace in the China (Shanghai) region for the first time, the new version of Data Studio is enabled by default.

For more information about how to create a workspace, see Create a workspace.

Step 2: Create a Serverless resource group

  1. Purchase a Serverless resource group.

    This tutorial requires a DataWorks Serverless resource group for data synchronization and scheduling. You must purchase and set up a Serverless resource group.

  2. Log on to the DataWorks Resource Group List page, switch the region to China (Shanghai) in the top navigation bar, and click Resource Group in the left navigation bar to go to the Resource Groups page.

  3. Click Create Resource Group. On the resource group purchase page, set Region and Zone to China (Shanghai), specify a Resource Group Name, configure other parameters, and complete the payment as prompted on the page. For information about the billing of Serverless resource groups, see Billing of Serverless resource groups.

    Note

    If no Virtual Private Cloud (VPC) or vSwitch is available in the current region, click the corresponding console link in the parameter description to create them. For more information about VPCs and vSwitches, see What is a Virtual Private Cloud (VPC)?.

  4. Associate the resource group with your DataWorks workspace.

    You must associate a new Serverless resource group with a workspace before you can use it.

    Log on to the DataWorks - Resource Group List page. At the top of the page, switch the region to China (Shanghai), find the Serverless resource group that you purchased, and click Associate Workspace in the Operation column. Then, click Associate next to the DataWorks workspace that you created.

  5. Configure public internet access for the resource group.

    The sample data for this tutorial is retrieved over the public internet. Because resource groups lack outbound internet access by default, you must configure an Internet NAT Gateway and an Elastic IP Address (EIP) for the associated Virtual Private Cloud (VPC) to enable public access.

    1. Log on to the VPC - Internet NAT Gateway console, and in the top menu bar, switch the region to China (Shanghai).

    2. Click Create Internet NAT Gateway and configure the related parameters. The following are the key parameters for this example. You can use the default values for other parameters.

      Parameter

      Value

      Region

      China (Shanghai).

      Network and Availability Zone

      Select the VPC and vSwitch associated with your resource group.

      You can go to the DataWorks console, switch to the China (Shanghai) region, and then click Resource Group in the left navigation bar to go to the Resource Groups page. Find the resource group that you created, click Network Settings in the Operation column, and view the VPC and Switch in the Data Scheduling & Data Integration section. For more information about VPCs and vSwitches, see What is a VPC?.

      Network Type

      Internet NAT Gateway.

      Elastic IP Address instance

      Create Elastic IP Address.

      Service-Linked Role Creation

      When you create a NAT gateway for the first time, you must create a service-linked role by clicking Create Service-Linked Role.

    3. Click Buy Now, select the service agreement, and click Activate to complete the purchase.

    4. After the Internet NAT Gateway instance is created, return to the console and create an SNAT entry for the new instance.

      Note

      The resource group can access the public internet through its Virtual Private Cloud (VPC) only after you configure an SNAT entry.

      1. Click Management in the Actions column for the new instance, and on the management page of the target NAT Gateway instance, switch to the SNAT Management tab.

      2. On the SNAT Entry List page, click Create SNAT Entry. The key configurations are as follows:

        Parameter

        Value

        SNAT entry granularity

        Select VPC to ensure that all resource groups within the Internet NAT Gateway's VPC can access the public internet using the configured Elastic IP Address (EIP).

        Select elastic IP address

        Select the Elastic IP Address (EIP) that is associated with the current Internet NAT Gateway instance.

      3. After you configure the SNAT entry parameters, click Create.

      In the SNAT entries list, when the Status of a newly created SNAT entry changes to Enabled, it indicates that the Virtual Private Cloud (VPC) bound to the resource group has gained internet access.

For more information about how to create and use a Serverless resource group, see Use a Serverless resource group.

3. Associate an EMR computing resource

Follow these steps to associate an EMR computing resource with your workspace. This resource provides the necessary compute and storage services.

  1. Go to the DataWorks-Workspace List page and switch the region to China (Shanghai) in the top navigation bar. Find the workspace that you created and click its name to go to the Workspace Details page.

  2. In the left navigation bar, click Computing Resources.

  3. Click Associate Computing Resources, select EMR to open the configuration page.

  4. Configure the following parameters:

    Parameter

    Description

    Alibaba Cloud Account to Which Cluster Belongs

    Select Current Alibaba Cloud Account.

    Cluster Type

    Select Data Lake.

    Cluster

    Select the EMR cluster that you created in the Prepare the EMR environment step.

    Default Access Identity

    The identity used to access the EMR cluster from this workspace.

    • Development environment: Select Cluster Account: hadoop.

    • Production environment: Select Cluster Account: hadoop.

    Pass proxy user information

    Select Do Not Pass.

    Computing Resource Instance Name

    Enter a custom name for the computing resource instance.

  5. Click Confirm.

  6. On the Computing Resources page, find the EMR resource you just associated and click Initialize Resource Group in the upper-right corner to run a connectivity test.

For more information about how to associate a computing resource, see Associate a computing resource with a workspace.

Next steps

Your environment is ready. In the next tutorial, you will synchronize user information and website access logs to OSS, and then create tables in EMR Hive to query this data. For more information, see Synchronize data.

上一篇: Data Studio (new version) tutorial 下一篇: Data synchronization
阿里云首页 大数据开发治理平台 DataWorks 相关技术圈