Skip to content

Instantly share code, notes, and snippets.

@kieetnvt
Last active November 2, 2017 16:59
Show Gist options
  • Save kieetnvt/5ba09f49332ea9c9fda61d22b573b951 to your computer and use it in GitHub Desktop.
Save kieetnvt/5ba09f49332ea9c9fda61d22b573b951 to your computer and use it in GitHub Desktop.
Adding swap space to an EC2 Amazon Linux instance
With instance EC2 T2.micro 1.0 GiB 1 vCPUs (http://www.ec2instances.info/?cost_duration=monthly&selected=t2.micro)
Here are the steps I took to enable swap space:
dd if=/dev/zero of=/swapfile bs=1M count=512
mkswap /swapfile
chmod 600 /swapfile
swapon /swapfile
You also have to edit your fstab file so the swap is available after reboot:
sudo vim /etc/fstab
Add the following to the bottom of the file:
/swapfile swap swap defaults 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment