Usually Linux distributions with a long life cycle like RHEL (or its free derivative CentOS), Debian or SLES are the way to go for virtual machines in a cloud environment. But sometimes you need to be a little bit closer to upstream. Maybe because your applications relies on newer version of some packages that are not (easily) available on distributions with long term support or maybe because you need a feature that has just not yet made it to RHEL, Debian or SLES.
In those cases, Fedora is an interesting choice, since it’s probably the Linux distribution that’s closest to upstream and provides the most features that could be considered ‘bleeding edge’. Unfortunately there’s currently no publicly available Fedora image on the Google Cloud Platform. But not to worry, it’s quite easy to run Fedora 27 on GCE.
The Fedora Project provides a compressed raw disk image that can be used to spawn VMs on different platforms, e.g. GCE. To use it with the Google Compute Engine, the image has to be renamed and repackaged though:
wget https://dl.fedoraproject.org/pub/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.raw.xz xz --decompress Fedora-Cloud-Base-27-1.6.x86_64.raw.xz mv Fedora-Cloud-Base-27-1.6.x86_64.raw disk.raw tar cfz Fedora-Cloud-Base-27-1.6.x86_64.tar.gz disk.raw --sparse rm disk.raw
The image can now be uploaded into a Google Cloud Storage bucket:
gsutil mb gs://fedora-cloud-base-27 gsutil cp Fedora-Cloud-Base-27-1.6.x86_64.tar.gz gs://fedora-cloud-base-27/
Now, we can create an image and use that to spawn a GCE instance:
gcloud compute images create --source-uri gs://fedora-cloud-base-27/Fedora-Cloud-Base-27-1.6.x86_64.tar.gz fedora-cloud-base-27 gcloud compute instances create fedora27 --machine-type f1-micro --image fedora-cloud-base-27 --zone us-east1-b
Of course, you might want to choose a different machine-type or zone here.
Once the VM is booted (and assuming a metadata key value pair for the project provides a public ssh key) one can connect to the instance via:
gcloud compute ssh fedora@fedora27