This topic describes how to create an app in App Studio and deploy it in the production environment to make it accessible through the Internet.

Go to App Studio

Create a project

  1. Log on to the DataWorks console and click Go to Data Development next to a workspace.
  2. Click the icon in the upper-left corner and hover the cursor over All products. Choose App Development > App Studio.
  3. On the App Studio page, create a template-based or code-based project or import a project from Git.
  4. Set project parameters as needed and click Submit.

Associate your project with Git

Before publishing an app, you need to initialize Git.

  1. Create a repo on code.aliyun.com and take down the SSH URL of the repo.
  2. Go to App Studio and click Version. Select Connect to Remote Repo.
  3. In the Connect to Remote Repo dialog box that appears, set parameters and click Submit.
    Note If you have not bound an SSH key or Git email address, follow the instructions on the page.

Publish the app

After associating your project with Git, you can create an app through Publish New Version.

  1. Return to the Projects page and click Manage on the project card.
  2. On the project management page that appears, click Publish New Version in the upper-right corner. In the dialog box that appears, select the app for which a new version needs to be published.
  3. Click Publish.

Deploy the app

  1. After you click Publish, a guide page appears, as shown in the following figure.

    Go to the purchase page and purchase an App Studio workspace. Go to App Studio, create an ECS group, and then add the purchased ECS instance to the ECS group.

  2. Click Purchase Link. On the page that appears, follow the instructions to purchase an App Studio workspace in your specified region.
  3. Click Manage Deployment on the app card to go to the app O&M page.
    Note You need to unbind the host bound previously.
  4. Click Create ECS Group in the upper-right corner of the ECS Group List area and create an ECS group.
  5. Choose Actions > Expand capacity. In the dialog box that appears, add the ECS instance you just purchased to the newly created ECS group.
  6. After the Apps page is refreshed, click Publish to publish the app to the default ECS group.

    The app has been deployed on your ECS instance and started to provide services.

Perform VPC deployment

VPC deployment refers to adding a VPC to the CIDR block of your purchased ECS instance. You need to perform VPC deployment for each project on Alibaba Cloud and App Studio. However, you need to perform this operation only once for each project. When there is an iterative version, you only need to deploy the app. For more information, see the preceding section.

Authorize VPC access

An ECS instance used for publishing apps in App Studio connects to your VPC through an ENI. You need to grant your service account of App Studio the permission to manage ENIs.

  1. Go to the RAM Roles page and click Create RAM Role. Select Alibaba Cloud Account and click Next. Select Other Alibaba Cloud Account and enter 1591568227964362. Enter a custom name in RAM Role Name and click OK.
    Note You must enter 1591568227964362 in Other Alibaba Cloud Account.
  2. Click Add permissions for the newly created RAM role in the Actions column. Grant the RAM role the AliyunECSNetworkInterfaceManagement permission to manage ENIs. Then, click OK.
  3. Click the RAM role and view the ARN.

Create a VPC and a VSwitch

You must create a VPC and a VSwitch in the region to which your App Studio workspace belongs. Here, China (Shanghai) is used as example.

Log on to the VPC console and create a VPC. For more information, see Create an IPv4 VPC.

Note The IPv4 CIDR block of the VPC must be different from the CIDR block selected before the app is deployed.

After the VSwitch is created, take down the VSwitch ID on the VSwitch page for later use.

Create a security group

Log on to the ECS console and create a security group. For more information, see Create a security group.

After the security group is created, take down the security group ID for later use.

Add the VPC in App Studio

  1. Click O&M in the upper-right corner of the App Studio page.
  2. Choose Resource > VPC and click Add VPC.
  3. In the Add VPC dialog box that appears, enter the recorded ARN, security group ID, and VSwitch ID in Role ID, Security Group ID, and VSwitch ID, respectively. Provide a brief description of your operation.
  4. Click Run.

Create an ENI and associate it with an ECS instance

  1. Click the ID of your VPC to go to the ENI management page.
  2. Click Add ENI.
  3. After the ENI is added, click Associate with ECS instance.
  4. In the Associate with ECS instance dialog box that appears, set VpcID, EniID, ECS Group, and ECS Instance.

After the preceding operations are performed, App Studio creates an ENI for you and associates it with the specified ECS instance.

Enable access from the Internet

Next, you can associate the ENI with an elastic IP address to expose the app to the Internet. You can also enable SLB in this procedure.

The procedure for associating the ENI with an elastic IP address is as follows:

  1. Log on to the VPC console and purchase an elastic IP address. For more information, see Create an Elastic IP address.
  2. Associate the ENI with the elastic IP address. For more information, see Overview.
  3. After the preceding operations are performed, your app can be accessed through the Internet.