Google Cloud Essential Skills:
Challenge Lab
Mahmmoud Mahdi
Your challenge
Your challenge is to deploy the site in the
public cloud by completing the tasks below.
You will use a simple Apache web server as
a placeholder for the new site in this
exercise.
Running a Basic Apache Web Server
1.Create a Linux VM Instance
2.Enable Public Access to VM Instance
3.Running a Basic Apache Web Server
4.Test Your Server
Architecture Needed
Requirements Steps
1. Create VM Instance
3. Install Apache Server
2. Open firewall port
4. Test Connectivity
Solution 1
Do it manually
Create a Linux VM Instance
● Name: apache
● Zone: us-central1-a
● Access: Enable Http
Running a Basic Apache Web Server
● SSH Machine
● Install Apache
sudo apt-get update
sudo apt-get install -y apache2
Test Your Server
● Browse the server External IP
● Make sure it response.
Solution 2
Script Task
Tasks
1.Create a Linux VM Instance
2.Enable Public Access to VM Instance
3.Running a Basic Apache Web Server
4.Test Your Server
Automate Apache Installation once Machine Created
1.Create Bucket (To save script on it)
2.Create Startup Script and copy to bucket
3. Create Machine with startup script and
use firewall tag to enable http access
later
echo '#!/bin/bash
apt-get update
apt-get install -y apache2' > resources-install-web.sh
Prepare Apache Installation Script
gsutil mb gs://BUCKET_NAME/
gsutil cp resources-install-web.sh gs://BUCKET_NAME
create bucket, Replace BUCKET_NAME with project Id
create script file contains installation commands
copy startup script to bucket
BUCKET_NAME must be the same as first line
Create Machine
gcloud compute instances create apache 
--zone=us-central1-a 
--tags=http-server 
--metadata=startup-script-url=gs://$BUCKET_NAME/resources-install-web.sh
Machine name
Machine location
Network tag used to open port later
Script location run once machine start
Tasks
1.Create a Linux VM Instance
2.Enable Public Access to VM Instance
3.Running a Basic Apache Web Server
4.Test Your Server
Create Firewall
gcloud compute firewall-rules create default-allow-http 
--direction=INGRESS --priority=1000 --network=default 
--action=ALLOW --rules=tcp:80 
--source-ranges=0.0.0.0/0 
--target-tags=http-server
Firewall rule name
Allow http port
From public interent address
Network tag (Same as tag name in create machine command)
Tasks
1.Create a Linux VM Instance
2.Enable Public Access to VM Instance
3.Running a Basic Apache Web Server
4.Test Your Server
Test Server
gcloud compute instances describe apache
Machine name
Show external Ip and use to browse
Tasks
1.Create a Linux VM Instance
2.Enable Public Access to VM Instance
3.Running a Basic Apache Web Server
4.Test Your Server
Hope it help :)

Google cloud essential skills challenge lab

  • 1.
    Google Cloud EssentialSkills: Challenge Lab Mahmmoud Mahdi
  • 2.
    Your challenge Your challengeis to deploy the site in the public cloud by completing the tasks below. You will use a simple Apache web server as a placeholder for the new site in this exercise.
  • 3.
    Running a BasicApache Web Server 1.Create a Linux VM Instance 2.Enable Public Access to VM Instance 3.Running a Basic Apache Web Server 4.Test Your Server
  • 4.
  • 5.
    Requirements Steps 1. CreateVM Instance 3. Install Apache Server 2. Open firewall port 4. Test Connectivity
  • 6.
  • 7.
    Create a LinuxVM Instance ● Name: apache ● Zone: us-central1-a ● Access: Enable Http
  • 8.
    Running a BasicApache Web Server ● SSH Machine ● Install Apache sudo apt-get update sudo apt-get install -y apache2
  • 9.
    Test Your Server ●Browse the server External IP ● Make sure it response.
  • 10.
  • 11.
    Tasks 1.Create a LinuxVM Instance 2.Enable Public Access to VM Instance 3.Running a Basic Apache Web Server 4.Test Your Server
  • 12.
    Automate Apache Installationonce Machine Created 1.Create Bucket (To save script on it) 2.Create Startup Script and copy to bucket 3. Create Machine with startup script and use firewall tag to enable http access later
  • 13.
    echo '#!/bin/bash apt-get update apt-getinstall -y apache2' > resources-install-web.sh Prepare Apache Installation Script gsutil mb gs://BUCKET_NAME/ gsutil cp resources-install-web.sh gs://BUCKET_NAME create bucket, Replace BUCKET_NAME with project Id create script file contains installation commands copy startup script to bucket BUCKET_NAME must be the same as first line
  • 14.
    Create Machine gcloud computeinstances create apache --zone=us-central1-a --tags=http-server --metadata=startup-script-url=gs://$BUCKET_NAME/resources-install-web.sh Machine name Machine location Network tag used to open port later Script location run once machine start
  • 15.
    Tasks 1.Create a LinuxVM Instance 2.Enable Public Access to VM Instance 3.Running a Basic Apache Web Server 4.Test Your Server
  • 16.
    Create Firewall gcloud computefirewall-rules create default-allow-http --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:80 --source-ranges=0.0.0.0/0 --target-tags=http-server Firewall rule name Allow http port From public interent address Network tag (Same as tag name in create machine command)
  • 17.
    Tasks 1.Create a LinuxVM Instance 2.Enable Public Access to VM Instance 3.Running a Basic Apache Web Server 4.Test Your Server
  • 18.
    Test Server gcloud computeinstances describe apache Machine name Show external Ip and use to browse
  • 19.
    Tasks 1.Create a LinuxVM Instance 2.Enable Public Access to VM Instance 3.Running a Basic Apache Web Server 4.Test Your Server
  • 20.