AWS EC2 Metadata Simulator

There is a new project on GitHub that is an EC2 metadata simulator. The project allows for testing applications that depend on EC2 instance metadata in non-AWS environments. It doesn’t (yet) provide complete simulation of all EC2 metadata endpoints but in time it will and in the mean time it should be simple enough to modify to fit your needs.

One important note, the EC2 instance metadata listens on port 80. The simulator will run on your localhost at port 8080 by default. The result of this command will not persist across system restarts, but you can redirect traffic from to localhost:8080 using iptables:

iptables -t nat -A OUTPUT -p tcp -d --dport 80 -j DNAT --to-destination

Now, all requests to will get redirected to the simulator running at http://localhost:8080.

EC2 instance metadata provides useful information to instances running in EC2. Using a simple curl command like the one below to find the instance’s ID you can retrieve information about the running instance.




Notify of
Inline Feedbacks
View all comments