DEV Community

Mohammad Waseem Akhtar
Mohammad Waseem Akhtar

Posted on

How to find my public IP?

Hello all, This is my first post.

At times in order to gain access(say SSH) to the AWS EC2 instance, I need to specify a proper rule in the AWS SG(Security group) attached to the AWS account. This rule can't be wide open to all and hence need to be specific because of the IT security policies at my company.

For which I am interested to know my public IP, which is the IP address assigned by my internet service provider to that interface which is public facing in my router.

One of the easiest way to know that is to open the terminal and execute curl ipinfo.io

~ » curl ipinfo.io                                                                                                                                                                                                                  wmohamma@PEM-WMOHAMMA-01
{
  "ip": "28.34.157.23",
  "hostname": "c-24-4-158-230.hsd1.cy.xyz.net",
  "city": "Los Angeles",
  "region": "California",
  "country": "US",
  "loc": "381.3396,-162.011",
  "org": "AS1351 xyz",
  "postal": "96742",
  "timezone": "America/Los_Angeles",
  "readme": "https://ipinfo.io/missingauth"
}% 
Enter fullscreen mode Exit fullscreen mode

Peace !!

Top comments (0)