Create a VM Using a Predefined Image
Create a VM instance and make sure to Allow HTTP and HTTPS traffic
Now, SSH into it and install apache and commands for that are listed below
sudo su
apt update
apt -y install apache2
apache is installed
Close this SSH, and copy your External IP and paste it into the browser
You will be able to see apache2 page that means your apache is successfully installed
Close this page
Now, stop your instance as we are going to create an image of this vm
After that, from the left hand-side pannel, under Storage select Images
Click on Create Image
Name your image, select source and for source-disk select the instance which you have created earlier
Now, click on create
Now, go back to VM instances and here we will create another instance but it’s gonna be little different from the previous way
While creating VM, under Boot Disk section click on CHANGE
Go to Custom Images and select your previously created image
Click on select button
Under Firewall, select Allow HTTP traffic and Allow HTTPS traffic
Click on create button
Now, our instance is ready which we have have created by using custom image
Now, copy the External IP of this newly created instance and hit it in the browser, you will be able to see the apache2 default page which we have intsalled in our previous instance i.e. gauri-instance
You’ve successfully launched VMs using custom and predefined images! Ready for the next challenge? In the following post, we’ll tackle creating VMs from snapshots. Stay tuned, it’s going to be exciting!
Subscribe to my newsletter
Read articles from Gauri Agrawal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by