When running an ec2 micro instance and you’ve been finding that the instance occasionally runs out of memory,  then you fix this problem adding swap or paging space to the instance.

Paging works by creating an area on your hard drive and using it for extra memory, this memory is much slower than normal memory, however much more of it is available.

To add this extra space to your instance you type:

If you need more than 1024 then change that to something higher.

To enable it by default after reboot, add this line to /etc/fstab: