This topic describes how to use Aliyun Serverless VSCode Extension to create a template.

Background information

Aliyun Serverless VSCode Extension provides syntax prompts for ROS template files. It also allows you to develop and debug Function Compute functions on your local PC. For more information, see serverless-vscode. You must install Visual Studio Code to use Aliyun Serverless VSCode Extension.

Syntax prompts:
  • Automatic completion: Resource property configurations in a template file are completed automatically according to prompts provided based on the indentation level.
  • Schema validation: All resource configurations in a template file are validated based on the specifications in Serverless Application Model.
  • Hovering prompts: Context-sensitive help is provided for all resource configurations in a template file. When you move the pointer over a resource key, property information such as the property name, type, and document URL is displayed.

Step 1: Install the extension

  1. Open VS Code and press Ctrl+Shift+X to go to the extension marketplace.
  2. Search for Aliyun Serverless and install it.
  3. Restart VS Code.

    When the ALIYUN:FUNCTION COMPUTE icon is displayed in the left-side activity bar, the extension is installed.

Step 2: Bind an Alibaba Cloud account

  2. Click Bind New Account under the REMOTE RESOURCES option. In the text box that appears, enter the account ID, AccessKey ID, AccessKey secret, and local name of the account in sequence.

    After you enter the information, the name and region appear in the lower-left corner, which indicates that the account is bound.

Step 3: Create a template

  1. Open a folder in VS Code, and Aliyun Serverless VSCode Extension is still in the inactive state. Click the ALIYUN:FUNCTION COMPUTE icon to activate it.
  2. Create a template.yml file.
  3. Enter ros in the first line, and press the Enter key twice. The system prompts you for the required parameters.
  4. Enter keywords of a resource type under Resources, and then a list of related resources is provided.

    For example, if you enter ECS, all resources related to ECS appear. After you select a resource type, a schema is generated. When you move the pointer over Properties, all properties and data types of the resource type appear.

    Note You can search for the names of properties by fuzzy match. When required properties are missing, alerts are triggered for Properties, and prompts appear in the console.