public static List < NetworkInterface > getNetworkInterfaces ( ) { List < NetworkInterface > networkInterfaces = new LinkedList < NetworkInterface > ( ) ; List < String > macs = getItems ( EC2_METADATA_ROOT + "/network/interfaces/macs/" ) ; if ( macs != null ) { for ( String mac : macs ) { String key = mac . trim ( ) ; if ( key . endsWith ( "/" ) ) { key = key . substring ( 0 , key . length ( ) - 1 ) ; } networkInterfaces . add ( new NetworkInterface ( key ) ) ; } } return networkInterfaces ; }
Get the list of network interfaces on the instance .