Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Labs

Using Bootstrap Scripts in Google Compute Engine

If you've ever had to set up more than one server, you know how tedious and error-prone running commands on several servers in a row can be. In this lab, we automate the basic set up of a new server in Google Compute Engine using bootstrap scripts. To start, we deploy a simple bootstrap script, then use the bootstrap script stored in Cloud Storage that references the Compute Engine metadata server.

Lab platform
Lab Info
Level
Beginner
Last updated
Sep 23, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Deploy Apache with a Startup Script
    1. Create a new VM instance with the following settings:
      • Machine type: e2-small
      • Firewall: Set to Allow HTTP traffic
    2. Add a startup script to the instance configuration using the provided code:
      #! /bin/bash
      apt update
      apt -y install apache2
      cat <<EOF > /var/www/html/index.html
      <html><body><h1>Hello Cloud Gurus</h1>
      <p>This page was created from a startup script.</p>
      </body></html>
      EOF
      
    3. Use the generated external IP to view the web page created by your startup script.
  2. Challenge

    Deploy a Startup Script from a Cloud Storage Bucket
    1. In the GCP console, create a unique bucket name to store a startup script. For example, use the last 8 digits of the project name to create a name like 836bd4db-scripts.
    2. Create the startup.sh file on your local computer using the provided code:
      #! /bin/bash
      apt update
      apt -y install apache2
      ZONE=`curl -fs http://metadata/computeMetadata/v1/instance/zone -H "Metadata-Flavor: Google" | cut -d'/' -f4`
      cat <<EOF > /var/www/html/index.html
      <html><body><h1>Hello Cloud Gurus</h1>
      <p>This server is serving from ${ZONE}.</p>
      </body></html>
      EOF
      
    3. Upload the file to your storage bucket and copu the URI of the object location.
    4. Create a new VM with the following settings:
      • Machine type: e2-small
      • Firewall: Set to Allow HTTP traffic
    5. In the Metadata section, set the following as:
      • Key: startup-script-url
      • Value: Startup script URI
    6. Use the generated external IP to view the web page created by your startup script.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight