Solved

Determining GeoLocation Of EC2 Instance

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

Expert Comment

by:shalomc
Comment Utility
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
Comment Utility
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 32

Accepted Solution

by:
shalomc earned 500 total points
Comment Utility
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
Comment Utility
Thanks for the clarifications!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Moving your enterprise fax infrastructure from in-house fax machines and servers to the cloud makes sense — from both an efficiency and productivity standpoint. But does migrating to a cloud fax solution mean you will no longer be able to send or re…
When the confidentiality and security of your data is a must, trust the highly encrypted cloud fax portfolio used by 12 million businesses worldwide, including nearly half of the Fortune 500.
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.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

772 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

10 Experts available now in Live!

Get 1:1 Help Now