If you are using the EC2 Free Tier micro instance, but the 600MB of RAM becomes a problem.
I ran into this when trying to compile something within the free tier – not enough RAM, no compiled binary. Easy fix, though.
You can’t add more RAM, but you can get around the lack of a swap file (virtual memory), thus giving the machine more addressable memory.
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
sudo mkswap /swapfile1
sudo chown root:root /swapfile1
sudo chmod 0600 /swapfile1
sudo swapon /swapfile1
Then add the following line to your fstab (/etc/fstab):
/swapfile1 swap swap defaults 0 0
Test this with free -m and you should have a 512MB swap file adding to your 600MB RAM.