Beware: certain Amazon EC2 AMI’s terminate at shutdown

I toyed with Amazon EC2 last year by migrating my web server there. After issuing shutdown -P in Ubuntu last week, my instance disappeared from the list in the AWS dashboard. I seeked help and found out that some AMI’s are set to terminate at shutdown. Unfortunately, the AMI I used was one of them. Files and settings are not recoverable after an instance is terminated. Luckily, I transferred most of my critical information out prior to the shutdown; I’m only missing one file. Note to self: for all future instances, the shutdown behavior to stop (as opposed to terminate) could be modified per these instructions. First, create and download the X.509 certificate and private key. To access the EC2 api, do the following on your computer:

<pre class="src src-sh">sudo apt-get install ec2-api-tools ec2-ami-tools <span style="color: #ff4500;">##</span><span style="color: #ff4500;">ec2-init</span>

Then, do the following to find out what behavior is currently set on your instance:

ec2-describe-instance-attribute i-AMAZON-INSTANCE-ID --instance-initiated-shutdown-behavior -K /path/to/x509-key.pem -C /path/to/x509-cert.pem 

If the value is not stop, then do

ec2-modify-instance-attribute i-AMAZON-INSTANCE-ID -K /path/to/x509-key.pem -C /path/to/x509-cert.pem --instance-initiated-shutdown-behavior stop

Writing and publishing books on Kindle

Thanks to the digital book revolution, it is quite easy to publish your work yourself without convincing a publisher to publish them for you or pay hefty fees to have them publish. This post on Linux Journal suggests using an OpenOffice template (not free) to write your work that is perfectly compatible with the Kindle.

I searched up how to do so for LaTeX, and found this post with a LaTeX template.

Quite nice and easy to self-publish with a reputable publisher and make money. Most of my work will probably be freely available though.

Amazon EC2 free hosting (micro instance) for 1 year – Ubuntu + WordPress + Asterisk

I use old laptops as web servers at school. However, they really aren’t built to be running continuously; I have disk problems on both of my old laptops. Amazon Web Services offer a free usage tier of EC2 cloud service for 1 year. After the 1 year, the micro instance cost about $.02/hr, which is still pretty cheap. I sign up for an account with Amazon Elastic Compute Cloud (EC2), started an instance, installed the ami-3e02f257 AMI, downloaded the private key, and the ball started to roll. Before you can ssh to your server, you have to set up the firewall from the management console of EC2 to open port 22 per this post. To log in and set up, I had to download the private key (PEM) that amazon generated and logged in as the user ubuntu (root is not allowed for my chosen AMI; this is the default user per the AMI):

<pre class="src src-sh">ssh -i /path/to/amazon.pem ubuntu@permanent.dns

Once logged in, I changed the ssh configuration to allow user logins. Then, I created my user account:

<pre class="src src-sh"><span style="color: #ff4500;">## </span><span style="color: #ff4500;"></span>

sudo useradd -d /home/username -m username ## create user sudo passwd username ## set password

## sudo adduser username admin

## sudo emacs -q -nw /etc/passwd ## change /bin/sh to /bin/bash

Now I can log in with my username, and enable passwordless ssh.

Now that Ubuntu is set up, I can install everything I want subject to the constraints of the server. Let’s see how this goes…