Last active
June 13, 2024 22:46
-
-
Save kntyskw/5413698 to your computer and use it in GitHub Desktop.
Revisions
-
kntyskw revised this gist
Apr 21, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,4 @@ MY_SUBNET_ID=`curl http://169.254.169.254/latest/meta-data/network/interfaces/ma MY_REGION=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone 2>/dev/null | rev | cut -c 2- | rev` # Get the list of MAC addresses of the ENIs in the same subnet ec2-describe-network-interfaces --region $MY_REGION | grep $MY_SUBNET_ID | grep in-use | grep -v $MY_MAC_ADDR | cut -f 11 | tr "\\n" " " -
kntyskw revised this gist
Apr 18, 2013 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,11 @@ IF=$1 # Gets MAC address of the interface MY_MAC_ADDR=`ip link show $IF | awk '/ether/ {print $2}'` # Get the ID of the subnet that the interface is connected to MY_SUBNET_ID=`curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MY_MAC_ADDR/subnet-id 2> /dev/null` # Get the current region that the instance resides in MY_REGION=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone 2>/dev/null | rev | cut -c 2- | rev` # Get the list of MAC addresses of the ENIs in the same subnet ec2-describe-network-interfaces --region $MY_REGION | grep $MY_SUBNET_ID | grep -v $MY_MAC_ADDR | cut -f 11 | tr "\\n" " " -
kntyskw created this gist
Apr 18, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/sh IF=$1 # Gets MAC address of the interface MY_MAC_ADDR=`ip link show $IF | awk '/ether/ {print $2}'` # Get subnet ID MY_SUBNET_ID=`curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MY_MAC_ADDR/subnet-id 2> /dev/null` MY_REGION=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone 2>/dev/null | rev | cut -c 2- | rev` ec2-describe-network-interfaces --region $MY_REGION | grep $MY_SUBNET_ID | grep -v $MY_MAC_ADDR | cut -f 11 | tr "\\n" " "