All Products
Search
Document Center

CloudFlow:Create a flow

Last Updated:Oct 30, 2023

This topic describes how to create a flow to call Function Compute. The flow contains one task step.

Prerequisites

A function is created and the Alibaba Cloud Resource Name (ARN) of the function is obtained.

Procedure

The Create Flow with Code method is used in this example.

  1. Log on to the Serverless Workflow console.
  2. In the top navigation bar, select a region.
    Important You must select the region where the function is created.
  3. On the Flows page, click Create Flow.
  4. On the Create Flow page, click Create Flow with Code and configure the parameters.
    image1
    Note You can also use the Hello World and Sample Projects methods to create a flow. However, if you use one of these methods to create a flow, you cannot modify Definition.
    • Name: Enter a custom flow name. The name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It cannot start with an underscore (_) or a hyphen (-).
    • Description (Optional): Enter a description for the flow.
    • Definition: Follow the visual process to configure a flow definition.

    You must change the content in the YAML file of Definition to the following code:

    version: v1
    type: flow
    steps:
      - type: task
        name: hello
        resourceArn: acs:fc:{region}:{accountID}:services/{serviceName}/functions/{functionName}
    The following table describes the parameters that are included in the YAML file.
    ParameterDescription
    versionThe version of the flow. Only v1 is supported.
    typeThe type of the flow. Default value: flow.
    stepsThe steps of the flow.
    typeThe type of the steps. task: The task type. For the step types of other parameters, see Overview.
    nameThe name of the step. You can customize a step name.
    resourceArnThe cloud service to be integrated.
    • You can view the ARN in the created function and copy the ARN for use. For more information, see Obtain the ARN of a function.
    • You can also replace {region}, {accountID}, {serviceName}, and {functionName} with the region, account ID, service name, and name of the created function. Example: acs:fc:cn-shanghai:18807708****3420:services/demo/functions/test.
  5. Click Next Step.
  6. Configure a flow role.
    Note If other cloud services such as Function Compute must be called in your flow, you can configure a flow role in the Config Flow Role section to grant Serverless workflow the permissions to call Function Compute. For more information, see Create execution roles.
    • If RAM roles exist, you can click Select an existing RAM role.
    • If you use Serverless workflow for the first time, you can create a RAM role by performing the following operations:

      1. In the Config Flow Role section, click Create a RAM role. Enter a value in the Role Name field.
      2. Select AliyunFCInvocationAccess from the System Policies drop-down list and click Create Role.create_flow_step2
      3. On the Role Templates page, click Confirm Authorization Policy.create_flow_step3
  7. On the Create Flow page, click Create Flow.

    After the flow is created, the following page is displayed.

    image3

Notes

In addition to the Serverless Workflow console, you can also call the CreateFlow operation to create a flow. For more information, see CreateFlow.

What to do next

Execute a flow