Monday, March 12, 2012

Adding Swap Space to Amazon EC2 Linux Micro Instance to Increase the Performance

Amazon EC2 Micro Instance comes only with 613MB of memory. Now, this is just not enough for running serious workloads. Other thing to note is that the Linux Micro Instance doesn’t have swap space. Follow these steps to add swap space and increase the performance of your Linux based Amazon EC2 Micro Instance.
Switch to root and follow these steps to add the swap space -
Type the following command with count being equal to the desired block size:

dd if=/dev/zero of=/swapfile bs=1M count=1024

Setup the swap file with the command:

mkswap /swapfile

To enable the swap file immediately but not automatically at boot time:

swapon /swapfile

To enable it at the boot time, add the following entry into /etc/fstab:

/swapfile swap swap defaults 0 0


No comments: