Friday, April 5, 2013

How to add Swap Space to Amazon EC2 Linux (Micro) Instances?

Micro instance (t1.micro) type is one of the most fashionable and highly acceptable instance types by IT fellows supported by Amazon EC2.  Other thing to note down is that the Linux Micro Instance doesn't have swap space.
Follow these steps to append swap space and boost the recital of your Linux based Amazon EC2 Micro Instance.
Login to AWS Console, switch to root and follow these steps to add the swap space.

Fire following command with count that should be equal to the preferred block size:
dd if=/dev/zero of=/swapfile bs=2M count=2048

Create the swap file with the following command:
mkswap /swapfile

To enable the swap file instantaneously but not automatically at boot time:
swapon /swapfile

To enable the swap file at the boot time, add the subsequent entry into /etc/fstab:
/swapfile swap swap defaults 0 0

That’s it…..Voila!

Your Reviews/Queries Are Accepted