I want to create a new Google Cloud Compute Engine instance with Ubuntu 18.04 LTS. I tried doing it with the inbuilt image and tried to set up an Ubuntu desktop with VNC. I did end up getting everything to work but felt it was too much of a hassle to install a desktop environment and set up a VNC service.
So I was wondering how I could upload a desktop Ubuntu ISO to Google Cloud and using that as the starting image for a Google Cloud Compute Engine instance.
In order to create custom images there are two possible way:
You can create custom images of boot disks and use these images to create new instances. This is ideal for situations where you have created and modified a persistent boot disk to a certain state and need to save that state to create new instances.
Alternatively, you can import boot disk images to Compute Engine from your existing systems and add them to your custom images list.
There is a whole section of the Google Documentation "How-to" regarding the creation of Custom images that I advise you to follow.
In particular I believe you are interested how to import a Boot Disk to Compute engine.
Shortly the steps are the following:
Plan your import path. You must identify where you are going to prepare your boot disk image before you upload it, and how you are going to connect to that image after it boots in the Compute Engine environment.
Prepare your boot disk so it can boot within the Compute Engine environment and so you can access it after it boots.
Create and compress the boot disk image file.
Upload the image file to Google Cloud Storage and import the image to Compute Engine as a new custom image.
Use the imported image to create a virtual machine instance and make sure it boots properly.
If the image does not successfully boot, you can troubleshoot the issue by attaching the boot disk image to another instance and reconfiguring it.
Optimise the image and install the Linux Guest Environment so that your imported operating system image can communicate with the metadata server and use additional Compute Engine features.
Related
I just set up everything on google cloud shell (terminal that activates when you press "activate cloud shell" on top right). However, i just now realised it is not the same thing as the Instance-1 i created as connecting to it by pressing "SSH" leaves me with none of the software i installed in google cloud shell.
Why is it so? Is it possible to add google cloud shell to the Instance-1 virtual machine i just created? (it would greatly easy software setup)
As #John hanley expressed in the comments, cloud shell are transient and it isn't suggested to utilize it to store or introduce lasting data and applications.
In your case, you'd like to have an instance where you've got a default setup with the fundamental software preinstalled. There are 3 alternatives you'll utilize for this situation.
Using Snapshot, Image or Instance template.
A snapshot reflects the contents of a persistent disk in a concrete
instant in time. An image is the same thing, but includes an
operating system and boot loader and can be used to boot an instance.
But snapshot is cheaper in terms of cost.
Images are primarily meant for boot disk creation. They optimized for
multiple downloads of the same data over and over. If the same image
is downloaded many times, subsequent to the first download the following
downloads are going to be very fast (even for large images).
Instance templates define the machine type, boot disk image or
container image, labels, and other instance properties. An instance
template is a global resource that is not bound to a zone or a region.
All these options can create an instance using the cloud shell and you can get the command line version by clicking the Equivalent command line button when creating the resource.
After the setup, you will just initiate the command on cloud shell based on the option you chose then connect to your instance via SSH from cloud shell as also suggested by #dany L.
How would I go about getting CentOS 8 as a VM option in GCP/GCE? or creating my own CentOS 8 VM to run on GCP?
Any guides (README's, documents) there or contacts on how to get this done?
There is an article on GCP that talks about a technique/recipe for creating a boot image that is custom. The article is called Manually importing virtual disks. If I understand the basics of the story, you could use a technology such as VirtualBox to create a local VM image and then prepare that for import into Google Cloud Storage. From there, one could then seem to use that as a source for a new Compute Engine instance.
Currently GCP supports Centos-7 as a public image. As suggested by the previous member you can create a Custom image from source disks, images, snapshots, or images stored in Cloud Storage.
See instructions HERE
Your other option is to wait for Google to introduce Centos-8 in their supported family
Centos 8 is already available on GCE but it is without shielded VM support.
I set up centos and windows VMs in Google Cloud which has many custom installations and configuration, with 1 boot disk and 4 data disks.
I am trying to create an image of both VMs. Only options I see in google cloud to create an image from disk, snapshot, another image, cloud file or virtual disk.
Looking for some way to create an image at VM level, which I can reuse to create new VMs something similar to custom ami in AWS or custom image in Azure.
The intention is if I create VM out of that image, my new VM will come up with all 5 disks. On GCP console, when I try to create an image, it has no option of using whole VM as a source instead, I can choose single disk as source.
Is there any way or workaround to achieve this in Google Cloud?
Thanks in advance.
I found GCP Instance Templates as a solution to my problem. I can reuse Instance Templates to deploy my custom VMs.
I want to move some VMs across projects on GCP using the Cloud SDK.
I'd like the process on a high level, and then possibly also some links out to the relevant docs, although I can RTFM when I know what the general high-level steps are.
I think what I want to do is
Create a snapshot
Save it somewhere
Create two Cloud SDK contexts?
Prepare a destination in the context for the new project
Copy the snapshots over to the new context and its associated storage
Rehydrate from the copied snapshot in the new project once everything is copied.
Please help. I'm new with this stuff and want to know whether this is really how it should be done.
Thanks!
You can use this guide
Quick summary of steps needed
Detach the boot disk from the VM that you intend to move by deselecting “Delete boot disk on instance delete” and terminating the VM
Create an image from the detached boot disk
Upload the image to Google Cloud Storage and share it with the new project
Create a custom image under the new project based on the image you uploaded to Google Cloud Storage
Create a new VM instance under the new project based on the custom image
Cloning VM from console?
I tried this solution but changes inside VM before cloning are not available in new VM
Create snapshot from bootdisk and then use snapshot to create VM.
Use existing boot disk when creating VM from select boot disk popup.
Create new Image form snapshot and use that Image to create the VM.
Since you asked the best, it will be #4 (Create new Image form snapshot and use that Image to create the VM.). This will give you an option to refer to the image by family name while doing the automation. Also it will help you version the image and deprecate the older image etc.