Solved

Determining GeoLocation Of EC2 Instance

Posted on 2012-03-23
4
1,142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Surfing Is Meant To Be Done Outdoors

Featuring its rugged IP67 compliant exterior and delivering broad, fast, and reliable Wi-Fi coverage, the AP322 is the ideal solution for the outdoors. Manage this AP with either a Firebox as a gateway controller, or with the Wi-Fi Cloud for an expanded set of management features

Question has a verified solution.

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

Suggested Solutions

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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…

726 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