Articles → AWS → Swap space in AWS EC2 instances

Swap space in AWS EC2 instances






Purpose





Which Contents Are Transferred To Swap Space?




  1. Content that is not in active use
  2. Content that is not required urgently

How To Implement Swap Space?




sudo dd if=/dev/zero of=/swapfile bs=128M count=32




sudo chmod 600 /swapfile




sudo mkswap /swapfile




sudo swapon /swapfile




sudo vi /etc/fstab




/swapfile swap swap defaults 0 0



How To Check If A Swap Space Is Implemented Successfully?


free -m


Picture showing checking the swap sapce using the free -m command
Click to Enlarge

sudo swapon -s


Picture showing checking the swap space using the sudo swapon -s command
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, May 12, 2022

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250