Deploy a Compute Instance with a Remote Startup Script
3.9 KiB
title | description | summary | date | draft | author | tags | canonicalURL | showToc | TocOpen | TocSide | hidemeta | comments | disableHLJS | disableShare | hideSummary | searchHidden | ShowReadingTime | ShowBreadCrumbs | ShowPostNavLinks | ShowWordCount | ShowRssButtonInSectionTermList | cover | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
[GSP301] Deploy a Compute Instance with a Remote Startup Script | Quest: Cloud Architecture: Design, Implement, and Manage | 2023-05-26T11:30:03+07:00 | false | Hiiruki |
|
true | false | right | false | false | true | true | false | false | true | true | true | true | true |
|
GSP301
- Time: 1 hour
- Difficulty: Intermediate
- Price: 5 Credits
Lab: GSP301
Quest: Cloud Architecture: Design, Implement, and Manage
🔄 Last updated: Sep 06, 2023
Challenge scenario
You have been given the responsibility of managing the configuration of your organization's Google Cloud virtual machines. You have decided to make some changes to the framework used for managing the deployment and configuration machines - you want to make it easier to modify the startup scripts used to initialize a number of the compute instances. Instead of storing startup scripts directly in the instances' metadata, you have decided to store the scripts in a Cloud Storage bucket and then configure the virtual machines to point to the relevant script file in the bucket.
A basic bash script that installs the Apache web server software called install-web.sh
has been provided for you as a sample startup script. You can download this from the Student Resources links on the left side of the page.
Your challenge
Configure a Linux Compute Engine instance that installs the Apache web server software using a remote startup script. In order to confirm that a compute instance Apache has successfully installed, the Compute Engine instance must be accessible via HTTP from the internet.
Task 1. Confirm that a Google Cloud Storage bucket exists that contains a file
Go to cloud shell and run the following command:
gsutil mb gs://$DEVSHELL_PROJECT_ID
gsutil cp gs://sureskills-ql/challenge-labs/ch01-startup-script/install-web.sh gs://$DEVSHELL_PROJECT_ID
Task 2. Confirm that a compute instance has been created that has a remote startup script called install-web.sh configured
gcloud compute instances create example-instance --zone=us-central1-a --tags=http-server --metadata startup-script-url=gs://$DEVSHELL_PROJECT_ID/install-web.sh
Task 3. Confirm that a HTTP access firewall rule exists with tag that applies to that virtual machine
gcloud compute firewall-rules create allow-http --target-tags http-server --source-ranges 0.0.0.0/0 --allow tcp:80
Task 4. Connect to the server ip-address using HTTP and get a non-error response
After firewall creation (Task 3) just wait and then check the score