Google Cloud: Deploy a Compute Instance with a Remote Startup Script to Install Apache Web Server

Share At:

In this Lab, we will configure a Linux Google Compute Engine instance that installs the Apache web server software using a remote startup script. In order to confirm that Apache has successfully installed, the Compute Engine instance must be accessible via HTTP from the internet.

Please follow below steps:

  1. Please go to Navigation Menu> Storage > Browser
  2. Click on “Create Storage Bucket” and give your bucket an Unique name. Keep everything as Default.

4. Now Upload the startup script in the storage bucket. Click on the “Upload Files” Icon to upload it. After Upload you should see something like below:

Our startup script called “resources-install-web.sh” is has below contents:

5. Now to make the script publicly accessible, Click the three dots icon at the right end of the filename. Choose Edit permissions in the dropdown menu.

6. Add “Public” Entity for “allUsers” and provide with “reader” permission. Click on Save.

7. Now click on the uploaded script in the storage bucket and note down the URI. This URI will be needed when we create our Virtual Machine Instance.

8. Now Go to navigation menu > Compute Engine > VM Instances > Create Instance.

  • Provide your virtual Machine a name.
  • Select Allow HTTP traffic under the Firewall section.
  • Now Expand Management, security, disks, networking, sole tenancy. In the Metadata section, add startup-script-url and paste the URI of the script file as the key value. Click “Create” to Create the instance.
  • You will see our VM instance has been created and is up and running.

9. Upon Successful creation of our VM, You will see “External IP” attached to the VM. Now Copy that IP and Open in a web browser. You will see the default page of Apache2 Web server.

Congratulations !!! You have just deployed a VM instance with Automated Startup Script that Installs Apache web server.

This Concludes our tutorial for “Deploy a Compute Instance with a Remote Startup Script to Install Apache Web Server”.

Happy Learning !!!


Share At:
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Back To Top

Contact Us