<?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"
	>

<channel>
	<title>In the Cloud</title>
	<atom:link href="http://blog.p-for-productivity.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.p-for-productivity.com</link>
	<description>Solving problems using cloud computing...</description>
	<pubDate>Mon, 05 Oct 2009 09:33:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Hosting Git repositories on Dreamhost</title>
		<link>http://blog.p-for-productivity.com/?p=95</link>
		<comments>http://blog.p-for-productivity.com/?p=95#comments</comments>
		<pubDate>Tue, 05 May 2009 22:19:10 +0000</pubDate>
		<dc:creator>Ringo</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[SCM]]></category>

		<guid isPermaLink="false">http://blog.p-for-productivity.com/?p=95</guid>
		<description><![CDATA[Over the past weeks, I have been experimenting with different setups for hosting Git repositories. The environments where I tested these were very different: on my Dreamhost accout I can&#8217;t run daemon processes, while on the company server, I&#8217;m very well allowed to.
However, even with these different environments, I didn&#8217;t want to learn and maintain [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past weeks, I have been experimenting with different setups for hosting Git repositories. The environments where I tested these were very different: on my Dreamhost accout I can&#8217;t run daemon processes, while on the company server, I&#8217;m very well allowed to.</p>
<p>However, even with these different environments, I didn&#8217;t want to learn and maintain different Git hosting setups on each of these environments. In the end, I decided to go with <a href="http://eagain.net/gitweb/?p=gitosis.git">Gitosis</a>, a simple management system for Git repositories, where the communication between client and server is based on SSH and public/private keypairs.</p>
<p>I got Gitosis up and running quite fast on the company server. However, I have full control of this machine, and I can install all the required software I needed. On Dreamhost, it&#8217;s a completely different story.</p>
<p>Since Gitosis is mostly written in Python, I first checked for the Python version on my Dreamhost machine: 2.3.5. I decided to upgrade to a later version as per <a href="http://www.reverttoconsole.com/blog/nix/upgrading-python-on-a-dreamhost-account/">these instructions</a>. I installed Python 2.6.2 instead of the mentioned 2.5.2. This was the latest stable version in the 2.6 range at the time of writing. Installation went fine.</p>
<p>Second pre-requisite for Gitosis is Git itself. The version of Git installed on my Dreamhost machine was 1.5.4.1. Time to upgrade! I followed the instructions from this article, but updated the prefix argument of the configure script to als put the files in $HOME/opt, next to my custom Python distribution.</p>
<p>Before you continue with installing Gitosis, first install the Python setuptools. Download the latest setuptools egg and install it in your private Python distribution.</p>
<pre class="console">$ wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg
$ sh setuptools-0.6c9-py2.6.egg</pre>
<p>Now you can continue with the installation instructions for Gitosis from the article mentioned before. Since I installed a custom Python distribution, I can skip setting the PYTHONPATH. The custom Python has it&#8217;s module search path set correctly already.</p>
<p>In a previous article, I discussed a passwordless SSH setup. I assume you have your public key already copied to the Git user account on Dreamhost. If so, you can initialize Gitosis as follows:</p>
<pre class="console">$ gitosis-init &lt; /tmp/id_rsa.pub
Initialized empty Git repository in /home/mygituser/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /home/mygituser/repositories/gitosis-admin.git/</pre>
<p>Now that Gitosis is installed successfully, I continued reading on <a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way">how to add users and repositories</a>. Quite simple actually!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=95</wfw:commentRss>
		</item>
		<item>
		<title>SSH, multiple identities, but no passwords!</title>
		<link>http://blog.p-for-productivity.com/?p=93</link>
		<comments>http://blog.p-for-productivity.com/?p=93#comments</comments>
		<pubDate>Tue, 05 May 2009 21:10:38 +0000</pubDate>
		<dc:creator>Ringo</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.p-for-productivity.com/?p=93</guid>
		<description><![CDATA[Secure Shell is a great tool for securely connecting between several machines. In the past weeks, I am using it more and more, but I was getting tired of typing too much. I found a great article on setting up passwordless authentication using public/private keys and defining multiple SSH identities, but it still wasn&#8217;t enough.
I manage multiple [...]]]></description>
			<content:encoded><![CDATA[<p>Secure Shell is a great tool for securely connecting between several machines. In the past weeks, I am using it more and more, but I was getting tired of typing too much. I found a <a href="http://www.securityfocus.com/infocus/1810">great article</a> on setting up passwordless authentication using public/private keys and defining multiple SSH identities, but it still wasn&#8217;t enough.</p>
<p>I manage multiple Unix users on <a href="http://www.dreamhost.com/">Dreamhost</a>, a plethora of Linux virtual machines at work, running <a href="https://hudson.dev.java.net">Hudson</a> builders and two additional machines at home. With ssh-keygen, you can generate multiple different public/private keypairs (aka an identity). The section &#8220;Selecting Keys&#8221; of the above mentioned article describes how you can select a specific identity for connecting to a specific host. The example below shows how to connect to one of my DreamHost user accounts in a passwordless manner:</p>
<p><code> ssh -i ~/.ssh/dh-user1 user1@boba.dreamhost.com<br />
</code></p>
<p>If you have a long list of accounts, it would definitely be easy to use shortcuts for every combination of user@host and link that up to a specific SSH identity. Well, this is possible with the use of an SSH config file. I found out about this file <a href="http://ubuntuforums.org/showthread.php?t=172848">here</a> and then read more about it in the <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config">man page</a>.</p>
<p>When you have user1 and user2 as accounts on your remote machine, in my case boba.dreamhost.com, and having different SSH identities for each user (dh-user1[.pub] and dh-user2[.pub]), how do you link everything together to be able to just type one of the following:</p>
<p><code> ssh dh-user1<br />
ssh dh-user2<br />
</code></p>
<p>Actually, this is quite easy. Here is the ~/.ssh/config file in my local account (the account I&#8217;m making SSH connections <strong>from</strong>):</p>
<p><code> Host dh-user1<br />
User user1<br />
HostName boba.dreamhost.com<br />
IdentityFile ~/.ssh/dh-user1</code></p>
<p><code> </code></p>
<p><code>Host dh-user2<br />
User user2<br />
HostName boba.dreamhost.com<br />
IdentityFile ~/.ssh/dh-user2<br />
</code></p>
<p>Every section in this file starts with <strong>Host <em>ConnectionName</em></strong> followed by a number of connection parameters that are fully described in the man page. In my case, I specify the real host name, the username on the remote machine, and the identity file I want to link to that account.</p>
<p>Done!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=93</wfw:commentRss>
		</item>
		<item>
		<title>SpringSource dm Server, Groovy and Grails: coding in the fast lane?</title>
		<link>http://blog.p-for-productivity.com/?p=71</link>
		<comments>http://blog.p-for-productivity.com/?p=71#comments</comments>
		<pubDate>Fri, 31 Oct 2008 17:35:36 +0000</pubDate>
		<dc:creator>Ringo</dc:creator>
		
		<category><![CDATA[Grails]]></category>

		<category><![CDATA[Groovy]]></category>

		<category><![CDATA[OSGi]]></category>

		<guid isPermaLink="false">http://blog.atriso.be/?p=71</guid>
		<description><![CDATA[Lately, I have been reading a lot on various technical topics. Usually, after my reading session, I try to find out how to mix good products and/or tools for the benefits not just to add up, but to multiply.
The latest products and tools I have been examining are these:

SpringSource dm Server

OSGi in general
Groovy
Grails

I am not [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I have been reading a lot on various technical topics. Usually, after my reading session, I try to find out how to mix good products and/or tools for the benefits not just to add up, but to multiply.</p>
<p>The latest products and tools I have been examining are these:</p>
<ul>
<li><span><a href="SpringSource dm Server">SpringSource dm Server</a><br />
</span></li>
<li><a href="http://www.osgi.org">OSGi in general</a></li>
<li><a href="http://groovy.codehaus.org">Groovy</a></li>
<li><a href="http://www.grails.org">Grails</a></li>
</ul>
<p>I am not going to rephrase all that is marketed as shiny and exciting since you can read that on the respective web sites. What I will do here is finding out how close I can get to building a simple web application in Grails, using a backend service written in Groovy, where both modules are OSGi bundles and both deployed on the SpringSource dm Server.</p>
<p>Let&#8217;s start with the setup of all our tools!</p>
<p>First of all, go to the <a href="http://www.springsource.com">SpringSource</a> website and download the Community edition of <a href="http://www.springsource.com/products/suite/dmserver">SpringSource dm Server</a>. Follow the <a href="http://static.springsource.com/projects/dm-server/1.0.x/user-guide/html/ch01.html">installation instructions</a>, and <a href="http://static.springsource.com/projects/dm-server/1.0.x/user-guide/html/ch02.html">launch the server</a>. Here is the output you should get:</p>
<pre class="console">AtrisoBook:springsource-dm-server-1.0.0.RELEASE ringods$ bin/startup.sh
[2008-10-31 17:28:59.097] main                     &lt;SPKB0001I&gt; Server starting.
[2008-10-31 17:28:59.584] main                     &lt;SPOF0001I&gt; OSGi telnet console available on port 2401.
[2008-10-31 17:29:01.990] main                     &lt;SPKE0000I&gt; Boot subsystems installed.
[2008-10-31 17:29:02.817] main                     &lt;SPKE0001I&gt; Base subsystems installed.
[2008-10-31 17:29:03.962] server-dm-2              &lt;SPPM0000I&gt; Installing profile 'web'.
[2008-10-31 17:29:04.771] server-dm-2              &lt;SPPM0001I&gt; Installed profile 'web'.
[2008-10-31 17:29:04.860] server-dm-4              &lt;SPSC0001I&gt; Creating HTTP/1.1 connector with scheme http on port 8080.
[2008-10-31 17:29:04.889] server-dm-4              &lt;SPSC0001I&gt; Creating HTTP/1.1 connector with scheme https on port 8443.
[2008-10-31 17:29:04.905] server-dm-4              &lt;SPSC0001I&gt; Creating AJP/1.3 connector with scheme http on port 8009.
[2008-10-31 17:29:04.930] server-dm-4              &lt;SPSC0000I&gt; Starting ServletContainer.
[2008-10-31 17:29:05.417] server-dm-13             &lt;SPPM0002I&gt; Server open for business with profile 'web'.
[2008-10-31 17:29:05.435] fs-watcher               &lt;SPDE0048I&gt; Processing 'INITIAL' event for file 'server.admin.web-1.0.0.RELEASE.jar'.
[2008-10-31 17:29:06.243] fs-watcher               &lt;SPSC1000I&gt; Creating web application '/admin'.
[2008-10-31 17:29:06.638] async-delivery-thread-1  &lt;SPSC1001I&gt; Starting web application '/admin'.
[2008-10-31 17:29:07.044] fs-watcher               &lt;SPDE0010I&gt; Deployment of 'com.springsource.server.servlet.admin' version '1.0.0.RELEASE' completed.
[2008-10-31 17:29:07.048] fs-watcher               &lt;SPDE0048I&gt; Processing 'INITIAL' event for file 'server.admin.splash-1.0.0.RELEASE.war'.
[2008-10-31 17:29:07.582] fs-watcher               &lt;SPSC1000I&gt; Creating web application '/'.
[2008-10-31 17:29:07.714] async-delivery-thread-1  &lt;SPSC1001I&gt; Starting web application '/'.
[2008-10-31 17:29:07.878] fs-watcher               &lt;SPDE0010I&gt; Deployment of 'com.springsource.server.servlet.splash' version '0' completed.</pre>
<p>So far so good! Now shutdown it again. During development, we will launch the server from within Eclipse.</p>
<p>Next step is to get our developer tools up and running. At the time of writing, I downloaded <a href="http://www.eclipse.org">Eclipse</a> Ganymede 3.4.1 (SR1) JEE edition. Launch Eclipse and add three update sites:</p>
<ul>
<li><a href="http://dist.springframework.org/release/IDE">Spring IDE</a></li>
<li><a href="http://static.springsource.com/projects/sts-dm-server/update">SpringSource dm Server Tooling</a></li>
<li><a href="http://dist.codehaus.org/groovy/distributions/update/">Groovy Eclipse Plugin</a></li>
</ul>
<p>From these update sites, install all the tools offered.</p>
<p>After Eclipse relaunched, we define a local SpringSource dm Server that will be used to deploy our 2 projects. Start with opening the Servers view in Eclipse.</p>
<p><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver.png"><img class="size-full wp-image-74 alignnone" title="Server Window" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver.png" alt="" width="883" height="262" /></a></p>
<p>The New Server wizard starts, you select SpringSource dm Server v1.0, give a name and press Next.</p>
<p><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver2.png"><img class="alignnone size-full wp-image-75" title="New Server Wizard" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver2.png" alt="" width="605" height="651" /></a></p>
<p>In the second part of the wizard, you point to your installation folder of the SpringSource dm Server. You only have to do this once. The wizard will create a SpringSource dm Server Runtime Environment, similar to the different Java Runtime Environments you can have in Eclipse.</p>
<p><span style="color: #0000ee; text-decoration: underline;"><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver3.png"></a><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver3.png"><img class="alignnone size-full wp-image-78" title="New Server Wizard (2)" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver3.png" alt="" width="605" height="651" /></a></span></p>
<p>Press Finish and your server is now listed in the Servers view.</p>
<p><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver4.png"><img class="alignnone size-full wp-image-77" title="Server defined" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/10/newserver4.png" alt="" width="882" height="262" /></a></p>
<p>Using the buttons at the top of the Servers view, you can start and stop the SpringSource dm Server. All output should be accessible in the Console view within Eclipse. Go ahead and try it out.</p>
<p>In the next article, I will start with the development of the backend and web modules. So stay tuned for more!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=71</wfw:commentRss>
		</item>
		<item>
		<title>Snapshots of EBS Volumes</title>
		<link>http://blog.p-for-productivity.com/?p=58</link>
		<comments>http://blog.p-for-productivity.com/?p=58#comments</comments>
		<pubDate>Fri, 26 Sep 2008 12:56:48 +0000</pubDate>
		<dc:creator>Koen</dc:creator>
		
		<category><![CDATA[Amazon Web Services]]></category>

		<category><![CDATA[EBS]]></category>

		<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">http://blog.atriso.be/?p=58</guid>
		<description><![CDATA[Continuing with the volume created in the post Sharing EBS Volumes Among Instances, in this post I show how to create a snapshot, create a new volume from that snapshot, and mount the new volume in an instance. Remember that the volume created in the previous post contained 1 file called &#8220;readme&#8221;.
Creating the Snapshot
First we [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing with the volume created in the post <a href="?p=39" target="_blank">Sharing EBS Volumes Among Instances</a>, in this post I show how to create a snapshot, create a new volume from that snapshot, and mount the new volume in an instance. Remember that the volume created in the previous post contained 1 file called &#8220;readme&#8221;.</p>
<h3>Creating the Snapshot</h3>
<p>First we look at the available volumes:</p>
<pre class="console">$ ec2-describe-volumes
VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000</pre>
<p>Then we make the snapshot:</p>
<pre class="console">$ ec2-create-snapshot vol-4001e429
SNAPSHOT	snap-cb7493a2	vol-4001e429	pending	2008-09-26T11:48:30+0000</pre>
<p>It is &#8220;pending&#8221;. We check the status until it the snapshot creation has &#8220;completed&#8221;:</p>
<pre class="console">$ ec2-describe-snapshots snap-cb7493a2
SNAPSHOT	snap-cb7493a2	vol-4001e429	completed	2008-09-26T11:48:30+0000	100%</pre>
<h3>Creating a Volume from the Snapshot</h3>
<p>Now that the snapshot is ready, we can create a new volume from it. Note that we create it in a different availability zone. The orginal volume resides in &#8220;us-east-1c&#8221;. The new volume will reside in &#8220;us-east-1a&#8221;.</p>
<pre class="console">$ ec2-create-volume --snapshot snap-cb7493a2 -z us-east-1a
VOLUME	vol-9f00e5f6	1	snap-cb7493a2	us-east-1a	creating	2008-09-26T11:52:37+0000</pre>
<p>We wait until the volume is &#8220;available&#8221;:</p>
<pre class="console">$ ec2-describe-volumes
VOLUME	vol-9f00e5f6	1	snap-cb7493a2	us-east-1a	available	2008-09-26T11:52:37+0000
VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000</pre>
<p>Now we have two available volumes.</p>
<h3>Mounting the New Volume in an Instance</h3>
<p>Let&#8217;s launch an image so that we can verify that the newly created volume can be mounted and has the same contents as the original volume. Note that the instance is launched in the availability zone where the newly created volume resides.</p>
<pre class="console">$ ec2-run-instances ami-0757b26e -k gettingstarted-keypair -z us-east-1a</pre>
<p>The AMI we use here is a public Ubuntu Desktop image.</p>
<pre class="console">$ ec2-describe-instances
RESERVATION	r-ff4d9e96	190912652296	default
INSTANCE	i-0fcf6c66	ami-0757b26e	ec2-67-202-35-79.compute-1.amazonaws.com	domU-12-31-38-00-6C-F6.compute-1.internal	running	gettingstarted-keypair	0		m1.small	2008-09-26T11:55:16+0000	us-east-1a	aki-a71cf9ce	ari-a51cf9cc</pre>
<p>The instance is ready to be used. In another terminal we connect to the image and start the &#8220;user-setup&#8221; script. The GUI interaction to set up the user is not shown here.</p>
<pre class="console">$ ssh -i id_rsa-gettingstarted-keypair root@ec2-67-202-35-79.compute-1.amazonaws.com
The authenticity of host 'ec2-67-202-35-79.compute-1.amazonaws.com (67.202.35.79)' can't be established.
RSA key fingerprint is ab:df:4e:78:b7:4d:59:3e:ae:6c:81:32:80:eb:bd:78.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-67-202-35-79.compute-1.amazonaws.com,67.202.35.79' (RSA) to the list of known hosts.
Linux domU-12-31-38-00-6C-F6 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Amazon EC2 Ubuntu 7.10 gutsy base install AMI built by
Eric Hammond
For more information: http://ec2gutsy-desktop.notlong.com

root@domU-12-31-38-00-6C-F6:~# user-setup
Shadow passwords are now on.
Using `/usr/share/libgksu/debian/gconf-defaults.libgksu-sudo' to provide `libgksu-gconf-defaults'.</pre>
<p>Time to attach the volume (in the orginal terminal):</p>
<pre class="console">$ ec2-attach-volume vol-9f00e5f6 -i i-0fcf6c66 -d /dev/sdh
ATTACHMENT	vol-9f00e5f6	i-0fcf6c66	/dev/sdh	attaching	2008-09-26T12:01:15+0000
$ ec2-describe-volumes
VOLUME	vol-9f00e5f6	1	snap-cb7493a2	us-east-1a	in-use	2008-09-26T11:52:37+0000
ATTACHMENT	vol-9f00e5f6	i-0fcf6c66	/dev/sdh	attached	2008-09-26T12:01:15+0000
VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000</pre>
<p>Let&#8217;s see whether it is available. Connect to the desktop as described in <a href="?p=5" target="_blank">Preparing for Amazon AWS Usage</a>.</p>
<p><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/device-available-in-ubuntu.png"><img class="aligncenter size-full wp-image-63" title="Device available in Ubuntu" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/device-available-in-ubuntu.png" alt="" width="500" height="385" /></a></p>
<p>In the terminal connected to the instance, we can mount the volume now:</p>
<pre class="console">root@domU-12-31-38-00-6C-F6:~# mkdir /mnt/my-volume
root@domU-12-31-38-00-6C-F6:~# mount /dev/sdh /mnt/my-volume</pre>
<p>Now the volume should be mounted as &#8220;my-volume&#8221; and accessible. Let&#8217;s verify that by opening a file browser on that volume.</p>
<p><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/volume-mounted-in-ubuntu.png"><img class="aligncenter size-full wp-image-64" title="Volume mounted in Ubuntu" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/volume-mounted-in-ubuntu.png" alt="" width="500" height="385" /></a></p>
<p>Indeed, the &#8220;readme&#8221; file that was on the original volume is also on the new volume created from the snapshot.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=58</wfw:commentRss>
		</item>
		<item>
		<title>Sharing EBS Volumes Among Instances</title>
		<link>http://blog.p-for-productivity.com/?p=39</link>
		<comments>http://blog.p-for-productivity.com/?p=39#comments</comments>
		<pubDate>Thu, 25 Sep 2008 11:45:34 +0000</pubDate>
		<dc:creator>Koen</dc:creator>
		
		<category><![CDATA[Amazon Web Services]]></category>

		<category><![CDATA[EBS]]></category>

		<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">http://blog.atriso.be/?p=39</guid>
		<description><![CDATA[In this post I share an experiment to create an EBS volume, to attach it to an EC2 instance, to mount it in the instance, to put a file on it, to unmount it, and to detach it. Afterwards the volume will be mounted in another instance (while the first instance has been terminated, because [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I share an experiment to create an EBS volume, to attach it to an EC2 instance, to mount it in the instance, to put a file on it, to unmount it, and to detach it. Afterwards the volume will be mounted in another instance (while the first instance has been terminated, because attaching volumes to different instances at the same time is impossibe).</p>
<p>I followed the instructions given in the <a href="http://developer.amazonwebservices.com/connect/entry!default.jspa?categoryID=112&amp;externalID=1667" target="_blank">Elastic Block Storage Feature Guide</a>.</p>
<h3>Starting an Instance</h3>
<p>Let&#8217;s see which AMIs are available:</p>
<pre class="console">$ ec2-describe-images -o self
IMAGE	ami-c6c622af	dehonk-gettingstarted/image.manifest.xml	190912652296	available	private		i386	machine</pre>
<p>I launch ami-c6c622af with Elasticfox. Let&#8217;s check the status of the instance with the command line tools:</p>
<pre class="console">$ ec2-describe-instances
RESERVATION	r-9f3deef6	190912652296	default
INSTANCE	i-520faf3b	ami-c6c622af			pending	gettingstarted-keypair	0		m1.small	2008-09-25T09:50:01+0000	us-east-1c</pre>
<p>Important to note for later is the availability zone in which the instance is running, because volumes can ony be attached to instances when they live in the same availability zone.</p>
<h3>Create the Volume</h3>
<p>Create a volume of 1 GB in the same availability zone in which the instance resides:</p>
<pre class="console">$ ec2-create-volume --size 1 -z us-east-1c
VOLUME	vol-4001e429	1		us-east-1c	creating	2008-09-25T09:51:48+0000</pre>
<p>Check the status of the volume:</p>
<pre class="console">$ ec2-describe-volumes vol-4001e429
VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000</pre>
<p>The volume is available now. Time to use it!</p>
<h3>Attaching the Volume</h3>
<p>Attach the newly created volume as device /dev/sdh to the running instance:</p>
<pre class="console">$ ec2-attach-volume vol-4001e429 -i i-520faf3b -d /dev/sdh
ATTACHMENT	vol-4001e429	i-520faf3b	/dev/sdh	attaching	2008-09-25T09:59:14+0000</pre>
<p>The command returns saying that the volume is attaching. Let&#8217;s check the status:</p>
<pre class="console">$ ec2-describe-volumes VOLUME	vol-4001e429	1		us-east-1c	in-use	2008-09-25T09:51:48+0000 ATTACHMENT	vol-4001e429	i-520faf3b	/dev/sdh	attached	2008-09-25T09:59:14+0000</pre>
<p>While the volume was &#8220;available&#8221; and &#8220;attaching&#8221; before, now it is &#8220;in-use&#8221; and &#8220;attached&#8221;.</p>
<h3>Formatting the Volume</h3>
<p>Open another termnal. Connect to the instance via ssh:</p>
<pre class="console">$ ssh -i id_rsa-gettingstarted-keypair root@ec2-75-101-254-227.compute-1.amazonaws.com</pre>
<p>Looking at the contents of /dev reveals that the volume is available as device &#8220;sdh&#8221;:</p>
<pre class="console"># ls /dev
MAKEDEV   port   ptyc1  ptye6  ptyqb  ptyt0  ptyv5  ptyxa  ptyzf    ttya2  ttyc7  ttyec  ttyr1  ttyt6  ttyvb  ttyy0
--- cut here for brevity ---
loop7     ptyb3  ptyd8  ptypd  ptys2  ptyu7  ptywc  ptyz1  <strong>sdh</strong>      ttyb9  ttyde  ttyq3  ttys8  ttyud  ttyx2  ttyz7
--- cut here for brevity ---</pre>
<p>Since a new volume is not formatted, we do that first:</p>
<pre class="console"># yes | mkfs -t ext3 /dev/sdh
mke2fs 1.38 (30-Jun-2005)
/dev/sdh is entire device, not just one partition!
Proceed anyway? (y,n) Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
	32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.</pre>
<h3>Mounting the Volume</h3>
<p>Finally, the volume is ready to be mounted in the instance:</p>
<pre class="console"># mkdir /mnt/data-store
# mount /dev/sdh /mnt/data-store</pre>
<p>Let&#8217;s check whether everything is as expected:</p>
<pre class="console"># ls /mnt
data-store  lost+found
# ls /mnt/data-store/
lost+found</pre>
<p>That looks okay.</p>
<h3>Put a file on the volume</h3>
<p>Using vi, I created a file named &#8220;readme&#8221; with this contents:</p>
<pre class="console">This is an example file to show that a file persists on an EBS volume after unmounting and detaching.</pre>
<h3>Unmounting the Volume</h3>
<p>Before we stop the instance, we have to unmount the volume. From the <a href="http://developer.amazonwebservices.com/connect/entry!default.jspa?categoryID=112&amp;externalID=1667" target="_blank">Elastic Block Storage Feature Guide</a>: <em>A volume must be unmounted inside the instance before being detached. Failure to do so will result in damage to the file system or the data it contains.</em></p>
<pre class="console"># umount /mnt/data-store</pre>
<p>Remember to cd out of the volume, otherwise you will get an error message &#8220;umount: /mnt/data-store: device is busy&#8221;</p>
<h3>Detach the Volume</h3>
<p>From the Feature Guide: <em>An Amazon EBS volume can be detached from an instance by either explicitly detaching the volume or terminating the instance.</em> Let&#8217;s do it by explicitly detaching it:</p>
<pre class="console">$ ec2-detach-volume vol-4001e429 -i i-520faf3b -d /dev/sdh
ATTACHMENT	vol-4001e429	i-520faf3b	/dev/sdh	detaching	2008-09-25T09:59:14+0000</pre>
<p>Soon the status of the volume changes form &#8220;detaching&#8221; to &#8220;available&#8221;:</p>
<pre class="console">$ ec2-describe-volumes
VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000</pre>
<h3>Mounting the Volume in Another Instance</h3>
<p>Now do all the steps over again to start a new image and mount the volume. Because the volume resides in availability zone &#8220;us-east-1c&#8221; and instances and volumes have to live in the same availability zone, we have to launch the instance in &#8220;us-east-1c&#8221;.</p>
<pre class="console&gt;$ ec2-run-instances ami-c6c622af -k gettingstarted-keypair -z us-east-1c RESERVATION	r-eb22f182	190912652296	default INSTANCE	i-5a12b233	ami-c6c622af			pending	gettingstarted-keypair	0		m1.small	2008-09-25T11:23:01+0000	us-east-1c $ ec2-describe-instances RESERVATION	r-eb22f182	190912652296	default INSTANCE	i-5a12b233	ami-c6c622af	ec2-72-44-53-70.compute-1.amazonaws.com	domU-12-31-39-01-5C-76.compute-1.internal	running	gettingstarted-keypair	0		m1.small	2008-09-25T11:23:01+0000	us-east-1c $ ec2-describe-volumes VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000 $ ec2-attach-volume vol-4001e429 -i i-5a12b233 -d /dev/sdh ATTACHMENT	vol-4001e429	i-5a12b233	/dev/sdh	attaching	2008-09-25T11:25:46+0000 $ ec2-describe-volumes VOLUME	vol-4001e429	1		us-east-1c	in-use	2008-09-25T09:51:48+0000 ATTACHMENT	vol-4001e429	i-5a12b233	/dev/sdh	attached	2008-09-25T11:25:46+0000&lt;/pre&gt; &lt;p&gt;Now start anoher terminal to connect to the instance:&lt;/p&gt; &lt;pre class=">$ ssh -i id_rsa-gettingstarted-keypair root@ec2-72-44-53-70.compute-1.amazonaws.com
Last login: Tue Sep  9 14:48:20 2008 from 213.49.236.209

	 __|  __|_  )  Rev: 2
	 _|  (     /
	___|\___|___|

 Welcome to an EC2 Public Image
                       <img src='http://blog.p-for-productivity.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> 

    Getting Started

    __ c __ /etc/ec2/release-notes.txt

[root@domU-12-31-39-01-5C-76 ~]# mkdir /mnt/data-store
[root@domU-12-31-39-01-5C-76 ~]# mount /dev/sdh /mnt/data-store
[root@domU-12-31-39-01-5C-76 ~]# cd /mnt/data-store
[root@domU-12-31-39-01-5C-76 data-store]# ls
lost+found  readme
[root@domU-12-31-39-01-5C-76 data-store]# cat readme
This is an example file to show that a file persists on an EBS volume after unmounting and detaching.
[root@domU-12-31-39-01-5C-76 ~]# umount /mnt/data-store
[root@domU-12-31-39-01-5C-76 ~]# exit</pre>
<p>The file we created earlier was on the volume and we could read it. This proves that we can share volumes among instances.</p>
<p>To clean up:</p>
<pre class="console">$ ec2-detach-volume vol-4001e429 -i i-5a12b233
ATTACHMENT	vol-4001e429	i-5a12b233	/dev/sdh	detaching	2008-09-25T11:25:46+0000
$ ec2-describe-volumes
VOLUME	vol-4001e429	1		us-east-1c	available	2008-09-25T09:51:48+0000
$ ec2-terminate-instances i-5a12b233
INSTANCE	i-5a12b233	running	shutting-down
n$ ec2-describe-instances
RESERVATION	r-eb22f182	190912652296	default
INSTANCE	i-5a12b233	ami-c6c622af	ec2-72-44-53-70.compute-1.amazonaws.com	domU-12-31-39-01-5C-76.compute-1.internal	shutting-down	gettingstarted-keypair	0		m1.small	2008-09-25T11:23:01+0000	us-east-1c
$ ec2-describe-instances
RESERVATION	r-eb22f182	190912652296	default
INSTANCE	i-5a12b233	ami-c6c622af			terminated	gettingstarted-keypair	0		m1.small	2008-09-25T11:23:01+0000</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=39</wfw:commentRss>
		</item>
		<item>
		<title>Setting EC2 Environment Variables in ~/.bash_login</title>
		<link>http://blog.p-for-productivity.com/?p=35</link>
		<comments>http://blog.p-for-productivity.com/?p=35#comments</comments>
		<pubDate>Thu, 25 Sep 2008 09:45:03 +0000</pubDate>
		<dc:creator>Koen</dc:creator>
		
		<category><![CDATA[Amazon Web Services]]></category>

		<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">http://blog.atriso.be/?p=35</guid>
		<description><![CDATA[Section &#8220;Setting up the Tools&#8221; of the Amazon EC2 Getting Started Guide explains how to set up environment variables, so that the EC2 tools find themselves (EC2_HOME), Java ($JAVA_HOME), the private access key file (EC2_PRVATE_KEY) and the certificate file (EC2_CERT). And they also suggest to change the PATH variable, so that you can run EC2 commands from anywhere.
Of course, [...]]]></description>
			<content:encoded><![CDATA[<p>Section <a href="http://docs.amazonwebservices.com/AWSEC2/2007-03-01/GettingStartedGuide/setting-up-your-tools.html" target="_blank">&#8220;Setting up the Tools&#8221;</a> of the <a href="http://docs.amazonwebservices.com/AWSEC2/2007-03-01/GettingStartedGuide/" target="_blank">Amazon EC2 Getting Started Guide </a>explains how to set up environment variables, so that the EC2 tools find themselves (EC2_HOME), Java ($JAVA_HOME), the private access key file (EC2_PRVATE_KEY) and the certificate file (EC2_CERT). And they also suggest to change the PATH variable, so that you can run EC2 commands from anywhere.</p>
<p>Of course, you do not want to set the environment variables every time you want to use the EC2 tools. I added the lines below to ~/.bash_login on my Mac, so that the environment variables are set everytime I open a terminal. I installed the tools in ~/AWS/ec2-api-tools-1.3-24159 and the private access key file and the certificate file reside in ~/.ec2.</p>
<pre>export EC2_PRIVATE_KEY=~/.ec2/pk-&lt;some id here&gt;.pem
export EC2_CERT=~/.ec2/cert-&lt;some id here&gt;.pem
export EC2_HOME=~/AWS/ec2-api-tools-1.3-24159
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export PATH=$PATH:$EC2_HOME/bin</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=35</wfw:commentRss>
		</item>
		<item>
		<title>Preparing for Amazon AWS Usage</title>
		<link>http://blog.p-for-productivity.com/?p=5</link>
		<comments>http://blog.p-for-productivity.com/?p=5#comments</comments>
		<pubDate>Wed, 24 Sep 2008 09:57:39 +0000</pubDate>
		<dc:creator>Koen</dc:creator>
		
		<category><![CDATA[Amazon Web Services]]></category>

		<guid isPermaLink="false">http://blog.atriso.be/?p=5</guid>
		<description><![CDATA[In order to experiment with Amazon Web Services, I requested an AWS account and I installed a bunch of software to get started. Here is an overview of what I did to get up and running.
Setting Up an AWS Account and the EC2 Tools
I filled in the registration form to request a new AWS account. [...]]]></description>
			<content:encoded><![CDATA[<p>In order to experiment with <a href="http://aws.amazon.com/" target="_blank">Amazon Web Services</a>, I requested an AWS account and I installed a bunch of software to get started. Here is an overview of what I did to get up and running.</p>
<h3>Setting Up an AWS Account and the EC2 Tools</h3>
<p>I filled in the <a href="https://aws-portal.amazon.com/gp/aws/developer/registration/index.html" target="_blank">registration form</a> to request a new AWS account. Then I followed the excellent <a href="http://docs.amazonwebservices.com/AWSEC2/2007-03-01/GettingStartedGuide/" target="_blank">Gettting Started Guide</a>. It explains how to set up an account, how to install the EC2 tools, how to run an instance, and how to create your own image starting from an existing one. I immediately felt the power to EC2.</p>
<p>The <a href="http://status.aws.amazon.com/" target="_blank">AWS Service Health Dashboard</a> shows the status of AWS. It even shows the status history of about 1 month.</p>
<p>The <a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&amp;action=activity-summary" target="_blank">account activity</a> (you need an AWS account to see this page) shows the costs involved with AWS usage.</p>
<p><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/account-activity.png"><img class="aligncenter size-full wp-image-27" title="Account activity" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/account-activity.png" alt="" width="500" height="371" /></a></p>
<h3>Installing Useful FireFox Plug-Ins</h3>
<p>Although the EC2 tools provide everything you need to manage images, instances, and other EC2 resources, it is easier to have a nice management GUI.</p>
<p><a href="http://sourceforge.net/projects/elasticfox/" target="_blank">Elasticfox</a> is a FireFox plug-in for interacting with EC2, the Elasic Compute Cloud. When installed, it is available from the Tools menu. The plug-in opens in a web page and shows the avalaible machne images (AMIs) and your instances. Running an instance is as simle as selecting an AMI and pressing the &#8220;Launch Instance(s)&#8221; button. The list of public images is long. Elasticfox allows to filter the list.</p>
<p>The running instances show up in the &#8220;Your Instances&#8221; list. For each running instance, the public DNS name is shown, so that you can use that to connect to the instance through SSH, HTTP or other means. In the &#8220;Your Instances&#8221; list you can terminate instances when they are no longer necessary. Terminated instances are kept in the list until about one hour after termination.</p>
<p style="text-align: center;"><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/elasticfox-showing-images-and-running-instance.png"><img class="alignnone size-full wp-image-15" title="ElasticFox showing images and running instance" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/elasticfox-showing-images-and-running-instance.png" alt="" width="500" height="309" /></a></p>
<p><a href="http://www.rjonna.com/ext/s3fox.php" target="_blank">S3Fox Organizer for Amazon</a> enables access to Amazon S3 (Simple Storage Service). It shows the contents of your buckets on S3 and you can download and upload files. Simply entering you account ID, the access key and the secret key, and you are ready to roll.</p>
<h3><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/s3fox-showing-upload-to-s3-bucket.png"><img class="aligncenter size-full wp-image-17" title="S3Fox showing upload to S3 bucket" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/s3fox-showing-upload-to-s3-bucket.png" alt="" width="500" height="309" /></a></h3>
<h3><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/s3fox-showing-upload-to-s3-bucket.png"></a>Installing Desktop Access to Instances</h3>
<p>When you want to use a desktop image, so that you can use a GUI to manage your instances, you need software to access the desktop of the instances.</p>
<p>First you need a desktop image. I chose an <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1425&amp;categoryID=101" target="_blank">Ubuntu GutsyDesktop AMI</a>, which is also available as a public AMI and listed in Elasticfox. I use a Mac, so I <a href="http://www.nomachine.com/download.php" target="_blank">downloaded the NX Client for Mac OSX</a> (you can download NX Client for other operating systems from the same location). In no time, I was able to manage the instance through a GUI.</p>
<p>I selected &#8220;ami-0757b26e&#8221; from the list in Elasticfox and pressed the &#8220;Launch Instance(s)&#8221; button. In the dialog window that appeared, I entered my key pair and pressed the &#8220;Launch&#8221; button. When the instance was running, I opened a terminal and entered:</p>
<pre class="console">ssh -i /Users/Koen/ec2-keys/id_gettingstarted-keypair root@ec2-75-101-241-111.compute-1.amazonaws.com</pre>
<p>Using the provided information, user &#8220;root&#8221; logs in automatically. Then I entered:</p>
<pre class="console">user-setup</pre>
<p>and followed the instructions to enter a user name (I chose &#8220;koen&#8221;) and a password.</p>
<p>Then I started NX Client and configured it as follows:</p>
<p style="text-align: center;"><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/nx-client-login.png"><img class="size-medium wp-image-20 aligncenter" title="NX Client login" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/nx-client-login-300x211.png" alt="" width="300" height="211" /></a></p>
<p style="text-align: center;">
<p style="text-align: center;"><a href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/nx-client-host-configuration.png"><img class="size-medium wp-image-19 aligncenter" title="NX Client host configuration" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/nx-client-host-configuration-280x300.png" alt="" width="280" height="300" /></a></p>
<p>After pressing &#8220;Login&#8221; and waiting for the connection to be setup, this was the result (I already opened the home folder before making the screen shot): the Ubuntu desktop in X11.</p>
<p><a style="text-decoration: none;" href="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/ubuntu-desktop-in-x11.png"><span style="color: #000000;"><br />
</span><img class="aligncenter size-full wp-image-22" style="text-decoration: underline;" title="Unbuntu destop in X11" src="http://blog.p-for-productivity.com/wp-content/uploads/2008/09/ubuntu-desktop-in-x11.png" alt="" width="500" height="385" /></a></p>
<p>Cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.p-for-productivity.com/?feed=rss2&amp;p=5</wfw:commentRss>
		</item>
	</channel>
</rss>
