Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

get_instance_metadata() slow to return on local machine #1826

rajbala opened this Issue Oct 29, 2013 · 1 comment


None yet
2 participants

rajbala commented Oct 29, 2013

When I call get_instance_metadata() on my local development machine it returns very slowly, but returns very fast when I run it on EC2. Sometimes it takes a few minutes to return locally.

Is there something I could do to make it return faster?

I'm using Ubuntu 12.10 x64 and Python 2.7.3. Here's how I am calling it. I've also tried to call it with no parameters with the same result.

im = get_instance_metadata(version='latest', url='')


danielgtaylor commented Nov 16, 2013

Unless you have a metadata and user data service running in your development environment, it's likely that what you are seeing is a timeout. The address is a special private address that is not to be routed. Inside of EC2 it goes to a special local server and returns metadata almost instantly, but outside of EC2 it's likely to go nowhere. There is more information here:


If you must do the requests locally then it might be possible to setup an iptables route to send traffic localhost, which would prevent the timeout and return immediately (returning a failure if nothing is listening on port 80). Alternatively you could skip or mock that method when running locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment