Make sure you turn on swap memory - amazon web services - How do you add swap to an EC2 instance? - Stack Overflow
I had major problems with ERPNext performance and it turned out that memory utilization was always high. Couldn’t manage to get support from AWS but after little more reading, figured out that swap filesystem was missing. Created it using the URL indicated above and the system is now running smooth.
Hope it helps others.