edit-icon download-icon

Using Visual Editor to edit stack templates

Last Updated: Apr 17, 2018

Resource Orchestration Service (ROS) console provides a tool called Visual Editor to help you edit resource stack templates visually with higher efficiency. With a drag-and-drop interface, Visual Editor makes relationships among resources clear and presents the editing process of cloud resources visually. Using convenient forms to customize resources frees you from the complex syntactical rules and error-prone text format. Meanwhile, Visual Editor can visualize resource stacks, sort out the dependencies among resources, and present a unified view of IT resources.

This document gives an example of how to create a highly available scenario templates with Visual Editor: a Server Load Balancer instance mounts a VPC, a VSwitch, a security group, and an ECS group (with several ECS instances), and the listener ports of Server Load Balancer are ports 443 and 80.

When creating the template, see Resource Type in the ROS console for parameters.

  1. Log on to the ROS console, and click Visual Editor from the left-side navigation pane.

    <alt>Visual Editior

    Visual Editor page

    Visual Editor

  2. Enter the template description.

    Enter the description of the template function, purpose, and so on.

    <alt>Visual Editor

  3. Add parameters.

    Click ⊕ Add new property item and the edit icon to add the following parameters:

    • Image ID

      • Parameter Name: AppEcsImageId
      • Parameter Type: String
      • Parameter Default: ubuntu_14

      Visual Editor

    • Instance type

      • Parameter Name: AppEcsInstanceType
      • Specify default and optional values.

      Visual Editor

    • Database name

      • Validation Expression: [a-z]{1}[a-z0-9-_]*[a-z0-9]{1}
      • Maximal Length: 64
      • Minimal Length: 2
      • Description: The name of app database
      • Prompt: Consist of 2 to 64 characters, containing only lowercase letters, hyphens (-), and underscores (_). It must begin with a letter and end with a letter or number.

      Visual Editor4

    • ECS instance password

      • Output: Check the box to enable.
      • Form Label: InstancePassword

      Visual Editor5

    • The number of ECS instances

      • Data Type: Number
      • Maximum Value: 5
      • Minimum Value: 1

      Visual Editor6

      Add other ECS information and database information, such as:

    • RDS instance type
    • RDS capacity
    • RDS password
    • RDS username

      Visual Editor

  4. Create resources.

    Resource creation method: Find the resources in the resource list, drag them into the canvas, and specify the properties.

    • Create a VPC.

      Drag a VPC to the canvas. Click the VPC icon, and its information is displayed under Resource Property on the right side. You can change the resource ID and its CIDR block.

      <ALT>VPC

    • Create a VSwitch.

      Since VSwitch relies on the VPC, it must be dragged into the VPC. Click the VSwitch icon in the canvas, and its resource properties are displayed on the right side.

      VSwitch
      • Specify Vpcld with the Ref function.

        VPCID

      • Specify ZoneId in JSON format. It must strictly conform to the JSON format.

        ZoneId

    • Create a SecurityGroup.

      Since the existence of a SecurityGroup depends on the VPC, it must be dragged into the VPC. Click the SecurityGroup icon in the canvas, and its resource properties are displayed on the right side.

      securitygroup

      • Create a SecurityGroupEgress.

        Egress

      • Create two SecurityGroupIngress.

        Set the PortRange of the first SecurityGroupIngress as 443/443.

        Set the PortRange of the second SecurityGroupIngress as 80/80.

        Ingress

    • Create an InstanceGroup.

      Find InstanceGroup in the left list, and drag it into the VPC. Click the InstanceGroup icon in the canvas, and its resource properties are displayed on the right side.

      InstanceGroup

      Edit the resource properties:

      • SystemDiskCategory: cloud_ss
      • IoOptimized: optimized
      • InternetChargeType: PayByTraffic
      • ImageId: Click Ref to reference the parameter AppEcsImageId.
      • Password: Click Ref to reference the parameter InstancePassword.
      • InstanceType: Click Ref to reference the parameter AppEcsInstanceType.
      • NetworkType: VPC

    • Create a DBInstance.

      Find DBInstance in the left list, and drag it into the VPC. Click the DBInstance icon in the canvas, and its resource properties are displayed on the right side.

      DBInstance

      Edit the resource properties:

      • Engine: MySQL
      • MultiZA: false
      • DBMappings: Add and edit CharacterSetName as utf8, DBName as myapp.
      • DBInstanceClass: Click Ref to reference the parameter DBInstanceClass.
      • MasterUserPassword: Click Ref to reference the parameter DBPassword.
      • DBInstanceNetType: intranet
      • DBInstanceStorage: 50
      • EngineVersion: 5.6
      • PreferredBackupTime: 23:00Z-24:00Z
      • PreferredBackupPeriod: Monday, Wednesday

    • Create a LoadBalancer.

      Find LoadBalancer in the left list, then drag it into the canvas. Click the LoadBalancer icon in the canvas, and its resource properties are displayed on the right side.

      LoadBalancer

      • Bandwidth: 200
      • AddressType: internet

    • Add two SLB listeners.

      Find Listener in the left list, and drag two Listeners into the canvas. Click the Listener icons in the canvas and their resource properties are displayed on the right side.

      Drag the lines to build the dependent relationships between the Listeners and the LoadBalancer.

      listeners

      Edit the resource properties of the two listeners:
      • Protocol: tcp
      • BackendServerPort: 80 or 443 (the backend server port for the first listener is 80, and that for the second listener is 443.)
      • ListenerPort: 80 or 443 (the first listener port is 80, and the second listener port is 443.)
      • Bandwidth: -1
      • HealthCheck: as shown in the following picture

        HealthCheck

      • Persistence: as shown in the following picture

        Persistence

    • Create a BackendServerAttachment.

      Find BackendServerAttachment in the left-side navigation pane, and drag it into the canvas.

      Drag a line to build the dependent relationship between the BackendServerAttachment and the LoadBalancer.

      Click the BackendServerAttachment icon in the canvas, and its resource properties are displayed on the right side.

      BackendServerList

      • BackendServerList: Click the JSON button, and select FnGetAttr as the Data Type.

      • LoadBalancerId: Click Ref to reference ALIYUN-SLB-LoadBalancer1.

  5. Add output items.

    Click the blank area in the canvas, and the right column title turns to be Resource Orchestration Template. Click ⊕ Add new property item under Output, click edit, and add the following output items one by one:

    • AppEcsLoadBalancerIp

    • DatabaseInnerConnString

    • DatabaseInnerPort

      Output

  6. Save the template.

    Click Save Template in the top menu to go to the Create Template page. Enter the template title and description, and click Create.

    Create

You can see the created template on the My Template page.

Thank you! We've received your feedback.