Skip to content

Instantly share code, notes, and snippets.

@thiagorider
Last active April 14, 2023 13:14
Show Gist options
  • Select an option

  • Save thiagorider/298744106b126aec9b3c2e44e6db1b23 to your computer and use it in GitHub Desktop.

Select an option

Save thiagorider/298744106b126aec9b3c2e44e6db1b23 to your computer and use it in GitHub Desktop.
Get IP

Get IP from your current machine everywhere:

curl https://checkip.amazonaws.com

curl -s https://api.ipify.org -w "\n"""

curl https://icanhazip.com

curl https://ipinfo.io/ip && echo ""

curl ifconfig.me && echo ""

curl https://icanhazip.com

For AWS VMs:

curl http://169.254.169.254/latest/meta-data/public-ipv4 && echo ""

For GCP VMs:

curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment