Solved

Determining GeoLocation Of EC2 Instance

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
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.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

810 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