Compiling depends more on the CPU as opposed to RAM. EC2 small instance has 1 compute unit. "One EC2 Compute Unit provides the equivalent CPU capacity of a 1.0-1.2 GHz 2007 Opteron or 2007 Xeon processor."
I would not recommend you to compile on there. You can just compile locally and upload there since it is Java and JavaScript and runs everywhere.