Recently, I set up an EC2 host. It was a smooth and relatively quick process.
However, the problem with the default image is that it doesn’t come with swap space. You can verify this by running:
swapon -s
I found this tutorial online that walks you through creating a swap file, setting it up, and using it as your swap space:
All About Linux Swap Space
That post doesn’t mention it, so I’ll say it here: you need to use sudo in front of each of those commands. Another thing missing from that tutorial is that as I was setting this up, the shell gave me this warning:
$ sudo swapon /swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.
So, I had to do this:
$ sudo chmod 0600 /swapfile
At the very end, you can check whether you were successful using the swapon -s command:
$ swapon -s
Filename Type Size Used Priority
/swapfile file 1048572 0 -1