I ran into a similar problem running a micro instance on AWS (not running cabal update, but compiling my own program). I followed the suggestions in this link to create a swap space and it did the trick.
From the link:
> dd if=/dev/zero of=/tmp/swap bs=1M count=1024
> mkswap /tmp/swap
> swapon /tmp/swap
The dd command creates a swap file with the name “swap” under the /tmp directory with a size of 1024MB (1GB).
Make this file as a swap file using the mkswap command.
Enable the newly created swapfile using the swapon command.
This link has more information about swap spaces.