Since AWS have now introduced a t2.nano instance, it is even cheaper to run a single instance for very low volume services, which don’t need the CPU performance of a t2.micro. However one thing to watch out for is memory – t2.nano instances only come with 512Mb of RAM, and I found that the mysqld instance I had on my t2.micro server kept mysteriously stopping when I downsized the instance. It seems as if more RAM is required, and the solution to this if you want to stick with a t2.nano instance is to introduce a swap volume to provide more available logical RAM to the instance.
To make a swap volume, first create a volume in EC2 of, say, 1Gb, you can use the gp2 volume type. Then attach it to your EC2 t2.nano instance, noting the device it is attached as – e.g. /dev/sdg
Then log in to your instance as ec2-user, and type
% sudo mkswap /dev/xvdg % sudo swapon /dev/xvdg % swapon -s % lsblk
The last 2 commands check that the swap volume is connected, you can also check this in top.
To ensure the swap volume is always connected at startup, type:
% sudo vi /etc/fstab
and add the following line
/dev/xvdg none swap sw 0 0