Table of Contents
Overview
Labs are timed and cannot be paused. The timer starts when you click Start Lab.
The included cloud terminal is preconfigured with the gcloud SDK.
Use the terminal to execute commands and then click Check my progress to verify your work.
Challenge scenario
You have an existing Cloud Storage bucket named
qwiklabs-gcp-03-45b585bc78cb-bucketfor static website hosting. It contains the necessary files:index.html
style.css
logo.jpg
Currently, the objects in the bucket are not configured for website hosting. Your task is to update the content type of the object so that instead of prompting you to download the index.html file of the website, it will get accessible in the browser.
Click Check my progress to verify the objective.
Update the object metadata for website hosting
Solution of Lab
curl -LO raw.githubusercontent.com/ePlus-DEV/storage/refs/heads/main/labs/manage-rendering-for-cloud-storage-website-hosting/lab.sh
source lab.sh
Script Alternative
PROJECT=$(gcloud config get-value project) && BUCKET="qwiklabs-gcp-03-479c3001b85e-bucket" && gsutil setmeta -h "Content-Type:text/html" gs://${BUCKET}/index.html && gsutil setmeta -h "Content-Type:text/css" gs://${BUCKET}/style.css && gsutil setmeta -h "Content-Type:image/jpeg" gs://${BUCKET}/logo.jpg && gsutil web set -m index.html -e 404.html gs://${BUCKET} && gsutil iam ch allUsers:objectViewer gs://${BUCKET}

