Skip to content

Instantly share code, notes, and snippets.

@choyno
Last active December 22, 2021 05:09
Show Gist options
  • Save choyno/8c578083848c1b1a417bd313e4e1d2aa to your computer and use it in GitHub Desktop.
Save choyno/8c578083848c1b1a417bd313e4e1d2aa to your computer and use it in GitHub Desktop.
Amazon Linux adding Swap Memory
https://www.photographerstechsupport.com/tutorials/adding-swap-space-ec2-amazon-linux-instance/
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/
Here are the steps I took to enable swap space
sudo dd if=/dev/zero of=/swapfile bs=1M count=512
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile
You also have to edit your fstab file so the swap is available after reboot
sudo vi /etc/fstab
Add the following to the bottom of the file – I made sure it lined up with the existing entries, but that’s probably not necessary.
/swapfile swap swap defaults 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment