swapfile on amazon instance
amazon ec2 instance doesn’t have swapfile by default:
sudo swapon -sthe output should show no swap files. we need to add a swap file for better instance performance.
we can create a 4gb file by typing:
sudo fallocate -l 4G /swapfilenow we need to set permissions to file, so only root can write to it.
sudo chmod 600 /swapfilenow let’s make a swap
sudo mkswap /swapfilefinally we need to enable a swap file
sudo swapon -snow the output of >sudo swapon -s will show that you have a 4gb swap file.