Are you looking to create a cloud-based solution for your website or database backend?
One approach to create a cloud-based solution is to use Amazon's AWS, which is a popular platform today. AWS is a suite of many platform software products including EC2. EC2 provides virtual instances of computer servers, which places the same function as running several desktop computers inside one's office and connecting them to the Internet.
A popular solution for running a computer server is to run the Ubuntu 12.04 64-bit operating system. Ubuntu is an alternative to Mac OS X and Windows, which are primarily consumer-facing desktop operating systems. Ubuntu comes in two versions, one for desktop computers similar to the others and another server version without the GUI. Ubuntu's selling points are an open source codebase, strong community support, and GUI-less server operation.
Amazon EC2 can run several operating systems include Ubuntu 12.04. Amazon's regular EC2 servers provide the same environment as a regular server, but changes in EC2 aren't saved when the server is terminated. In other words, when the server is shut down, data changes are lost. EC2, thus, cannot be used for running data-centric applications out of the box.
Amazon introduced another product, S3, to provide persistent data storage. It provides RESTful access to data, which cannot be accessed like a regular server: special libraries are required. Amazon later introduced Elastic Block Store (EBS), which is a “virtual hard drive” (volume) for saving persistent data. EBS is accessed like a regular file system in Ubuntu.
Amazon's control panel for EC2 allows you to setup Ubuntu 12.04 with EBS. Amazon's control panel, however, does not format or mount the EBS volume. The following additional steps are required once a user logins into Ubuntu 12.04 on EC2:
1. Create an EBS Volume and attach it to the EC2 instance in EC2 panel management (in the AWS portal). Note the EBS volume name (e.g.,sdb).
2. Login to the EC2 instance using ssh.
3. Confirm that the EBS volume is attached:
sudo fdisk -l
You should see two (or more) disks listed:/dev/xvda1 and /dev/xvdb. Note that the EBS volume name (sdb) is listed as xvdb because Ubuntu 12.04 differentiates between real and virtual drives.
4. The new disk isn't formatted. You format the disk with the following:
sudo mkfs -t /dev/xvdb
You should see output such as:
mke2fs 1.42 (29-Nov-2011)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks65536 inodes, 262144 blocks13107 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=2684354568 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376Allocating group tables: doneWriting inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: done
5. Edit /etc/fstab, e.g., using
sudo nano /etc/fstab
Add in the line to mount the new drive to /var:
/dev/xvdb /var auto defaults,nobootwait,noatime 0 0
6. Log out of ssh and reboot the instance from EC2 panel management (website).
7. After the server has rebooted in EC2 panel management, log back in to ssh.
8. Confirm that/dev/xvdb is mounted by typing in:
mount
For example:
/dev/xvda1 on / type ext4 (rw)proc on /proc type proc (rw,noexec,nosuid,nodev)sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)none on /sys/fs/fuse/connections type fusectl (rw)none on /sys/kernel/debug type debugfs (rw)none on /sys/kernel/security type securityfs (rw)udev on /dev type devtmpfs (rw,mode=0755)devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)none on /run/shm type tmpfs (rw,nosuid,nodev)/dev/xvdb on /var type ext4 (rw,noatime)
This article was written based on instructions for Ubuntu 10.10.