Solved

Determining GeoLocation Of EC2 Instance

Posted on 2012-03-23
4
1,133 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

The next five years are sure to bring developments that are just astonishing, and we will continue to try to find the balance between connectivity and security. Here are five major technological developments from the last five years and some predict…
In the wake of AWS' S3 outage, we want to discuss the importance of storage and data diversification in the event of a hack, crash, or system disruption. We spoke with Experts Exchange’s COO Gene Richardson for a deeper understanding.
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.
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…

809 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