STP changing link cost

The STP cost of a particular switch port is determined by the type of port, such as Ethernet, FastEthernet, GigabitEthernet, 10GigabitEthernet and so on. This cost is based on the cost calculation method being used.

This cost however can be modified on individual interfaces in several ways:

  1. By using the spanning-tree cost command in interface mode
  2. By changing the speed parameter of the interface

https://networklessons.com/spanning-tree/spanning-tree-cost-calculation