Flex links is a network switch feature which enables redundancy and load balancing at the layer 2 level. The feature serves as an alternative to Spanning Tree Protocol (STP). A pair of layer 2 interfaces, such as switch ports or port channels has one interface configured as a backup to the other. If the primary link fails, the backup link takes over traffic forwarding.
At any point of time only one interface will be in linkup state and actively forwarding traffic. If the primary link shuts down, the standby link takes up the duty and starts forwarding traffic and becomes the primary link. When the failing link comes back up active, it goes into standby mode and does not participate in traffic forwarding and becomes the backup link. This behaviour can be changed with pre-emption mode which makes the failed link the primary link when it becomes available again.
Load balancing in Flex links work at VLAN level. Both the ports in the Flex link pair can be made to forward traffic simultaneously. One port in the flex links pair can be configured to forward traffic belonging to VLANs 1-50 and the other can forward traffic for VLANs 51-100. Mutually exclusive VLANs are load sharing the traffic between the Flex link pairs. If one of the ports fails, the other active link forwards all the traffic.