Sunday, July 14, 2013

Need to pull out all EC2 properties from AWS management console?

Doing an EC2 Inventory the funny way

This script can help you to pull out all EC2 instances with all their properties.
Use the outputed csv as a jumpstart for inventory or documentation.

How does it work?

When you log in to your AWS account all information regarding your instances is loaded into a table on the clientside, some of them are displayed - depending on your configuration.
Amazon has right now no export available to process EC2 properties (for example in a spreadsheet). Simple copy&paste from webpage to a spreadsheet has failed for me.
Luckily its very easy to grab the information with some javascript. Clientside Web scraping is very easy with JQuery, see below how I extract the column names (line 1-3) and later the values (6-12).
Finally I push the data with a csv converter as new "download" (line 14)

Find the full snippet here:


  • Navigate the region you want to extract, e.g., wait for the main table to be loaded
  • Launch script in javascript console (or maybe create a scriptlet?)
  • CSV will be "downloaded" immediately, containing all columns (very useful to have them really all, usually only a few one will be configured to be displayed in the view)