Skip to content

Instantly share code, notes, and snippets.

@Auronmatrix
Last active June 22, 2020 09:12
Show Gist options
  • Save Auronmatrix/02c708b3a458ddfbdddb340c328fe9cb to your computer and use it in GitHub Desktop.
Save Auronmatrix/02c708b3a458ddfbdddb340c328fe9cb to your computer and use it in GitHub Desktop.
aws cli - Lookup Unknown IP address across all regions
# Sources:
# https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-owner-unknown-ip-addresses/
# https://github.com/aws/aws-cli/issues/1777
for region in $(aws ec2 describe-regions --all-regions --query "Regions[*].RegionName" --output text --profile=<PROFILE>)
do
echo -e "\nLookup IP in region:'$region'..."
aws ec2 describe-network-interfaces --filters Name=association.public-ip,Values=<PUBLIC_IP> --profile=<PROFILE> --region=$region
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment