How instance topology works - Amazon Elastic Compute Cloud

How instance topology works

Every EC2 instance connects to a node set. A node set comprises three network nodes, with each node representing a different layer in the AWS network. The network layers are arranged in a hierarchy of 3 or more layers. The node set provides the top-down view of this hierarchy, with the bottom layer connected closest to an instance.

The information about the node set is called the instance topology.

The following diagram provides a visual representation that you can use to understand the instance topology. The network nodes are identified as NN1NN7. The numerals i, ii, and iii identify the network layers. The numbers 1, 2, 3, and 4 identify the EC2 instances. Instances connect to a node in the bottom layer, identified by iii. More than one instance can connect to the same node.

Graphic representation of the instance topology.

In this example:

  • Instance 1 connects to network node 4 (NN4) in layer iii. NN4 connects to network node 2 (NN2) in layer ii, and NN2 connects to network node 1 (NN1) in layer i, which is the top of the network hierarchy in this example. The network node set comprises NN1, NN2, and NN4, expressed hierarchically from the upper layers to the bottom layer.

  • Instance 2 also connects to network node 4 (NN4). Instance 1 and instance 2 share the same network node set: NN1, NN2, and NN4.

  • Instance 3 connects to network node 5 (NN5). NN5 connects to NN2, and NN2 connects to NN1. The network node set for instance 3 is NN1, NN2, and NN5.

  • Instance 4 connects to network node 6 (NN6). Its network node set is NN1, NN3, and NN6.

When considering the proximity of instances 1, 2, and 3, instances 1 and 2 are closer to each other because they connect to the same network node (NN4), while instance 3 is further away because it connects to a different network node (NN5).

When considering the proximity of all the instances in this diagram, instances 1, 2, and 3 are closer to each other than they are to instance 4 because they share NN2 in their network node set.

As a general rule, if the network node connected to any two instances is the same, these instances are physically close to each other, as is the case with instances 1 and 2. Furthermore, the fewer the number of hops between network nodes, the closer the instances are to each other. For example, instances 1 and 3 have fewer hops to a common network node (NN2) than they have to the network node (NN1) they have in common with instance 4, and are therefore closer to each other than they are to instance 4.

There are no instances running under network node 7 (NN7) in this example, and therefore the API output won't include NN7.

How to interpret the output

You get the instance topology information using the DescribeInstanceTopology API. The output provides a hierarchical view of the underlying network topology for an instance.

The following example output corresponds to the network topology information of the four instances in the preceding diagram. Comments are included in the example output for the purposes of this example.

The following information in the output is important to note:

  • NetworkNodes describes the network node set of an instance.

  • In each network node set, the network nodes are listed in hierarchical order from top to bottom.

  • The network node that is connected to the instance is the last network node in the list (the bottom layer).

  • To work out which instances are close to each other, first find common network nodes in the bottom layer. If there are no common network nodes in the bottom layer, then find common network nodes in the upper layers.

In the following example output, i-1111111111example and i-2222222222example are located closest to each other compared to the other instances in this example because they have the network node nn-4444444444example in common in the bottom layer.

{ "Instances": [ { "InstanceId": "i-1111111111example", //Corresponds to instance 1 "InstanceType": "p4d.24xlarge", "GroupName": "ML-group", "NetworkNodes": [ "nn-1111111111example", //Corresponds to NN1 in layer i "nn-2222222222example", //Corresponds to NN2 in layer ii "nn-4444444444example" //Corresponds to NN4 in layer iii - bottom layer, connected to the instance ], "ZoneId": "usw2-az2", "AvailabilityZone": "us-west-2a" }, { "InstanceId": "i-2222222222example", //Corresponds to instance 2 "InstanceType": "p4d.24xlarge", "NetworkNodes": [ "nn-1111111111example", //Corresponds to NN1 - layer i "nn-2222222222example", //Corresponds to NN2 - layer ii "nn-4444444444example" //Corresponds to NN4 - layer iii - connected to instance ], "ZoneId": "usw2-az2", "AvailabilityZone": "us-west-2a" }, { "InstanceId": "i-3333333333example", //Corresponds to instance 3 "InstanceType": "trn1.32xlarge", "NetworkNodes": [ "nn-1111111111example", //Corresponds to NN1 - layer i "nn-2222222222example", //Corresponds to NN2 - layer ii "nn-5555555555example" //Corresponds to NN5 - layer iii - connected to instance ], "ZoneId": "usw2-az2", "AvailabilityZone": "us-west-2a" }, { "InstanceId": "i-444444444example", //Corresponds to instance 4 "InstanceType": "trn1.2xlarge", "NetworkNodes": [ "nn-1111111111example", //Corresponds to NN1 - layer i "nn-3333333333example", //Corresponds to NN3 - layer ii "nn-6666666666example" //Corresponds to NN6 - layer iii - connected to instance ], "ZoneId": "usw2-az2", "AvailabilityZone": "us-west-2a" } ], "NextToken": "SomeEncryptedToken" }

Limitations

The following limitations apply:

  • The instances must be in the running state.

  • Each instance topology view is unique per account.

  • The AWS Management Console does not support viewing the instance topology.