Nodes

Node is a second object representing a node or system component.

Basic

Node is an abstract concept that represents a single system component object.

A node object consists of three parts: provider, resource type and name. You may already have seen each part in the previous example.

EC2("web")

In above example, the EC2 is a node of compute resource type which provided by aws provider.

Data Flow

You can represent data flow by connecting the nodes with these operators: >>, << and -.

  • Connect nodes in left to right direction. (Use '>>')
  • Connect nodes in right to left direction. (Use '<<')
  • Connect nodes with no direction (undirected). (Use '-')
ELB("loadbalancer") >> EC2("web") >> awsRDS("userdb") >> S3("store")
ELB("loadbalancer") >> EC2("web") >> awsRDS("userdb") << EC2("stat")
(ELB("loadbalancer") >> EC2("web")) - EC2("web") >> awsRDS("userdb")

Be careful when using the - and any shift operators together, which could cause unexpected results due to operator precedence.

Diagram1

The order of rendered diagrams is the reverse of the declaration order.

You can change the data flow direction with direction parameter. Default is LR.

(TB, BT, LR and RL) are allowed.

lb = ELB("loadbalancer")
db = awsRDS("events")
lb >> EC2("worker1") >> db
lb >> EC2("worker2") >> db
lb >> EC2("worker3") >> db
lb >> EC2("worker4") >> db
lb >> EC2("worker5") >> db

Diagram2

Group Data Flow

Above worker example has too many redundant flows. In this case, you can group nodes into a list so that all nodes are connected to other nodes at once.

ELB("loadbalancer") >> [EC2("worker1"),
              EC2("worker2"),
              EC2("worker3"),
              EC2("worker4"),
              EC2("worker5")] >> awsRDS("events")

Diagram3

You can't connect two lists directly because shift/arithmetic operations between lists are not allowed in Python.