This topic describes how to create a flow in the Serverless Workflow console or by using Alibaba Cloud CLI.
Create a flow in the console
- Log on to the Serverless Workflow console.
- On the Flows page, click Create Flow.
- On the Create Flow page, set Name and Definition. You can also use visual flows to assist in writing flow definitions.
The Serverless Workflow console provides a default flow definition. The following YAML text-defined flow contains a pass step (
pass1
). For more information about flow definitions, see Flow Definition Language.version: v1 type: flow steps: - type: pass name: pass1
- Click Next Step.
- In the Flow Role field, enter the Alibaba Cloud Resource Name (ARN) of the Resource Access Management (RAM) role created in Create execution roles. This role grants Serverless Workflow access to your cloud service resources, such as Function Compute. This example flow does not access other cloud services such as Function Compute. Therefore, you can leave the Flow Role field blank.
- Click Create Flow.
Create a flow by using Alibaba Cloud CLI
Before you use Alibaba Cloud CLI to create a flow, you must install this tool. For more information, see Installation Guide and Configure Alibaba Cloud CLI.
# Help
$ aliyun fnf CreateFlow help
Alibaba Cloud CLI 3.0.12
Product: fnf (Serverless Workflow)
Parameters:
--Definition String Required
--Description String Required
--Name String Required
--RoleArn String Optional
--Type String Required
--RequestID String Optional
You can use the CreateFlow command to create a flow.
- Prepare for creating a flow. You can store the following flow definition in a file in the current path.
version: v1 type: flow steps: - type: pass name: pass1
- Create a flow.Important You must replace
RoleArn
in the following content with your flow role. For more information about flow roles, see Execution roles.$ aliyun fnf CreateFlow --Description "demo" --Type FDL --RoleArn acs:ram::xxx:xxx --Name cli_guide_1 --Definition "$(<./flow.yaml)" # Command execution result { "Name": "cli_guide_1", "Description": "demo", "Definition": "version: v1beta1\ntype: flow\nsteps:\n - type: pass\n name: pass1", "Id": "78c68342-d63b-4cb5-9207-4e44eeb7e632", "Type": "FDL", "RoleArn": "acs:ram::xxx:xxx", "CreatedTime": "2019-05-13T05:59:51.762Z", "LastModifiedTime": "2019-05-13T05:59:51.762Z", "RequestId": "xxxx" }