R random forest on Amazon ec2 Error: cannot allocate vector of size 5.4 Gb
Here's some advice (use at your own risk!):


make sure that your R environment on EC2 is identical to the one on your laptop
make sure you're using 64-bit images for your virtual machine instance
try to create/enable swap space: https://stackoverflow.com/a/22247782/2872891
see this discussion: https://stackoverflow.com/q/5171593/2872891
see this discussion: https://stackoverflow.com/q/12322959/2872891
see this discussion: https://stackoverflow.com/q/1358003/2872891


If the above-mentioned simpler measures don't help OR you want to achieve more scalability and/or performance, including an ability to parallelize the process on a single machine or across multiple machines, consider using bigrf R package: http://cran.r-project.org/web/packages/bigrf. Also see this discussion: https://stackoverflow.com/q/1358003/2872891.