Jump to content
AskCloud.com
  • Join the site

    Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more!  This message will be removed once you have signed in.

Sign in to follow this  
James Smith

How to add swap memory to my EC2 instance

Recommended Posts

I’m currently running an ec2 micro instance and i’ve been finding that the instance occasionally runs out of memory.

Share this post


Link to post
Share on other sites
Guest A.Sharma

A fix for this problem is to add swap or paging space to the instance.
Paging works by creating an area on your hard drive and using it for extra memory, this memory is much slower than normal memory however much more of it is available.
To add this extra space to your instance you type:

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1

If you need more than 1024 then change that to something higher.
To enable it by default after reboot, add this line to /etc/fstab:

swap /var/swap.1 swap defaults 0 0

Share this post


Link to post
Share on other sites
Sign in to follow this  



×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.