Skip to content

Instantly share code, notes, and snippets.

View philchristensen's full-sized avatar

Phil Christensen philchristensen

View GitHub Profile
@philchristensen
philchristensen / mdserv
Last active August 29, 2015 14:07 — forked from smoser/mdserv
#!/usr/bin/python
"""
To use this to mimic the EC2 metadata service entirely, run it like:
# where 'eth0' is *some* interface. if i used 'lo:0' i got 5 second or so delays on response.
sudo ifconfig eth0:0 169.254.169.254 netmask 255.255.255.255
sudo ./mdserv 169.254.169.254:80
Then:
wget -q http://169.254.169.254/latest/meta-data/instance-id -O -; echo
curl --silent http://169.254.169.254/latest/meta-data/instance-id ; echo