<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Life Scaling &#187; Old</title>
	<atom:link href="http://orensol.com/tag/old/feed/" rel="self" type="application/rss+xml" />
	<link>http://orensol.com</link>
	<description>Oren Solomianik's Blog</description>
	<lastBuildDate>Mon, 21 Jun 2010 08:10:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to delete those old EC2 EBS snapshots</title>
		<link>http://orensol.com/2009/02/12/how-to-delete-those-old-ec2-ebs-snapshots/</link>
		<comments>http://orensol.com/2009/02/12/how-to-delete-those-old-ec2-ebs-snapshots/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 17:57:44 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[Scaling]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Bulk]]></category>
		<category><![CDATA[Delete]]></category>
		<category><![CDATA[EBS]]></category>
		<category><![CDATA[Multiple]]></category>
		<category><![CDATA[Old]]></category>
		<category><![CDATA[Snapshots]]></category>

		<guid isPermaLink="false">http://orensol.com/?p=104</guid>
		<description><![CDATA[<p><a href="http://aws.amazon.com/ebs/" target="_blank">EBS snapshots</a> are a very powerful feature of <a href="http://aws.amazon.com/ec2/" target="_blank">Amazon EC2</a>. An EBS volume is readily available, elastic block storage device that can be attached, detached and re-attached to any instance in its availability zone. There are <a href="http://blog.rightscale.com/2008/08/20/amazon-ebs-explained/" target="_blank">numerous advantages</a> to using EBS over the local block storage devices of an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://aws.amazon.com/ebs/" target="_blank">EBS snapshots</a> are a very powerful feature of <a href="http://aws.amazon.com/ec2/" target="_blank">Amazon EC2</a>. An EBS volume is readily available, elastic block storage device that can be attached, detached and re-attached to any instance in its availability zone. There are <a href="http://blog.rightscale.com/2008/08/20/amazon-ebs-explained/" target="_blank">numerous advantages</a> to using EBS over the local block storage devices of an instance, and one of the most important of them is the ability to take a snapshot of the data on the volume.</p>
<p>Since snapshots are incremental by nature, after an initial snapshot of a volume, the following snapshots are quick and easy. Moreover, snapshots are always processed by Amazon&#8217;s processing power and not by the cpu of your instance, and are stored redundantly on S3. This is why using these snapshots in your backup methodology is a great idea (provided that you freeze/unfreeze your filesystem during the snapshot call, using <a href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)" target="_blank">LVM</a> or <a href="http://en.wikipedia.org/wiki/XFS" target="_blank">XFS</a> for example).</p>
<p>But, and this is a really annoying but &#8211; snapshots are &#8220;easy come hard to go&#8221;. They are so convenient to use and so reliable, that it&#8217;s natural to use a cronned script to make a daily, or hell &#8212; hourly! &#8212; backup of your volume. But then, those snapshots keep piling up, and the only way to delete a snapshot is to call a single API call for a specific snapshot.If you have 5 volumes you back up hourly, you reach the 500 snapshots limit withing 4.5 days. Not very reliable now, huh?</p>
<p>I have been searching for a while for an option to bulk delete snapshots. The EC2 API is missing this feature, and the excellent <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609" target="_blank">ElasticFox</a> add-on is not compensating. You just can&#8217;t bulk delete snapshots.</p>
<p>That is, until now <img src='http://orensol.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I <a href="http://developer.amazonwebservices.com/connect/thread.jspa?messageID=116355" target="_blank">asked</a> in the AWS Forum if there is anything that can be done about this problem. They replied it&#8217;s a good idea, but if I really wanted it to be implemented quickly, I should build my own solution using the API. So I took the offer, and came up with a PHP command line tool that tries to emulate a &#8220;ec2-delete-old-snapshots&#8221; command, until one is added to the API.</p>
<p>The tool is <a href="http://code.google.com/p/ec2-delete-old-snapshots/" target="_blank">available on Google Code for checkout</a>. It uses the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1669" target="_blank">PHP EC2 library </a>which I bundled in (hope I didn&#8217;t break any licensing issue, please alert me if I did).</p>
<p>Usage is easy:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php ec2-delete-old-snapshots.php <span style="color: #660033;">-v</span> vol-id <span style="color: #7a0874; font-weight: bold;">&#91;</span>-v vol-id ...<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #660033;">-o</span> days</pre></div></div>

<p>If you wanted to delete ec2 snapshots older than 7 days for 2 volumes you have, you would use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php ec2-delete-old-snapshots.php <span style="color: #660033;">-v</span> vol-aabbccdd <span style="color: #660033;">-v</span> vol-bbccddee <span style="color: #660033;">-o</span> <span style="color: #000000;">7</span></pre></div></div>

<p>Hope this helps all you people out there who need such a thing. I will be happy to receive <a href="http://twitter.com/orensol" target="_blank">feedback</a> (and bug fixes) if you start using this.</p>
]]></content:encoded>
			<wfw:commentRss>http://orensol.com/2009/02/12/how-to-delete-those-old-ec2-ebs-snapshots/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->