Monday, January 2, 2012

Create Swap Space in Amazon EC2 instance

Just found out my Amazon EC2 micro instance does not have any swap space. The memory comes with the micro instance is enough for a regular PHP app, but not enough for any J2EE application. It's time to add a file system swap. Below are steps for creating a swapfile:
  1. login as ec2-user with putty.
  2. sudo su
  3. dd if=/dev/zero of=/swapfile bs=1024 count=1048576
  4. /sbin/mkswap /swapfile
  5. /sbin/swapon /swapfile
  6. /sbin/swapon -s

No comments:

Post a Comment