Search code examples
google-cloud-platformgoogle-compute-enginegoogle-cloud-launcher

Modify images located Google Cloud Launcher


Has anyone been able to edit an image that resides in Cloud Launcher?

I am trying to edit a CIS Ubuntu image to add some services like you normally would leveraging located in the images section of Compute Engine.

I need to modify some settings prior to the image being deployed using the command: gcloud beta compute instances create

Any thoughts or feedback would be greatly appreciated.

Cheers


Solution

  • Yes this is possible by first launching the required image via Cloud Launcher, making the modifications you require, and then saving the modified machines disk as an image. If you wished, you could then delete the original machine you launched via Cloud Launcher, and launch the image you created with the gcloud beta compute instances create.

    Here are some step by step instructions.

    1) Launch CIS Ubuntu via Cloud Launcher.

    2) SSH into the machine and make any modifications you desire.

    3) Save the modified disk as an image. To do this navigate to 'Compute Engine' > 'Images' > 'Create Image' and select the boot disk of the CIS Ubuntu instance as the 'Source Disk'. Hit 'Create'.

    4) Delete the original machine you launched via the Cloud Launcher

    You now have a modified image of the CIS Ubuntu image saved in your project.

    You can use this image in conjunction with gcloud beta compute instances create to create a new instance that uses the modified image as the source disk. For example, if you named the image you created in step 3 'cis-image', you could run:

    gcloud beta compute instances create mynewinstance --image=cis-image --zone=us-east1-b
    

    Also, if you're not making use of any beta features, you could just use the standard gcloud compute instances create (see here) command instead, for example:

    gcloud compute instances create mynewinstance --image=cis-image --zone=us-east1-b
    

    Which ever you choose, this will launch the machine with your modified image.