<?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>Jayway Team Blog &#187; amazon</title>
	<atom:link href="http://blog.jayway.com/tag/amazon/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jayway.com</link>
	<description>Sharing Experience</description>
	<lastBuildDate>Tue, 20 Jul 2010 08:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Deleting All Your Files on Amazon S3</title>
		<link>http://blog.jayway.com/2010/04/20/deleting-all-your-files-on-s3/</link>
		<comments>http://blog.jayway.com/2010/04/20/deleting-all-your-files-on-s3/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 14:15:07 +0000</pubDate>
		<dc:creator>Adam Skogman</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=5377</guid>
		<description><![CDATA[How to recursively delete all your files in all your buckets on an S3 account.]]></description>
			<content:encoded><![CDATA[<p>Deleting all your files on S3 is not as easy as you may think, since it requires you to delete all files, one by one, before you can remove the buckets.</p>
<p>Thankfully, this can be done using a small ruby script. First, install the needed ruby gems:</p>
<pre>
>sudo gem install right_aws
</pre>
<p>Then, paste this into your text editor, and edit before you run:</p>
<pre class="ruby">&nbsp;
<span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby -w</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'right_aws'</span>
&nbsp;
s3 = <span style="color:#6666ff; font-weight:bold;">RightAws::S3</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>aws_access_key=<span style="color:#996600;">'your-access-key-here'</span>, aws_secret_access_key=<span style="color:#996600;">'your-secret-access-key-here'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
s3.<span style="color:#9900CC;">buckets</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |bucket|
&nbsp;
  keys = bucket.<span style="color:#9900CC;">keys</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'max-keys'</span>=&gt;<span style="color:#006666;">1000</span> <span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">while</span> keys.<span style="color:#9900CC;">length</span> &gt; <span style="color:#006666;">0</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    keys.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |key|
      <span style="color:#CC0066; font-weight:bold;">puts</span> key.<span style="color:#9900CC;">full_name</span>
      key.<span style="color:#9900CC;">delete</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    keys = bucket.<span style="color:#9900CC;">keys</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'max-keys'</span>=&gt;<span style="color:#006666;">1000</span> <span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  bucket.<span style="color:#9900CC;">delete</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>Note that I only get a 1000 keys at a time. Having a lot of files in a bucket will break most GUI tools, because they try to do to much - like listing all of my files...</p>
<p>Happy deleting!</p>
<p><strong>Tip:</strong> Run this for an instance on Amazon, not from your own computer. Running inside Amazon is much faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2010/04/20/deleting-all-your-files-on-s3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How-to get a large C: drive for Windows on Amazon</title>
		<link>http://blog.jayway.com/2010/03/31/how-to-get-a-large-c-drive-for-windows-on-amazon/</link>
		<comments>http://blog.jayway.com/2010/03/31/how-to-get-a-large-c-drive-for-windows-on-amazon/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 09:08:11 +0000</pubDate>
		<dc:creator>Adam Skogman</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[ebs]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=5238</guid>
		<description><![CDATA[Amazon has excellent Windows support these days. Many time you'd like a larger C: drive than the 30 GB that come standard with the Amazon images. Here is how you enlarge the boot drive to 100 GB.]]></description>
			<content:encoded><![CDATA[<p>Amazon has excellent Windows support these days, and computers boot up from EBS. Drives are therefor both fast and robust. However, many time you'd like a larger C: drive than the 30 GB that come standard with the Amazon images. Here is how you enlarge the boot drive!</p>
<p>First step is to boot an instance. You need the command line tools for this, as neither the AWS Management Web Console nor ElasticFox currently supports this right now (note to developers - please add!).</p>
<pre>
ec2-run-instances --region eu-west-1 \
     -K pk-YOURKEYHERE.pem \
     -C cert-YOURCERTHERE.pem \
     <strong>-b '/dev/sda1=:100' \</strong>
     ami-d7a78ca3 \
     -g my-security-group -g common-security-group \
     -t m1.large \
     -k thekeyhere \
     --disable-api-termination \
     --instance-initiated-shutdown-behavior stop \
     -z eu-west-1a
</pre>
<ul>
<li>The command is <strong>ec2-run-instances</strong> with an <strong>'s'</strong> in the end. There is another command in the API without the s, which doesn't work.</li>
<li><strong>-b</strong> is the most important flag here. It says to make the boot disk (/dev/sda is Linux speek for C:) 100 GB, despite what the AMI manifest says (which is 30 GB).</li>
<li><strong>ami-d7a78ca3</strong> is the Windows image, in this case a 64bit Windows 2008.</li>
<li>-g security-group you should add as many as you like. Remember to think these through, since you cannot change which groups an instance belongs to.</li>
<li>The flags <strong>--disable-api-termination --instance-initiated-shutdown-behavior stop</strong> are really nice, because that make sure you cannot accidentally terminate the instance, making the harddrive disappear.</li>
<li>Note that I'm running in the EU region here.</li>
</ul>
<p>Ok, so now you have a running Windows server. Once it has booted, you log on using remote desktop (well, as soon as you have the generated password, which takes 15 min). PLease note that the C: drive will show up as 30 GB at this point. The partition is still only 30 GB, even if the virtual harddrive is 100 GB.</p>
<ol>
<li>Go into the windows management console. Go to <strong>disk management</strong>.</li>
<li><strong>Right-click</strong> on the C: drive. Choose <strong>Extend volume</strong> from the context menu.</li>
<li>In the wizard that pops up, just accept the defaults, and click finish.</li>
</ol>
<p>Done! The change is instant (no reboot or anything), and your system drive C: is now 100 GB.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2010/03/31/how-to-get-a-large-c-drive-for-windows-on-amazon/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Blogging Among the Clouds</title>
		<link>http://blog.jayway.com/2009/05/07/blogging-among-the-clouds/</link>
		<comments>http://blog.jayway.com/2009/05/07/blogging-among-the-clouds/#comments</comments>
		<pubDate>Thu, 07 May 2009 18:31:57 +0000</pubDate>
		<dc:creator>Henrik Bernström</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[ebs]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://79.125.9.149/?p=1619</guid>
		<description><![CDATA[Up until now this WordPress blog has been hosted by DreamHost, a company with a good reputation and a solid knowledge in hosting. Unfortunately, the server we've been located on, Trafficante, have lately had some problems with stability and performance and DreamHost have also had some MySQL stability issues. This, plus the fact that we've [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now this WordPress blog has been hosted by <a href="http://dreamhost.com/aboutus.html">DreamHost</a>, a company with a good reputation and a solid knowledge in hosting. Unfortunately, the server we've been located on, Trafficante, have lately had some problems with stability and performance and DreamHost have also had some MySQL stability issues. This, plus the fact that we've had some really good experience with <a href="http://aws.amazon.com/">Amazons' Web Services</a> has made us take the leap, up among the clouds. </p>
<p>That said, I must also give credit to DreamHost for always being very helpful and supporting when needed.</p>
<p>If you want to know what we did to gain the speed needed for a lift-of, keep on reading.</p>
<h3>Exporting the Existing Database</h3>
<p>I really like MySQL, but when it comes to encoding for character sets and collations there seems to be such a complexity in the details that users often get lost and configure it the wrong way. The UTF-8 configured database we used on DreamHost worked just fine together with our WordPress installation but it turned out to be impossible to export a correct UTF-8 version for importing into our new environment. And I tried a lot of things. Really. I'm not going to go into details but to sum it up I had to sit down and do kind of manual replacements of the swedish specific characters in the database export. Lucky me this blog is in english. </p>
<p>Anyway, I had ssh access to the Trafficante server and could use this connection to export the database from the DreamHost MySQL server by issueing:</p>
<pre class="bash">&nbsp;
mysqldump --default-character-<span style="color: #007800;">set=</span>UTF8 -u <span style="color: #7a0874; font-weight: bold;">&#91;</span>user<span style="color: #7a0874; font-weight: bold;">&#93;</span> -p -h <span style="color: #7a0874; font-weight: bold;">&#91;</span>host<span style="color: #7a0874; font-weight: bold;">&#93;</span>.dreamhosters.com <span style="color: #7a0874; font-weight: bold;">&#91;</span>database<span style="color: #7a0874; font-weight: bold;">&#93;</span> -r <span style="color: #7a0874; font-weight: bold;">&#91;</span>output<span style="color: #7a0874; font-weight: bold;">&#93;</span>.sql
&nbsp;</pre>
<p>This resulted in a database dump later used for importing into the new MySQL instance.</p>
<h3>Setting up the Amazon EC2 Instance</h3>
<p>To make your Amazon life easier start with installing the Firefox plugins <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609">Elasticfox</a> and <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=771">S3 Organizer</a>. These tools give you a GUI view of the somewhat more complex underlying details of Amazon. </p>
<p>Amazons' cloud solution is based on a user account. There are no start-up fees, you only pay for what you use. So if you still haven't got an account, <a href="http://www.amazon.com/gp/aws/registration/registration-form.html">sign-up now</a>. The rest of this article assumes you have signed up and set up accounts for <a href="http://aws.amazon.com/ec2/">Amazon EC2</a>, <a href="http://aws.amazon.com/s3/">Amazon S3</a> and <a href="http://aws.amazon.com/ebs/">Amazon EBS</a>. Start by reading the <a href="http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/">EC2 Getting Started Guide</a> and don't stop reading until you have created an ssh key pair, a security group and have a server instance running.</p>
<p>Now you should also have a private key and a certificate in your <em>${EC2_HOME}</em> (preferrably <em>${HOME}/.ec2/</em>) folder of your local computer. These two files should also be uploaded to your instance /mnt folder to make it possible to bundle and upload your images to your S3 "bucket(s)" (buckets are one level deep folders/directories). Make sure you put them in the /mnt folder to prevent them from being bundled with the image and thereby increasing the risk of having your identity revealed.</p>
<p>Bundling, by the way, should be done when you've made changes to your server instance that you don't want to loose. The result of a bundling and uploading is an image with a specific Amazon Image Id (AMI ID) reflecting the state of your server instance at the moment of bundling. You also have to register the image with the manifest file created for you. If you do that you could then safely close down your instance and have it up and running again by issuing the ec2-run-instances command with the AMI ID as parameter. A way to save money.</p>
<p>Bundling and uploading was made easier for me as I used two scripts created by my colleague <a href="/author/ulriksandberg">Ulrik</a>. I put these scripts in the /root folder.</p>
<pre class="bash">bundle-myself.<span style="color: #c20cb9; font-weight: bold;">sh</span>:
&nbsp;
<span style="color: #808080; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">prg=</span>`<span style="color: #c20cb9; font-weight: bold;">basename</span> $<span style="color: #000000;">0</span>`
<span style="color: #007800;">dest=</span>/mnt
<span style="color: #007800;">image=</span>blog-image
&nbsp;
<span style="color: #007800;">USAGE=</span><span style="color: #ff0000;">&quot;Usage: $prg &lt;datetime&gt;
&nbsp;
Example:
% $prg 20090415-1000
Bundling into $dest/$image-20090415-1000.manifest.xml&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> -ne <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$USAGE&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #007800;">date=</span>$<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Bundling into $dest/$image-$date.manifest.xml&quot;</span>
ec2-bundle-vol --debug -k /mnt/pk-PRIVATE_KEY.pem -c /mnt/cert-CERTIFICATE.pem -u USER_ACCOUNT_ID -d <span style="color: #007800;">$dest</span> -p <span style="color: #007800;">$image</span>-<span style="color: #007800;">$dat</span>
e -r i386
&nbsp;</pre>
<pre class="bash">upload-myself.<span style="color: #c20cb9; font-weight: bold;">sh</span>:
&nbsp;
<span style="color: #808080; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">prg=</span>`<span style="color: #c20cb9; font-weight: bold;">basename</span> $<span style="color: #000000;">0</span>`
<span style="color: #007800;">dest=</span>/mnt
<span style="color: #007800;">image=</span>blog-image
&nbsp;
<span style="color: #007800;">USAGE=</span><span style="color: #ff0000;">&quot;Usage: $prg &lt;date&gt;
&nbsp;
Example:
% $prg 20090415-1000
Uploading bundled AMI parts to https://s3.amazonaws.com:443/[S3_BUCKET] ...
Uploaded blog-image-20090415-1000.part.00 to https://s3.amazonaws.com:443/[S3_BUCKET]/blog-image-20090415-1000.part.00.
...&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> -ne <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$USAGE&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #007800;">date=</span>$<span style="color: #000000;">1</span>
ec2-upload-bundle --retry -m <span style="color: #007800;">$dest</span>/<span style="color: #007800;">$image</span>-<span style="color: #007800;">$date</span>.manifest.xml -b blog-images -a <span style="color: #7a0874; font-weight: bold;">&#91;</span>PUBLIC_KEY<span style="color: #7a0874; font-weight: bold;">&#93;</span> -s <span style="color: #7a0874; font-weight: bold;">&#91;</span>PRIVATE_KEY<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;</pre>
<p>Another thing I needed was a static IP address for my instance. To solve this I used Amazons Elastic IP service which doesn't cost anything as long as the generated IP address is in use. So, I generated an Elastic IP address and assigned it to the instance.</p>
<h3>Installing Necessary Software</h3>
<p>The blog require <a href="http://httpd.apache.org/">Apache2</a>, <a href="http://www.php.net/">Php5</a>, <a href="http://www.mysql.com">MySQL</a> and the <a href="http://www.phpgd.com/">Php GD graphics package</a>, to start with. This was easily installed using <a href="http://en.wikipedia.org/wiki/Advanced_Packaging_Tool">Advanced Packaging Tool</a>, apt-get:</p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get update</span>
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> apache2 php5 mysql-server php5-mysql php5-gd</span>
&nbsp;</pre>
<h3>Setting up the Database for EBS</h3>
<p>EBS volumes are, as you might know, more persistent than EC2 instances and will survive if instances go down. Volumes are attached to the instance and could as well be detached and re-attached to new instances. As EBS volumes are not 100% reliable you should also take snapshots of your database data and have it uploaded to an S3 bucket. All this is nicely described in <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1663">Eric Hammonds' EBS and MySQL tutorial</a>, so I urge you to read it if you haven't yet. </p>
<p>The only thing I sidestepped in the tutorial was the MySQL configuration to point out the data and log directories. Instead I used symbolic links:</p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">ln</span> -s /vol/lib/mysql/ /var/lib/mysql</span>
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">ln</span> -s /vol/log/mysql/ /var/log/mysql</span>
&nbsp;</pre>
<p>The tutorial also walks you through automatic snapshots which requires the EC2 command line tools. Here is <a href="https://help.ubuntu.com/community/EC2APITools">a nice tutorial on setting these tools up on Ubuntu</a>.</p>
<p>I had to tweak the environment variable settings in ec2-snapshot-xfs-mysql.pl script from</p>
<pre>
BEGIN {
  $ENV{PATH} = '/bin:/usr/bin:/usr/local/bin';
}
</pre>
<p>to</p>
<pre>
BEGIN {
  $ENV{PATH} = '/bin:/usr/bin:/usr/local/bin:/usr/sbin:/root/ec2-api-tools/bin';
  $ENV{EC2_CERT} = '/mnt/cert-CERTIFICATE.pem';
  $ENV{EC2_PRIVATE_KEY} = '/mnt/pk-PRIVATE_KEY.pem';
  $ENV{EC2_HOME} = '/root/ec2-api-tools';
  $ENV{HOME} = '/root';
  $ENV{JAVA_HOME} = '/usr/lib/jvm/java-1.5.0-sun';
}
</pre>
<p>to get the snapshotting to fully work. I also wrapped the ec2-snapshot-xfs-mysql.pl script for a more convenient way to handle the input:</p>
<pre>/root/snapshot-myself.sh

#!/bin/sh
mountpoint=/vol
volume_id=[VOLUME_ID]

su -c "/root/ec2-snapshot-xfs-mysql.pl ${mountpoint} ${volume_id} > /vol/cron.log"
</pre>
<p>To automatize the snapshotting I set up a simple crontab job by issueing:</p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># crontab -e</span>
&nbsp;</pre>
<p>and then edited it like this</p>
<pre>
05 */6 * * * sh /root/snapshot-myself.sh
</pre>
<p>which makes the job run five minutes past every six hours, every day.</p>
<p>I also had to set the timezone info to apply to our local time. The easiest way I've found out of setting this for a Linux server is like this:</p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">ln</span> -sf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime</span>
&nbsp;</pre>
<h3>Configuring MySQL</h3>
<p>To configure MySQL for UTF-8 content make sure the <em>/etc/mysql/my.cnf</em> file contains the following:</p>
<pre>
[client]
default-character-set=utf8

[mysqld]
#
# * Basic Settings
#
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8
skip-character-set-client-handshake
</pre>
<p>Now, if you haven't yet, go on and start your MySQL server. You need to create your wordpress database. It's as simple as:</p>
<pre class="sql">&nbsp;
<span style="color: #808080; font-style: italic;"># mysql -u [user] -p</span>
&gt; <span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>database_name<span style="color: #66cc66;">&#93;</span>
&nbsp;</pre>
<p>To create the user with which WordPress will access the database:</p>
<pre class="sql">&nbsp;
&gt; <span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#91;</span>database_name<span style="color: #66cc66;">&#93;</span>.* <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'[user]'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'[password]'</span>;
&nbsp;</pre>
<p>And to import your database dump into the newly created database:</p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># mysql -u <span style="color: #7a0874; font-weight: bold;">&#91;</span>user<span style="color: #7a0874; font-weight: bold;">&#93;</span> -p <span style="color: #7a0874; font-weight: bold;">&#91;</span>database_name<span style="color: #7a0874; font-weight: bold;">&#93;</span> &lt; <span style="color: #7a0874; font-weight: bold;">&#91;</span>output<span style="color: #7a0874; font-weight: bold;">&#93;</span>.sql</span>
&nbsp;</pre>
<p>You shouldn't need to specify any character set or collation when importing thanks to the configuration done in <em>/etc/mysql/my.cnf</em>.</p>
<p>In order for us to stick with our domain name and have no downtime we needed to use the instances IP address until we were finished testing. This means I had to replace two properties in the database to prevent the blog from redirecting to the original host; the '<em>siteurl</em>' and '<em>blogurl</em>' properties residing in the <em>option_value</em> column of the <em>wp_options</em> table. The commands</p>
<pre class="sql">&nbsp;
<span style="color: #808080; font-style: italic;"># mysql -u [user] -p</span>
&gt; <span style="color: #993333; font-weight: bold;">UPDATE</span> wp_options <span style="color: #993333; font-weight: bold;">SET</span> option_value=<span style="color: #ff0000;">'http://[ip_address]/wordpress/'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> option_name=<span style="color: #ff0000;">'siteurl'</span>
&gt; <span style="color: #993333; font-weight: bold;">UPDATE</span> wp_options <span style="color: #993333; font-weight: bold;">SET</span> option_value=<span style="color: #ff0000;">'http://[ip_address]/wordpress/'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> option_name=<span style="color: #ff0000;">'blogurl'</span>
&nbsp;</pre>
<p>fixed this. As soon as the DNS info was propagated throughout the Internet this was reset to <em>"http://blog.jayway.com/wordpress"</em> from within the WordPress admin interface.</p>
<h3>Apache Configuration</h3>
<p>Our WordPress installation makes use of permalinks and redirects to <a href="http://feedburner.google.com/">FeedBurner</a> for RSS statistics. This is based on <em>.htaccess</em> redirects (at least that's how we've solved it) which in turn is dependent on the Apache redirect module. So, in order to make this to work I had to enable that. </p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">sudo</span> a2enmod rewrite</span>
&nbsp;</pre>
<p>Easy as that! One more thing on redirections. I had to configure Apache to allow redirection directives specified in the <em>.htaccess</em> file by changing the <em>/etc/apache2/sites-available/default</em> configuration of the <em><VirtualHost *></em> element from</p>
<pre class="xml">&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Directory</span> /var/www<span style="font-weight: bold; color: black;">/&gt;</span></span>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Directory<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>to</p>
<pre class="xml">&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Directory</span> /var/www<span style="font-weight: bold; color: black;">/&gt;</span></span>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;----------</span>
		Order allow,deny
		allow from all
	<span style="font-weight: bold; color: black;">&lt;/Directory<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<h3>Securing the WordPress Admin Interface</h3>
<p>Again, I choose to refer to detailed and well written sources. Here are the two articles I followed to create a self-signed certificate and to configure Apache to use it.</p>
<ul>
<li><a href="http://www.tc.umn.edu/~brams006/selfsign.html">Creating a self-signed certificate</a></li>
<li><a href="http://www.tc.umn.edu/~brams006/selfsign_ubuntu.html">Configuring Apache for SSL on Ubuntu</a></li>
</ul>
<p>To enable https access from the "outside world" I also edited the group policy to open up port 443. This could easily be done via the Elasticfox Firefox plugin mentioned earlier.</p>
<h3>Installing and Configuring WordPress</h3>
<p>The default location for Apache httpd server for reading content is <em>/var/www/</em>. If you, as I did, have an existing WordPress installation you can simply copy this to the new server. I ended up having it located at <em>/var/www/wordpress/</em> on the Amazon instance.</p>
<p>Once the database connection properties in the <em>wp-config.php</em> wordpress configuration file was adapted to the new environment I was able to access the WordPress installation via a browser and the Amazon instances' IP address. Sweet!</p>
<p>And as we have our WordPress installation in a separate "<em>/wordpress</em>" folder instead of in the document root of Apache we need to specify, in WordPress admin settings, that the '<em>Site URL</em>' should be "<em>${host}/wordpress</em>" but the<em> 'Blog URL</em>' should simply say "<em>${host}</em>" to prevent the resulting URL from containing "<em>/wordpress/...</em>". This also requires that we move the <em>.htaccess</em> and <em>index.php</em> files from within our "<em>/wordpress</em>" folder and up one level to "<em>/var/www/</em>", in our case. </p>
<p>In the <em>index.php</em> file, make sure to change from</p>
<pre class="php">&nbsp;
<span style="color: #808080; font-style: italic;">/** Loads the WordPress Environment and Template */</span>
<span style="color: #b1b100;">require</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'./wp-blog-header.php'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>to </p>
<pre class="php">&nbsp;
<span style="color: #808080; font-style: italic;">/** Loads the WordPress Environment and Template */</span>
<span style="color: #b1b100;">require</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'./wordpress/wp-blog-header.php'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>If or when specifying the permalinks, WordPress must have write access to the <em>.htaccess</em> file, so 'chmod' that file. </p>
<pre class="bash">&nbsp;
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> .htaccess</span>
&nbsp;</pre>
<p>Otherwise it will complain and simply print out the <em>.htaccess</em> modification it tried to modify with and you are left to change it manually, instead.</p>
<h3>Sending Mail from WordPress</h3>
<p>Mailing is used in WordPress when generating new passwords to users, among others. We also use it to send data backups to the administator of the blog. </p>
<p>Setting up a mail server isn't a trivial task. I gave it a thought but quickly put it aside in favour of the simple WordPress plugin <a href="http://wordpress.org/extend/plugins/wp-mail-smtp/">WP Mail SMTP</a> as I realized I could make use of our existing corporate mail server. It was a breeze to configure the plugin with the necessary mail user credentials.</p>
<p>So, here we are. Sailing these fluffy clouds. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2009/05/07/blogging-among-the-clouds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Amazon S3 for backup</title>
		<link>http://blog.jayway.com/2007/09/02/using-amazon-s3-for-backup/</link>
		<comments>http://blog.jayway.com/2007/09/02/using-amazon-s3-for-backup/#comments</comments>
		<pubDate>Sun, 02 Sep 2007 22:50:20 +0000</pubDate>
		<dc:creator>Ulrik Sandberg</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=162</guid>
		<description><![CDATA[Amazon Simple Storage Service (S3) is cheap on-line storage with a Web Service interface. You just log in with your Amazon id, sign up for S3, designate a credit card, and that's it. You now have access to pretty much unlimited storage space, managed by Amazon. The price is $0.15 per GB-Month of storage used [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://aws.amazon.com/s3">Amazon Simple Storage Service (S3)</a> is cheap on-line storage with a Web Service interface. You just log in with your Amazon id, sign up for S3, designate a credit card, and that's it. You now have access to pretty much unlimited storage space, managed by Amazon. The price is $0.15 per GB-Month of storage used (plus transfer costs). It was too tempting; I simply had to test it.</p>
<p>I used the <a href="http://jungledisk.com/">Jungle Disk</a> software to provide the mapping from the S3 web service interface to a network drive. You give Jungle Disk your S3 account information, and it provides a network disk which you can use as the backup device. I first tried my existing backup software (<a href="http://www.qdea.com/pages/pages-sprox/sprox1.html">Synchronize! Pro X</a>) and it happily began creating directories and copying files. I then tried the backup feature built into Jungle Disk, and it works fine too. It's not fast compared to a local FireWire disk. It's limited to your upload bandwidth, which often is substantially smaller than the download bandwidth.</p>
<p>Anyway, it has been tugging along today storing 5 GB of by digital photos. It feels pretty good to know that my photos are now stored encrypted and with 99.99% availability somewhere far far away, costing me only 75 cents per month after the initial $2 for the transfer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2007/09/02/using-amazon-s3-for-backup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
