Solved

Determining GeoLocation Of EC2 Instance

Posted on 2012-03-23
4
1,103 Views
Last Modified: 2014-11-12
We've few Amazon EC2 instances running in different regions. All instances are assigned with elastic IP addresses. We could remote into them using these IPs with no issues.

When we do an IP lookup (IP2Location.com for example) the results show same location, that is "Seattle, WA, US" despite the fact that these instances are running two different regions (East & West).

Tracert is not really helping much as to determining the locations of our instances. Question is how do we determine the location of EC2 instance with the help of elastic ip addresses?
0
Comment
Question by:ExcUsr2008
  • 2
  • 2
4 Comments
 
LVL 33

Expert Comment

by:shalomc
ID: 37760774
An EC2 instance has both a private (10.x.x.x) address and a public address. If you use an elastic IP, then you obfuscate the real IP and can't use it anymore.

However,  the server name still contains the original IP information and you can parse it out and use it.

For exaple, the server name is ec2-184-73-34-208.compute-1.amazonaws.com
This means that regardless of any elastic IP assigned to it, the original IP was 184.73.34.208

This information can now be used in a geolocation api.
0
 

Author Comment

by:ExcUsr2008
ID: 37762648
Thanks for your response.

Here are some links talk about the very same issue we are having ...

https://forums.aws.amazon.com/thread.jspa?messageID=251101

https://forums.aws.amazon.com/thread.jspa?messageID=330363&tstart=0

We understand that EC2 instances get private and public IPs by default as they are launched and between stop/start events. We could trace default public IP/DNS to its expected geolocation. It's all good.

But when we assign EIP to the instance its public DNS (server name) no longer includes it's original (default) public IP. It shows EIP only in the public DNS. Thus loosing default public IP ... So you're correct the EIP is making it harder to reveal instance geo location, but the question is how to figure the location while EIP is assigned.

Our main concern is that ... let's say we're running an instance (EC2) in US East based on our audience geolocation. Now, once we assign EIP the traceroute shows that the request goes to US West (always) ... would not that mean it defeats the purpose of running instances in different geolocations?

Something is not right ... I will leave this thread open for some more light... may be we will end up with opening a case w/ AWS.

Thanks again, you will get partial points if not all...
0
 
LVL 33

Accepted Solution

by:
shalomc earned 500 total points
ID: 37765377
My initial post was not correct, but that used to be the behavior in the past :(

traceroute cannot be trusted to reflect the destination, and having and eastern IP for a western server only means that the traffic probably flows by default thru eastern routers.

You can extract the geolocation from the instance metadata.
curl http://169.254.169.254/latest/meta-data/placement/availability-zone/ 

Open in new window

See a full reference here
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html
0
 

Author Closing Comment

by:ExcUsr2008
ID: 37767528
Thanks for the clarifications!
0

Featured Post

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now