Startup scripts can be used to install software and updates, and to ensure that services are running within the virtual machine. This script will automatically run whenever your instance restarts. In this article, we will create an instance of Compute Engine and deploy it over the cloud to understand the process of deployment on Google Cloud Storage.
To do so follow the below steps:
1. Create a bucket
Navigate to Google Cloud Console and click on Storage.
Click on CREATE BUCKET and choose a globally unique name for your bucket and click on create.
2. Upload the script
Next step is to upload your script in the bucket. Navigate to your bucket (geeksforgeeks) → upload files and choose the file to upload. Once your script is uploaded, your page looks similar to the image below.
3. Edit the permissions
Click on the three dots menus where you will find a list of options. Choose edit permissions to add the user.
For example, here we have set public access to the file.
4. Create instance
Here we will be creating an instance of the Google Compute Engine. To do so click on Compute Engine.
Now, click on VM Instances and create a VM instance with appropriate name and the required region.
Now allow HTTP traffic and expand management, security, disks, networking section to add the file URL.
Now, add the URL of the file as the Key. You can get it from the bucket where you uploaded the file.
Once you are done configuring, click create. The instance is created when you can see a green tick mark near your instance name.
Finally, click on your instance name and select serial port 1 under logs to install the Apache webserver.
5. Verify deployment
If your screen looks similar to the below image, you have successfully deployed an instance. You can verify the deployment with external IP.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.