tag:blogger.com,1999:blog-55710384554873736322024-03-14T12:03:53.699+01:0001infinitygetting IT doneRuven Oberländerhttp://www.blogger.com/profile/05897465205493722805noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5571038455487373632.post-7920119664128462462013-07-14T14:00:00.002+02:002013-07-14T14:46:37.149+02:00Need to pull out all EC2 properties from AWS management console? <h2>
Doing an EC2 Inventory the funny way</h2>
This script can help you to pull out all EC2 instances with all their properties.<br />
Use the outputed csv as a jumpstart for inventory or documentation.<br />
<div>
<br/>
<h3>
How does it work?</h3>
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. <BR/>
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.<BR/>
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). <BR/>
Finally I push the data with a csv converter as new "download" (line 14)<br />
<br />
<script type="syntaxhighlighter" class="brush: js"><![CDATA[
var jquerySelector = "#instances_datatable_hook > div:nth-child(3) "
var columns = $(jquerySelector + 'thead th').map(function() {
return $(this).text();
});
var tableObject = $(jquerySelector + 'tbody tr').map(function(i) {
var row = {};
$(this).find('td').each(function(i) {
row[columns[i]] = $(this).text();
});
return row;
}).get();
var csvData = escape(JSON2CSV(columns, tableObject));
window.open("data:text/csv;charset=utf-8," + csvData);
]]></script>
<br />
<div>
Find the full snippet here: <a href="https://gist.github.com/01infinity/5993641">https://gist.github.com/01infinity/5993641</a><br />
<br/>
<h3>
Instructions: </h3>
</div>
<div>
<ul>
<li>Navigate the region you want to extract, e.g. https://console.aws.amazon.com/ec2/v2/home?region=eu-west-1, wait for the main table to be loaded</li>
<li>Launch script in javascript console (or maybe create a scriptlet?)</li>
<li>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)</li>
</ul>
</div>
<div>
<br/>
<h3>
Credits: </h3>
</div>
<div>
<ul>
<li>http://encosia.com/use-jquery-to-extract-data-from-html-lists-and-tables/ </li>
<li>http://jsfiddle.net/sturtevant/vUnF9/</li>
</ul>
<br /></div>
</div>Ruven Oberländerhttp://www.blogger.com/profile/05897465205493722805noreply@blogger.com0tag:blogger.com,1999:blog-5571038455487373632.post-87654154439697906212008-11-05T10:45:00.007+01:002011-12-26T06:59:26.586+01:00What kept me busy the last months<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrC2yF11E-4Bmsw7Z80rryPfSrWUXDcNszC1DuOL97wgygdvJZuOSmuiwrM6JPPv63JiOLLOOpeRwzUMtWbK6Ic7wPFn8DBJvOum8KH-loorKziAJpn8tFsmlrJFqsWXxDKRlekNCQIVxV/s1600-h/stockfox_xs.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5265108461430507042" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrC2yF11E-4Bmsw7Z80rryPfSrWUXDcNszC1DuOL97wgygdvJZuOSmuiwrM6JPPv63JiOLLOOpeRwzUMtWbK6Ic7wPFn8DBJvOum8KH-loorKziAJpn8tFsmlrJFqsWXxDKRlekNCQIVxV/s200/stockfox_xs.png" style="cursor: hand; cursor: pointer; float: right; height: 200px; margin: 0 0 10px 10px; width: 200px;" /></a><br />
<div>
I proudly present you the "Stock Pilot", a tool for simplifying research on stocks.</div>
<div>
This is what happens when a programmer shows interest in stock research ;)</div>
<div>
I developed it out of my observation that researching stocks takes too many user interactions,</div>
<div>
and that bookmarking finance portals is not very helpful in getting arranged with all those </div>
<div>
pages and companies.</div>
<div>
<br /></div>
<div>
The addon covers the 5.000 largest US stocks, very soon up to 10.000 stocks will be supported. Working samples and the actual coverage can be accessed here:</div>
<div>
<a href="http://twoiq.s3.amazonaws.com/testedstocks.html">http://twoiq.s3.amazonaws.com/testedstocks.html</a></div>
<div>
<br /></div>
<div>
The technical background is very interesting and features different technologies:</div>
<ul>
<li>Firefox Add-On for recognising the finance portal and the "context" of researched company (Boris Ruf did an excellent job implementing this part, please also check out his awesome "FootieFox" add-on, which provides Soccer scores for over 200 leagues and cups of 60 countries - live and almost instantly: <a href="http://www.footiefox.com/">http://www.footiefox.com</a></li>
<li>Web-Crawling Agents for retrieving the neccessary mappings</li>
<li>Amazon S3 for providing reliable storage</li>
</ul>
<div>
Please download it here</div>
<div>
<a href="https://addons.mozilla.org/de/firefox/addon/9475">https://addons.mozilla.org/de/firefox/addon/9475</a></div>
<div>
<br /></div>
<div>
If you like it, then vote on addons.mozilla.org - if not let me hear about your experiences, maybe I can help by improving...</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>Ruven Oberländerhttp://www.blogger.com/profile/05897465205493722805noreply@blogger.com1