You can create a RAM disk with the tmpfs tool, which is installed by default on many Linux Operating Systems.
your instance does not have enough available memory, you can optionally change the instance machine type to a machine type with more memory.
Connect to your instance through SSH. For this example, go to the VM instances page and click the SSH button next the instance where you want to add a RAM disk.
Create a mount point for your RAM disk.
$ sudo mkdir /mnt/ram-disk
Create and mount a new tmpfs RAM disk. You must determine a value for the size property that meets your storage requirements without competing with your applications for memory or expending all of the available memory. For this example, the instance has a n1-highmem-32 machine type with 208 GB of memory, so a 50g RAM disk size is appropriate.
$sudo mount -t tmpfs -o size=50g tmpfs /mnt/ram-disk
Add the RAM disk to the /etc/fstab file so that the device automatically mounts again if you restart the instance:
$echo 'tmpfs /mnt/ram-disk tmpfs nodev,nosuid,noexec,nodiratime,size=50G 0 0' | sudo tee -a /etc/fstab